akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;


public class Main {


//	final int MOD = 1000000007;

//	public static long min = 2000000000;
	public static long ans = 0;

	public static void main(String[] args) {

//		int ans = 0;
		Scanner sc = new Scanner(System.in);
		boolean f = false;

//		long k = sc.nextLong();

		int n = sc.nextInt();
		int m = sc.nextInt();
		long k = sc.nextLong();


		long[] a = new long[n+1];
		a[0] = 0;
		for (int i = 1; i <= n; i++) {
			a[i]= sc.nextLong() + a[i-1];
		}

		long[] b = new long[m+1];
		b[0] = 0;
		for (int i = 1; i <= m; i++) {
			b[i]= sc.nextLong() + b[i-1];
		}

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

//		Arrays.sort(a);
//		Arrays.sort(b);
		int j = m;
		for(int i =0; i <= n; i++ ) {
			if(a[i] > k) {
				break;
			}
			while(b[j] > k - a[i]) {
				j--;
			}
//			System.err.println(i +" " + j);
			ans = Math.max(ans, i+j);
		}

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

//		if(f) {
//			System.out.println("Yes");
//		} else {
//			System.out.println("No");
//		}

		System.out.println(ans);

		sc.close();
	}
}

Measured memory_bytes: 63932
#include <bits/stdc++.h>
#include <atcoder/all>

#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;
using namespace atcoder;
using ll = long long;

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

    string s;
    cin >> s;

    vector<int> sa = suffix_array(s);
    ll ans = s.size() * (s.size() + 1) / 2;
    for(int l: lcp_array(s, sa)) ans -= l;

    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 15588
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
int main(){
    ll n,k,ans=0,mod=1e9+7;
    cin>>n>>k;
    for(ll i=k;i<=n+1;i++){
        ll x=(i*(i-1))/2;
        ll y=((n+n+1-i)*i)/2;
        //cout<<y<<" "<<x<<endl;
        ans=(ans%mod+(y-x+1)%mod)%mod;
    }
    cout<<(ans%mod+mod)%mod<<endl;
}   

Measured memory_bytes: 3604
## coding: UTF-8
S = input()  # type(S) => <class 'str'>



#print(S[-3:]) daydaydreamdream
answer = 'YES'

while True:
    tester = S[-3:] #末尾3文字で判断
    if(tester == 'eam'): #末尾3文字がeamならdream
        if(S[-5:] == 'dream'): #dreamだったらdreamをカット、それ以外だったらこの地点でNO
            S = S[:-5] #末尾5文字(dream)をカット
            #print('1')
            #print(S)
        else:
            answer = 'NO'
            break
    elif(tester == 'mer'): #末尾3文字がmerならdreamer
        if(S[-7:] == 'dreamer'): #dreamerだったらdreamerをカット、それ以外だったらこの地点でNO
            S = S[:-7] #末尾7文字(dreamer)をカット
            #print('2')
            #print(S)
        else:
            answer = 'NO'
            break
    elif(tester == 'ase'): #末尾3文字がaseならerase
        if(S[-5:] == 'erase'): #eraseだったらeraseをカット、それ以外だったらこの地点でNO
            S = S[:-5] #末尾5文字(erase)をカット
            #print('3')
            #print(S)
        else:
            answer = 'NO'
            break
    elif(tester == 'ser'): #末尾3文字がserならeraser
        if(S[-6:] == 'eraser'): #eraserだったらeraserをカット、それ以外だったらこの地点でNO
            S = S[:-6] #末尾6文字(eraser)をカット
            #print('4')
            #print(S)
        else:
            answer = 'NO'
            break
    elif(len(S) == 0):
        break
    else:
        answer = 'NO'
        break

print(answer)


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

int main() {
    int k; cin >> k;
    rep(i, k) cout << "ACL";
    cout << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std;
using ll=long long int;

template<typename M, typename N>
constexpr common_type_t<M, N> gcd(M a, N b) {
    return b ? gcd(b, a%b) : abs(a);
}

int main() {
    ll n, m;
    cin >> n >> m;
    string s, t;
    cin >> s >> t;

    ll g = gcd(n, m);
    for (int i = 0; i < g; ++i) {
        if (s[n / g * i] != t[m / g * i]) {
            cout << -1 << endl;
            return 0;
        }
    }

    cout << n * m / g << endl;

    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define int long long
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;

signed main(){
	ios_base::sync_with_stdio(0);
	int n,m;
	cin>>n>>m;
	vector<int> a(n);
	int sum=0;
	for(int i=0;i<n;i++) cin>>a[i],sum+=a[i];
	sort(rall(a));
	if(a[m-1]*4*m>=sum) cout<<"Yes";
	else cout<<"No"; 
	re 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <stdio.h>
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
 
typedef long long ll;

#define rep(i,n) for(ll i = 0; i < n; i++)
 
using namespace std;
 
const ll INF = ll(1e18)+1;
const double PI=3.14159265358979323846;

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

  string l[100100]={};
  queue<string> q;
  for(int i=1; i<=9; i++){
    q.push(to_string(i));
    l[i] = to_string(i);
  }

  ll p = 10;
  while(true){
    if(p > 100010) break;
    string now = q.front();
    q.pop();
    int b = now[now.size()-1] - '0';
    int r[3] = {-1,0,1};    
    rep(i,3){
      if(b==0 && i==0) continue;
      if(b==9 && i==2) continue;
      string plus = to_string(b+r[i]);
      l[p] = now + plus;
      q.push(l[p]);
      p++;
    }
  }
  cout << l[K] << endl;
}


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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

ll N, T;

int main() {
    cin >> N >> T;
    ll ans = LINF;
    REP(i, N) {
        LCIN(c, t);
        if(t <= T) ans = min(ans, c);
    }
    if(ans == LINF)
        cout << "TLE"
             << "\n";
    else
        cout << ans << "\n";
}


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

using namespace std;

typedef unsigned long long ull;
typedef long double ld;
typedef long long ll;
typedef pair<int,int> pi;

const int MAXN = 1e5 + 1;


int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n,a; cin >> n >>a;
    if((n%500)<=a) cout << "Yes";
    else cout << "No";

}


Measured memory_bytes: 892
#include <iostream>
#include <numeric>
#include <string>

int main()
{
    std::size_t N; std::cin >> N;
    std::string S; std::cin >> S;
    auto r = std::count(S.begin(), S.end(), 'R');
    auto g = std::count(S.begin(), S.end(), 'G');
    auto b = std::count(S.begin(), S.end(), 'B');
    std::size_t ans = r*g*b;
    for (std::size_t i=0; i < N; ++i)
        for (std::size_t d=0; d < N; ++d) {
            auto j = i + d;
            auto k = j + d;
            if (k >= N) break;
            ans -= (S[i] != S[j] and S[j] != S[k] and S[k] != S[i]);
        }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 3204
# -*- coding: utf-8 -*-
"""
C - Slimes
https://atcoder.jp/contests/abc143/tasks/abc143_c

"""
import sys

import re

def solve(s):
    return len(re.sub(r'(.)\1*', r'\1', s))


def main(args):
    _ = input()
    s = input()
    ans = solve(s)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 12788
n, a, b = map(int, input().split())

p = 10 ** 9 + 7
inv = [0] * (b + 1)
inv[1] = 1

for k in range(2, b + 1):
	inv[k] = pow(k, p - 2, p)

com = 1
for i in range(1, a + 1):
	com = (com * (n + 1 - i)) % p * inv[i]

coma = com

for j in range(a + 1, b + 1):
	com = (com * (n + 1 - j)) % p * inv[j]

comb = com

print((pow(2, n, p) - 1 - coma - comb) % p)

Measured memory_bytes: 10932
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll modpow(ll b, ll e, ll m = 9e18){
	ll r=1ll;
	while(e){
		if(e&1) r=(r*b)%m;
		b=(b*b)%m;
		e>>=1;
	}
	return r;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	ll x;cin >> x;
	pair<ll,ll> ans;
	for(int i=-200;i<=200;i++) for(int j=-200;j<=200;j++){
		ll tot = modpow(i,5)-modpow(j,5);
		if(tot == x){
			ans = {i,j};
		}
	}
	cout << ans.first << ' ' << ans.second << '\n';
	return 0;
}


Measured memory_bytes: 3648
import sys
sys.setrecursionlimit(100000)


def dfs(h, w):
    checked[h][w] = 1
    for hi in range(-1, 2):
        for wj in range(-1, 2):
            if 0 <= h+hi <= H-1 and 0 <= w+wj <= W-1:
                if hw[h+hi][w+wj] == 1 and checked[h+hi][w+wj] == -1:
                    dfs(h+hi, w+wj)


while True:
    W, H = list(map(int, input().split()))
    if W == 0 and H == 0:
        break

    hw = []
    for _ in range(H):
        tmp = list(map(int, input().split()))
        hw.append(tmp)

    checked = [[-1] * W for i in range(H)]
    ans = 0
    for w in range(W):
        for h in range(H):
            if hw[h][w] == 1 and checked[h][w] == -1:
                ans += 1
                dfs(h, w)
    print(ans)



Measured memory_bytes: 8024
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC push_options
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include <xmmintrin.h>
#include <immintrin.h>
using namespace::std;
__attribute__((constructor))void init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// typedef mp::number<mp::cpp_dec_float<0>> cdouble;
// typedef mp::cpp_int cint;
template<typename T>using pbds=__gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T>using pbds_map=__gnu_pbds::tree<T,T,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T,typename E>using hash_map=__gnu_pbds::gp_hash_table<T,E>;
template<typename T>using pqueue =__gnu_pbds::priority_queue<T, greater<T>,__gnu_pbds::rc_binomial_heap_tag>;
typedef long long lint;
#define INF (1LL<<60)
#define IINF (1<<30)
#define EPS (1e-10)
//#define MOD 1000000007LL
#define MOD 998244353LL
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
template<typename T>inline void numout(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i<INF/2?i:"INF";f=1;}cout<<endl;}
template<typename T>inline void numout2(T t){for(auto i:t)numout(i);}
template<typename T>inline void output(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}
template<typename T>inline void output2(T t){for(auto i:t)output(i);}
template<typename T>inline void _output(T t){bool f=0;for(lint i=0;i<t.size();i++){cout<<f?"":" "<<t[i];f=1;}cout<<endl;}
template<typename T>inline void _output2(T t){for(lint i=0;i<t.size();i++)output(t[i]);}
#define rep(i,n) for(lint i=0;i<lint(n);++i)
#define repi(i,a,b) for(lint i=lint(a);i<(lint)(b);++i)
#define rrep(i,n) for(lint i=lint(n)-1;i>=0;--i)
#define rrepi(i,a,b) for(lint i=lint(b)-1;i>=lint(a);--i)
#define irep(i) for(lint i=0;;++i)
#define all(n) begin(n),end(n)
#define dist(a,b,c,d) sqrt(pow(a-c,2)+pow(b-d,2))
inline lint gcd(lint A,lint B){return B?gcd(B,A%B):A;}
inline lint lcm(lint A,lint B){return A/gcd(A,B)*B;}
// inline cint cgcd(cint A,cint B){return B?cgcd(B,A%B):A;}
// inline cint clcm(cint A,cint B){return A/cgcd(A,B)*B;}
inline bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;}
inline bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;}
const vector<lint> dx={1,0,-1,0,1,1,-1,-1};
const vector<lint> dy={0,1,0,-1,1,-1,1,-1};
#define SUM(v) accumulate(all(v),0LL)
auto call=[&](auto f,auto... args){return f(f,args...);};

int main(){
    vec a(3);
    rep(i,3)cin>>a[i];
    sort(all(a));
    a.erase(unique(all(a)),a.end());
    if(a.size()==2)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
/*

                            بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ
                          لآ اِلَهَ اِلّا اللّهُ مُحَمَّدٌ رَسُوُل اللّهِ
*/

/*
    Auther:   n0oO0o0Ob(None of them)
    from  :   https://n0oo0o0ob.sleek.page/

*/

#include <bits/stdc++.h>

using namespace std;
#define endl "\n"
#define pb push_back
#define test()     int t; cin >> t; while(t--)
#define point setprecision
                                                        #define noob n0oO0o0Ob
// ---------------------------------
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
//----------------------------------
const ld PI = acos((ld)-1);
const int MOD = 1000000007;
//----------------------------------

int z = 0;
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int t;
    cin >> t;
    while(t--){
        cout << "ACL";
    }
    cout << endl;
	return 0;
}



Measured memory_bytes: 3556
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <map>
#include <time.h>

using namespace std;

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n;
  int h[101];
  cin >> n;
  rep(i, 0, n) cin >> h[i];

  int ans = 0;
  rep(i, 0, 100) {
    int f = 0;
    rep(j, 0, n) {
      if(h[j]) {
        if(!f) f = 1, ans++;
        h[j]--;
      }else {
        if(f) f = 0;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()


int main() {
  int n;
  cin >> n;
  vector<ll> a(3*n);
  rep(i, 3*n) cin >> a[i];
  sort(all(a));
  
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    ans += a[n + 2*i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main(){
  int r,g,b;
  cin >> r >> g >> b;
  if((10*g + b)%4 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
}


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

int main()
{
	int n; cin >> n;
	map<string, int> chk;
	while (n--){
		string s; cin >> s;
		chk[s]++;
	}

	int mx = 0;
	for (auto &p : chk) if (mx < p.second) mx = p.second;
	for (auto &p : chk) if (mx == p.second) puts(p.first.c_str());
	return 0;
}


Measured memory_bytes: 25216
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1e+9
#define MOD 1000000007
using namespace std;


int main(){
    int N,M;
    cin >> N >> M;
    
    int ball[100001]={};
    ball[1]=-1;
    for(int i=2; i<=N; i++){
        ball[i]=1;
    }
    
    for(int i=0; i<M; i++){
        int x,y;
        cin >> x >> y;
        
        if(ball[x]>0){
            ball[x]--;
            if(ball[y]>=0){
                ball[y]++;
            }else{
                ball[y]--;
            }
        }else{
            ball[x]++;
            if(ball[y]>=0){
                ball[y]++;
                ball[y]*=-1;
            }else{
                ball[y]--;
            }
        }
    }
    
    int ans=0;
    for(int i=1; i<=N; i++){
        if(ball[i]<0){
            ans++;
        }
     //   cout<<"ball["<<i<<"]="<<ball[i]<<endl;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
import math
cnt = 0
N = int(input())
for i in range(N):
    n = int(input())
    if n % 2:
        area = round(math.sqrt(n))
        prime_ng = 0
        for i in range(2, area + 1):
            if n % i == 0:
                prime_ng = 1
                break
        if prime_ng == 0:
            cnt += 1
    elif n == 2:
        cnt += 1
print(cnt)

Measured memory_bytes: 7708
#include <iostream>

using namespace std;

int main(){
  int N, Y;
  cin >> N >> Y;
  for (int i = 0; i <= N; ++i){
    for (int j = 0; j <= N-i ; ++ j){
      if (i*10000 + j*5000 + 1000*(N-i-j) == Y){
        cout << i << " " << j << " " << N-i-j << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1";
  return 0;
}
  

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

using namespace std;

const uint64_t MOD = 1e+9 + 7;

class ModuloOps
{
private:
  vector<uint64_t> _fact, _fact_inv;

  void _calc_fact(uint64_t n) {
    for (uint64_t i = 2; i <= n; ++i) {
      _fact[i] = (_fact[i - 1] * i) % MOD;
      _fact_inv[i] = inv(_fact[i]);
    }
  }

public:
  ModuloOps(uint64_t n) {
    _fact = vector<uint64_t>(n + 1);
    _fact_inv = vector<uint64_t>(n + 1);

    _fact[0] = 1;
    _fact[1] = 1;
    _fact_inv[0] = 1;
    _fact_inv[1] = 1;

    _calc_fact(n);
  }

  uint64_t power(uint64_t x, uint64_t y) const {
    if (y <= 1) {
      return (y == 0) ? 1 : (x % MOD);
    }

    uint64_t w = power(x, y >> 1);
    uint64_t z = (w * w) % MOD;

    if (y % 2 == 1) {
      z = (x * z) % MOD;
    }

    return z;
  }

  uint64_t inv(uint64_t n) const { return power(n, MOD - 2); } 

  uint64_t fact(uint64_t n) const { return _fact[n]; }
  uint64_t fact_inv(uint64_t n) const { return _fact_inv[n]; }

  uint64_t perm(uint64_t n, uint64_t k) const {
    return (_fact[n] * _fact_inv[n - k]) % MOD;
  }

  uint64_t comb(uint64_t n, uint64_t k) const {
    return (perm(n, k) * _fact_inv[k]) % MOD;
  }

  uint64_t prem_rep(uint64_t k, uint64_t l) const {
    uint64_t x = _fact[k + l];
    x = (x * _fact_inv[k]) % MOD;
    x = (x * _fact_inv[l]) % MOD;
    return x;
  }

  uint64_t prem_rep(const vector<uint64_t> &a) const {
    uint64_t n = accumulate(a.begin(), a.end(), 0);
    uint64_t x = _fact[n];
    for (uint64_t y : a) {
      x = (x * _fact_inv[y]) % MOD;
    }
    return x;
  }

  uint64_t comb_rep(uint64_t n, uint64_t k) const {
    return comb(n + k - 1, k);
  }
};

int main()
{
  uint64_t N, A, B, C;
  cin >> N >> A >> B >> C;
  
  ModuloOps mod_ops(2 * N + 1);
  
  vector<uint64_t> pow_of_A(2 * N + 1, 0), pow_of_B(2 * N + 1, 0);
  pow_of_A[0] = pow_of_B[0] = 1;
  for (uint64_t i = 1; i <= 2 * N; ++i) {
    pow_of_A[i] = (pow_of_A[i - 1] * A) % MOD;
    pow_of_B[i] = (pow_of_B[i - 1] * B) % MOD;
  }

  uint64_t S = 0;
  for (uint64_t M = N; M <= 2 * N - 1; ++M) {
    uint64_t x = mod_ops.comb(M - 1, N - 1);
    
    uint64_t y1 = (pow_of_A[N] * pow_of_B[M - N]) % MOD;
    uint64_t y2 = (pow_of_B[N] * pow_of_A[M - N]) % MOD;
    uint64_t ys = (y1 + y2) % MOD;
    uint64_t y  = (ys * M)  % MOD;
    
    uint64_t p = (x * y) % MOD;
    p = (p * 100) % MOD;
    
    uint64_t q1 = mod_ops.power(A + B, M);
    uint64_t q2 = 100 - C;
    uint64_t q  = (q1 * q2) % MOD;
    uint64_t q_inv = mod_ops.inv(q);
    
    uint64_t s = (p * q_inv) % MOD;
    S = (S + s) % MOD;
  }
  cout << S << endl;
  
  return 0;
}

Measured memory_bytes: 6528
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
int main(int argc, char **argv)
{
  char T[1001];
  char P[1001];
  int i, j, cnt, len;
  scanf("%s", T); 
  scanf("%s", P); 
   
  len = strlen(P);
  for (i = 0; T[i] != '\0'; i++) {
    if (T[i] == P[0]) {
      cnt = 1;
      for (j = 1; (T[i + j] == P[j]) && (P[j] != '\0'); j++) {
        cnt++;
      }   
      if (cnt == len) {
        printf("%d\n", i); 
      }   
    }   
  }
  return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE 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 FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  vll a(3);
  ll sum = 0;
  REP(i, 3){
    cin >> a[i];
    sum += a[i];
  }

  if(sum >= 22)
    cout << "bust" << endl;
  else
    cout << "win" << endl;


}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		for(int i = 0;;i++) {
			int c = (int)(i * 0.08);
			int d = (int)(i * 0.10);
			if(c > a || d > b) {
				System.out.println(-1);
				System.exit(0);
			}
			if(c == a && d == b){
				System.out.println(i);
				break;
			}
		}
		sc.close();
	}
}


Measured memory_bytes: 23764
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;
using static ConsoleApplication.Utils;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var nt = ReadInts();
            var a = ReadInts();
            var lst = new List<int>();
            var min = int.MaxValue;
            foreach (var i in a)
            {
                if (min > i) min = i;
                lst.Add(i - min);
            }
            var res = lst.GroupBy(i => i).OrderByDescending(g => g.Key).First().Count();
            WriteLine(res);
        }
    }

    public static class Utils
    {
        #region Extensions for IO

        public static long ReadLong()
            => ReadLine().ToLong();
        public static int ReadInt()
            => ReadLine().ToInt();

        public static IEnumerable<int> ReadInts()
            => ReadStrings().Select(int.Parse);

        public static IEnumerable<string> ReadStrings()
            => ReadLine().Split(' ');

        public static IEnumerable<string> ReadLines(int n)
        {
            foreach (var i in Enumerable.Range(0, n))
            {
                yield return ReadLine();
            }
        }

        #endregion

        #region Extensions of int

        public static bool IsOdd(this int n)
            => !n.IsEven();

        public static bool IsEven(this int n)
            => n % 2 == 0;

        public static bool CanDivideWith(this int n, int divisor)
            => n % divisor == 0;

        #endregion

        #region Extensions of string

        public static int ToInt(this string str)
            => int.Parse(str);

        public static long ToLong(this string str)
            => long.Parse(str);

        public static double ToDouble(this string str)
            => double.Parse(str);

        public static bool IsNullOrEmpty(this string str)
            => string.IsNullOrEmpty(str);

        #endregion

        public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
        {
            foreach (var item in source)
            {
                action(item);
            }
        }

        public static IEnumerable<T> Peek<T>(this IEnumerable<T> source, Action<T> action)
        {
            foreach (var item in source)
            {
                action(item);
            }
            return source;
        }
    }
}


Measured memory_bytes: 26108
#include <iostream>
using namespace std;
char chess(int h,int w){
    if((h+w)%2==0){
        return '#';
    }
    return '.';
}
int main(void){
    int H,W;
    while(true){
        cin >> H >> W;
        if(H==0 && W==0){
            break;
        }
        for(int i=0; i<H;i++){
            for(int j=0;j<W;j++){
                cout << chess(i,j);
            }
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3068
#include <stdio.h>
int n, k;
long double r[20];
long double ans;
int g, f;
int main() {
	scanf("%d%d", &n, &k);
	r[0] = 1;
	for (int i = 1; i < 20; i++) {
		r[i] = r[i-1] / 2;
	}
	for (int i = 1; i <= n; i++) {
		g = 0;
		f = i;
		while (f<k) {
			f *= 2;
			g++;
		}
		ans += r[g] / n;
	}
	printf("%.16llf\n", ans);
}

Measured memory_bytes: 128
s = input()

n = len(s) - 1

c_list = [list(map(int,format(i,"b").zfill(n))) for i in range(2**n)]

ans = 0

for i in c_list:
    start = 0
    goal = 0
    for j, v in enumerate(i):
        if v == 1:
            goal = j + 1
            ans += int(s[start:goal])
            start = j +1
    else:
        ans += int(s[start:])

print(ans)

Measured memory_bytes: 3064
A, B = map(int, input().split())
S = input()
for i in range(A+B+1):
  if i == A:
    if S[i] != '-':
      print('No')
      exit()
  else:
    if S[i] < '0' or S[i] > '9':
      print('No')
      exit()
print('Yes')      


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s, t;
	while(cin>>s>>t, s!="."){
		if (s==t){
			cout << "IDENTICAL\n";
			continue;
		}
		bool isstr=false, cond;
		ll diff=0;
		ll spos=0, tpos=0;
		ll lsp = 0, ltp = 0;
		while(true){
			spos = s.find("\"", lsp);
			tpos = t.find("\"", ltp);
			if (spos==string::npos || tpos==string::npos){
				cond = s.substr(lsp) == t.substr(ltp);
			}else{
				cond = s.substr(lsp, spos-lsp) == t.substr(ltp, tpos-ltp);
			}
			if (!cond) (isstr) ? diff++ : diff+=2;
			if (spos==string::npos || tpos==string::npos) break;
			if (diff >= 2) break;
			isstr = !isstr;
			lsp = spos+1;
			ltp = tpos+1;
		}
		if (diff >= 2){
			cout << "DIFFERENT\n";
		}else{
			cout << "CLOSE\n";
		}
	}
	return 0;
}


Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define mp make_pair
signed main(){
  int N; cin>>N;
  vector<vector<pii>> A(N);
  rep(i,0,N-1){
    int X,Y; cin>>X>>Y;
    A[X-1].push_back(mp(Y-1,i));
    A[Y-1].push_back(mp(X-1,i));
  }
  vi ans(N-1,-1);
  queue<pii> Q;
  int Max=0;
  rep(i,0,N) Max=max(Max,(int)A[i].size());
  cout<<Max<<endl;
  Q.push(mp(0,MOD));
  while(Q.size()>0){
    int X=Q.front().first,Y=Q.front().second;
    Q.pop();
    int memo=1;
    rep(i,0,A[X].size()){
      int O=A[X][i].first,P=A[X][i].second;
      if(memo==Y)
        memo++;
      if(ans[P]==-1){
        ans[P]=memo;
        Q.push(mp(O,memo));
      }
      else
        memo--;
      memo++;
    }
  }
  rep(i,0,N-1) cout<<ans[i]<<endl;
  }



Measured memory_bytes: 8960
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class Program
{
    static void Main()
    {
        var N = int.Parse(ReadLine());
        var A = ReadLine().Split().Select(int.Parse).ToArray();
        var segtree = new SegmentTree<int>(A, 0, GCD);
        var ans = 0;
        for (int i = 0; i < N; i++)
        {
            ans = Max(ans, GCD(segtree.Query(0, i), segtree.Query(i + 1, N)));
        }
        WriteLine(ans);
    }

    static int GCD(int a, int b)
    {
        while (b != 0)
        {
            var c = a;
            a = b;
            b = c % b;
        }
        return a;
    }
}

public class SegmentTree<T>//Tがstring以外の参照型だとEの扱いが･･･単位元に対する書き換えは起こらない保証ある･･･？
{
    T[] buffer;
    int N;
    T IE;
    Func<T, T, T> Op;//デリゲート遅そう　

    public SegmentTree(int cap, T E, Func<T, T, T> op)//モノイドが直接渡せれば　C#9.0ではいるか
    {
        var c = 1;
        //while (c < cap) c <<= 1;　　　　//これなくても通るマジ？　//マジか･･･
        N = c;
        buffer = new T[N * 2 - 1];
        //Array.Fill(buffer, E);// NETCOREAPP Only
        for (int i = 0; i < buffer.Length; i++) buffer[i] = E;
        Op = op;
        IE = E;
    }

    public SegmentTree(T[] init, T E, Func<T, T, T> op)
    {
        var c = 1;
        while (c < init.Length) c <<= 1;
        N = c;
        buffer = new T[N * 2 - 1];
        Array.Copy(init, 0, buffer, N - 1, init.Length);
        //Array.Fill(buffer, E, init.Length + N - 1, buffer.Length - init.Length - N + 1);// NETCOREAPP Only
        for (int i = init.Length + N - 1; i < buffer.Length; i++) buffer[i] = E;
        for (int i = N - 2; i >= 0; i--)
        {
            buffer[i] = op(buffer[i * 2 + 1], buffer[i * 2 + 2]);
        }
        Op = op;
        IE = E;
    }

    public void Update(int index, T value)//[0, N)アクセス可
    {
        index += N - 1;
        buffer[index] = value;
        while (index > 0)
        {
            index = (index - 1) / 2;
            buffer[index] = Op(buffer[index * 2 + 1], buffer[index * 2 + 2]);
        }
    }

    public T this[int index]
    {
        set//setの式形式はC#7.0以降
        {
            Update(index, value);
        }
        get
        {
            return buffer[index + N - 1];
        }
    }

    public T Query(int l, int r)
    {
        var lv = IE;
        var rv = IE;
        l += N - 1;
        r += N - 1;
        while (l < r)
        {
            if ((l & 1) == 0)
            {
                lv = Op(lv, buffer[l]);
            }
            if ((r & 1) == 0)
            {
                rv = Op(buffer[r - 1], rv);
            }
            l /= 2;
            r = (r - 1) / 2;
        }
        return Op(lv, rv);
    }
}


Measured memory_bytes: 27228
#include<bits/stdc++.h>
#define f() for(int i=0;i<n;i++)
using namespace std;
string c;
char t;
int main()
{
  cin>>c;
  c[12]=c[11];
  c[11]=c[10];
  c[10]=c[9];
  c[9]=c[8];
  c[8]=c[7];
  c[7]=c[6];
  c[6]=c[5];
  c[5]=c[4];
  c[4]=' ';
  for(int i=0; i<13; i++)cout<<c[i];
cout<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;
 
 
 
int main() {
    int n;
    scanf("%d",&n);
    int k;
    scanf("%d",&k);

    ll a[n] = {};

    rep(i,n){
        ll aa;
        scanf("%lld",&aa);
        a[i] = aa;
    }

    sort(a, a+n); // 配列のソート

    ll ans = 99999999999;
    ll min = 99999999999;

    srep(i, k-1, n){
        if(a[i] - a[i - k + 1] < min){
            min = a[i] - a[i - k + 1];
        }
    }

    ans = min;


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

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define repi(i,x,n) for(int i = x; i < n; i++)
#define rep(i,n) repi(i,0,n)
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;

#define int long long

#define MAX 5100

#define x first
#define a second

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, L;
    vector<pair<int,int>> t, z;
    static int dp[MAX][MAX];
    // vector<vector<int>> dp;
    int ans = 0;

    cin>>N>>L;
    
    t.resize(N+10);
    //dp.resize(N+5,vector<int>(L+5,0));
    
    for(int i = 0; i < N; i++){
        cin>>t[i].x;
    }
     for(int i = 0; i < N; i++){
        cin>>t[i].a;
    }

     for(int i = N-1; i >= 0; i--){
         z.push_back(t[i]);
     }

     for(int i = z[0].x; i < L; i += z[0].a){
         dp[0][i] = 1;
         // cout<<0<<" "<<i<<" "<<dp[0][i]<<endl;
         if(z[0].a == 0) break;
     }
     
     for(int i = 1; i < N; i++){
         for(int j = L-i, sum = 0; j >= z[i].x; j--){
             if(z[i].a == 0){
                 if(z[i].x == j){
                     dp[i][j] = sum%MOD;
                 }
             } else if((j-z[i].x)%z[i].a == 0){
                 dp[i][j] = sum%MOD;
                 //cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
             }
             sum += dp[i-1][j];
             sum %= MOD;
         }
     }

     for(int i = 0; i < L; i++){
         ans += dp[N-1][i];
         ans %= MOD;
     }

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



Measured memory_bytes: 62204
#include<cstdio>
#include<algorithm>
using namespace std;
long long a,b,c,d;
int n;
int main()
{
	scanf("%d",&n);
	n--;
	scanf("%lld%lld",&a,&b);
	while(n--)
	{
		scanf("%lld%lld",&c,&d);
		long long t1=a/c;
		if(t1*c!=a) t1++;
		long long t2=b/d;
		if(t2*d!=b) t2++;
		long long t=max(t1,t2);
		a=c*t;
		b=d*t;
	}
	printf("%lld",a+b);
}

Measured memory_bytes: 128
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
local function array(dimension, default_val) local n=dimension local m={}if default_val~=nil then m[1]={__index=function()return default_val end}end for i=2,n do m[i]={__index=function(p, k)local c=setmetatable({},m[i-1])rawset(p,k,c)return c end}end return setmetatable({},m[n])end
----
local floor = math.floor
local MOD = floor(10^9)+7


-- returns (b^n) % m
local function modpow(b, n, m)
    if n == 0 then
        return 1
    elseif n % 2 == 0 then
        -- be careful about overflow of b*b
        return modpow(b * b % m, n//2, m)
    else
        return b * modpow(b, n - 1, m) % m
    end
end

-- returns n! % m
local function modfactorial(n, m)
    local a = 1
    for i=1, n do
        a = a * i % m
    end
    return a
end

local function make_mod_nCr(nmax, m)
    -- Create n! table
    local mfac = {}
    mfac[0] = 1
    for i=1,nmax do
        mfac[i] = mfac[i-1] * i % m
    end
    -- Create (n!)^(-1) table
    -- (n!)^(-1) ≡ (n!)^(m - 2)  <mod m>
    local invmfac = {}
    invmfac[nmax] = modpow(mfac[nmax], m - 2, m)
    for i=nmax,1,-1 do
        -- ((a-1)!)^(-1) ≡ a * (a!)^(-1)  <mod m>
        invmfac[i-1] = i * invmfac[i] % m
    end
    -- returns nCr % m
    local function mod_nCr(n, r)
        -- nCr ≡ n! * (r!)^(-1) * ((n-r)!)^(-1)  <mod m>
        local a = mfac[n] * invmfac[r] % m
        a = a * invmfac[n-r] % m
        return a
    end
    return mod_nCr
end

-- larger n and small r
local function make_mod_nCr_2(rmax, m)
    -- Create n! table
    local mfac = {}
    mfac[0] = 1
    for i=1,rmax do
        mfac[i] = mfac[i-1] * i % m
    end
    -- Create (n!)^(-1) table
    -- (n!)^(-1) ≡ (n!)^(m - 2)  <mod m>
    local invmfac = {}
    invmfac[rmax] = modpow(mfac[rmax], m - 2, m)
    for i=rmax,1,-1 do
        -- ((a-1)!)^(-1) ≡ a * (a!)^(-1)  <mod m>
        invmfac[i-1] = i * invmfac[i] % m
    end
    -- partial factory ()
    local pmfac
    -- returns nCr % m
    local function mod_nCr(n, r)
        if r > n then
            return 0
        end
        if r > n/2 then
            r = n - r
        end
        -- nCr ≡ (n * (n - 1) * ... * (n-r+1)) * (r!)^(-1)  <mod m>
        local a = 1
        for i=n, n-r+1, -1 do
            a = (a * i) % m
        end
        a = a * invmfac[r] % m
        return a
    end
    return mod_nCr
end


----
local n, k = read.nn()

local nCr = make_mod_nCr(n, MOD)

local ans = 0
for i=0,math.min(n-1,k) do
    local empty_room_pattern = nCr(n, i)
    local nonempty_room_pattern = nCr(n-1, i)
    ans = (ans + (empty_room_pattern * nonempty_room_pattern % MOD)) % MOD
end

print(ans)

Measured memory_bytes: 12648
#include<iostream>
#include<fstream>
using namespace std;
int main(){
	string s, t;
    //first problem--> works
    cin>> s;
    t = "";
	for (int i = 0; i< s.length(); i++){
        int h = s[i];
        if (h!='B'){
            t+= h;
        }
        else{
            if (t == ""){
                continue;
            }
            else{
                string temp = t;
                t = "";
                for (int j = 0; j< temp.length()-1; j++){
                   t+=temp[j];
               }
            }
        }
    }
    cout<< t;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n, x;
	int i, j, k;
	int test;

	while (1) {
		scanf("%d %d", &n, &x);

		test = 0;

		if (n == 0 && x == 0)
			break;

		for(i = 1; i <= n - 2; i++)
			for(j = i + 1; j <= n - 1; j++)
				for (k = j + 1; k <= n; k++){
					if (i + j + k == x)
						test++;
				}

		printf("%d\n", test);
	}

	return 0;
}

Measured memory_bytes: 600
#include<iostream>

using namespace std;

int main(){
    int N;
    char str;
    int r = 0,b = 0;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> str;
        if(str == 'R') r++;
        else b++;
    }
    if(r > b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	private static int n;

	public static void main(String[] args) {

		List<Integer> list = new ArrayList<>();
		int[][] arr = scan();
		int candies = 0;

		int f = 0;
		for (int i = 0; i < n; i++) {
			f += arr[0][i];
			for (int j = i; j < n; j++) {
				candies += arr[1][j];
			}
			list.add(f + candies);
			candies = 0;
		}

		System.out.println(list.stream().sorted((v1, v2) -> v2 - v1).findFirst().get());
	}

	private static int[][] scan() {

		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[][] arr = new int[2][n];
		for (int i = 0; i < 2; i++) {
			for (int j = 0; j < n; j++) {
				arr[i][j] = sc.nextInt();
			}
		}
		sc.close();
		return arr;
	}
}

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

int main()
{
    int n, x; cin>>n>>x;
    int res=n, minm=INT_MAX;
    for(int i=0; i<n; ++i) {
        int m; cin>>m;
        minm=min(minm, m);
        x-=m;
    }
    res+=x/minm;
    cout<<res<<endl;
}


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

#define lpsbd(i, s, b, d) for(size_t i = (s); i < (b); i+=(d))
#define lpsb(i, s, b) for(size_t i = (s); i < (b); i++)
#define lpn(i, n) for(size_t i = 0; i < (n); i++)
#define fa(i, x) for(auto &i: x)
#define vcd(t, n, d) vector<t>(n, d)
#define vc(t, n) vector<t>(n)
#define all(x) (x).begin(), (x).end()

using namespace std;

int main(void)
{
    int N, K;
    cin >> N >> K;
    auto h = vc(int, N);
    fa(i, h) cin >> i;
    sort(all(h));
    int ans = 1000000000;
    lpsb(i, K - 1, N) ans = min(ans, h[i] - h[i-K+1]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
{-
ITP1_4-C
Computation - Simple Calculator
Time Limit : 1 sec, Memory Limit : 65536 KB
?¨???????

???????????´??° a, b ??¨?????????????????? op ?????????????????§???a op b ????¨??????????????????°?????????????????????????????????????????????????????? op ??????"+"(???)???"-"(???)???"*"(???)???"/"(???)???????????¨?????????????????§????????????????????´??????????°???°?????\??????????????¨????????????????¨????????????¨????????????
Input

??\???????????°????????????????????????????§???????????????????????????????????????????????????¢????????\????????¨????????§??????

a op b

op ??? '?' ?????¨??? ??\?????????????????????????????????????????±???????????????????????£????????????????????????
Output

?????????????????????????????????????¨??????????????????????????????????????????????
Constraints

    0 ??? a, b ??? 20000
    0 ?????????????????????????????????????????¨?????????????????????

Sample Input

1 + 2
56 - 18
13 * 2
100 / 10
27 + 81
0 ? 0

Sample Output

3
38
26
10
108
-}
 
import Data.List.Split
import Text.Regex
import Text.Regex.Posix
main = do
  s <- getLine
  let ans = aux s
  if ans == "" then return ()
  else do
    putStrLn $ (aux s)
    main
  
aux :: String -> String
aux s = ans
  where
    f = splitOn " " s
    a = read (f!!0) :: Int
    op= f!!1
    b = read (f!!2) :: Int
    ans = 
      case op of
        "?" ->  ""
        "+" -> show $ a + b
        "-" -> show $ a - b
        "*" -> show $ a * b
        "/" -> show $ a `div` b

Measured memory_bytes: 4124
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int N, M, X;
int a[13][13], c[13];

int main() {
  INCANT;
  cin >> N >> M >> X;
  int cost=INF;
  rep(i, N) {
    cin >> c[i];
    rep(j, M) cin >> a[i][j];
  }
  rep(i, 1<<N) {
    int tmp=0;
    int L[M];
    fill(L, L+M, 0);
    rep(j, N) {
      int mask = 1<<j;
      if (mask&i) continue;
      tmp+=c[j];
      rep(k, M) L[k]+=a[j][k];
    }
    bool ok = true;
    rep(j, M) {
      if (L[j]<X) ok = false;
    }
    if (ok) cost=min(cost, tmp);
  }
  if (cost==INF) cout << -1 << endl;
  else cout << cost << "\n";
  return 0;
}

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

#define bolt ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef long double ld;

const ld pi=3.1415926535897932384626433;
const int mod = 1000000007;
const ll inf=3e18;

int main ()
{
   bolt;
   string s;
   cin>>s;
   if (s=="ARC")
      cout<<"ABC";
   else
      cout<<"ARC";
}


Measured memory_bytes: 3652