akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
#define MOD (1000000007)
#define MODLL (1000000007ll)
typedef pair<ll, int> PLI;

vector<PLI> g[123456];
ll tkhs[123456],aoki[123456],stot[123456],ttos[123456];


priority_queue< PLI, vector<PLI>, greater<PLI> > pq;

int main(void){
	int n,m,s,t,u,v,i,j,now,next;
	ll d,dist,edge,ans;
	PLI tmp;
	fill(tkhs,tkhs+123456,INFLL);
	fill(aoki,aoki+123456,INFLL);
	fill(stot,stot+123456,0ll);
	fill(ttos,ttos+123456,0ll);
	cin >> n >> m;
	cin >> s >> t;
	s--;
	t--;
	tkhs[s] = 0ll;
	aoki[t] = 0ll;
	stot[s] = 1ll;
	ttos[t] = 1ll;
	for(i=0; i<m; i++){
		cin >> u >> v >> d;
		u--;
		v--;
		g[u].push_back(PLI(d,v));
		g[v].push_back(PLI(d,u));
	}
	pq.push(PLI(tkhs[s],s));
	while(!pq.empty()){
		tmp = pq.top();
		pq.pop();
		now = tmp.second;
		dist = tmp.first;
		for(i=(g[now].size()-1); i>=0; i--){
			next = g[now][i].second;
			edge = g[now][i].first;
			if(tkhs[next] >  dist + edge ){
				tkhs[next] = dist + edge;
				pq.push(PLI(tkhs[next],next));
			}
		}
	}
	for(i=0; i<n; i++){
		pq.push(PLI(tkhs[i],i));
	}
	while(!pq.empty()){
		tmp = pq.top();
		pq.pop();
		now = tmp.second;
		dist = tmp.first;
		for(i=(g[now].size()-1); i>=0; i--){
			next = g[now][i].second;
			edge = g[now][i].first;
			if(tkhs[next] == dist + edge){
				stot[next] += stot[now];
				stot[next] %= MOD;
			}
		}
	}
	pq.push(PLI(aoki[t],t));
	while(!pq.empty()){
		tmp = pq.top();
		pq.pop();
		now = tmp.second;
		dist = tmp.first;
		for(i=(g[now].size()-1); i>=0; i--){
			next = g[now][i].second;
			edge = g[now][i].first;
			if(aoki[next] >  dist + edge ){
				aoki[next] = dist + edge;
				pq.push(PLI(aoki[next],next));
			}
		}
	}
	for(i=0; i<n; i++){
		pq.push(PLI(aoki[i],i));
	}
	while(!pq.empty()){
		tmp = pq.top();
		pq.pop();
		now = tmp.second;
		dist = tmp.first;
		for(i=(g[now].size()-1); i>=0; i--){
			next = g[now][i].second;
			edge = g[now][i].first;
			if(aoki[next] == dist + edge){
				ttos[next] += ttos[now];
				ttos[next] %= MODLL;
			}
		}
	}
	ans = stot[t] * ttos[s];
	ans %= MOD;
	for(i=0; i<n; i++){
		if((tkhs[i] == aoki[i]) && ((tkhs[i] + aoki[i]) == tkhs[t])){
			dist = (stot[i] * ttos[i]) % MOD;
			dist *= dist;
			dist %= MODLL;
			ans -= dist;
			ans += MODLL;
			ans %= MODLL;
		}
		for(j=(g[i].size()-1); j>=0; j--){
			next = g[i][j].second;
			edge = g[i][j].first;
			if(tkhs[i] + edge + aoki[next] != tkhs[t]){
				continue;
			}
			if(tkhs[i] < aoki[i] && aoki[next] < tkhs[next]){
				dist = (stot[i] * ttos[next]) % MOD;
				dist *= dist;
				dist %= MODLL;
				ans -= dist;
				ans += MODLL;
				ans %= MODLL;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 19576
def tobin(n):
    return bin(n)[2:][::-1]

def occur(n, i):
    if i >= len(n):
        return 0
    if n[i] == '1':
        if i == 0:
            o = 1
        else:
            o = int(n[:i][::-1], 2) + 1
    else:
        o = 0
    if i < len(n) - 1:
        o += int(n[i+1:][::-1], 2) * (2 ** i)
    return o

A, B = map(int, input().split())
A, B = tobin(A-1 if A > 0 else 0), tobin(B)
F = ""

for i in range(len(B)):
    F += str((occur(B, i) - occur(A, i)) % 2)

print(int(F[::-1], 2))

Measured memory_bytes: 3064
X,Y=input().split()
L=[0,1,2,3,4,5,6,7,8,9,"A","B","C","D","E","F"]
if L.index(X)>L.index(Y):
  print(">")
elif L.index(X)<L.index(Y):
  print("<")
else:
  print("=")

Measured memory_bytes: 8936
#include <cstdio>
#include <memory.h>
#include <cstring>
#include <vector>
#include <deque>
#include <cstdlib>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <functional>
#include <iostream>
#include <set>
#include <list>
#include <map>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef unsigned long long llu;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;
const ll MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;

priority_queue<int, vector<int>, greater<int> > pq;
vector<int> v;

int a[200000], b[200000];

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

	// b가 엄격히 더 큰것의 개수.
	// 같은 건 또 어떻게 하지?
	//

	int cnt = 0, cc, miv = 1e9 + 7;
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d %d", &a[i], &b[i]);
		sum += b[i];

		if (b[i] > a[i]) cnt++;
		else if (b[i] < a[i]) {
			cc = b[i];
			miv = min(miv, b[i]);
		}
	}

	if (cnt == 0) return !printf("0");
	else if (cnt == n - 1) return !printf("%lld", sum - cc);
	else return !printf("%lld", sum - miv);
}

Measured memory_bytes: 384
#include <iostream>

int main() {
	int h, n;
	std::cin >> h >> n;

	int s = 0;
	for (int i = 0; i < n; ++i) {
		int a;
		std::cin >> a;

		s += a;
	}

	std::cout << (s >= h ? "Yes" : "No") << std::endl;
}

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

#define int           long long
#define S             second
#define F             first
#define pb            push_back
#define all(c)        (c).begin(),(c).end()
#define rall(c)       (c).rbegin(),(c).rend() 
#define lb            lower_bound
#define si(c)         (int)((c).size())
#define lcm(a, b)      (a * (b / __gcd(a,b)))  
#define inf           (long long)(1e15)
//#define endl          '\n'
#define mp            make_pair
#define time(s)       (double(clock()-s)/double(CLOCKS_PER_SEC))
#define debug(args...)    _F(#args, args)
#define vi            std::vector<int>
#define pii           pair<int, int> 
#define vpi           vector<pii>

clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T> void _F(const char *name, T arg1){
    cerr << name << " = " << arg1 << endl;
}template<typename T, typename... Args> void _F(const char *names, T arg1, Args... args){
    const char *name = strchr(names, ',');
    cerr.write(names, name-names) << " = " << arg1 << endl;
    _F(name+2, args...);
}
template<typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2> &q){
    in >> q.F >> q.S; return in;
}template<typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2> &q){
    out << q.F << " " << q.S; return out;
}template< typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2){
    return {p1.F+p2.F, p1.S+p2.S};
}template< typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2){
    return {p1.F-p2.F, p1.S-p2.S};
}

void solve(){
    int n;
    cin >> n;
    while(n){
        if(n%10 == 7){
            cout << "Yes" << endl;return;
        }
        n /= 10;
    }
    cout << "No" << endl;
}

signed main(){

    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);   

    int t = 1;
    start = clock(); 

    cout << fixed << setprecision(12);

    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin); 
    // freopen("output.txt", "w", stdout);
    // freopen("error.txt", "w", stderr);
    // #endif

    //cin >> t;

    for(int i = 1; i <= t; ++i){
        //cout << "Case #" << i << ": ";
        solve();
        //cout << endl;
    }
    //cerr << time(start);
    return 0;
}

Measured memory_bytes: 3604
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int check(int n) {
  int tmp = sqrt(n);
  while (tmp > 0) {
    if (n == tmp * tmp) {
      return 1;
    }
    tmp--;
  }
  return 0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, d;  cin >> n >> d;
    int cnt = 0;
    int x[n][d];
    rep(i, n) {
      rep(j, d) {
        cin >> x[i][j];
      }
    }
    rep(i, n) {
      FOR(j, i + 1, n) {
        int sum = 0;
        rep(k, d) {
          sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
        }
        if (check(sum)) {
          cnt++;
        }
      }
    }
    cout << cnt << '\n';

    return 0;
}


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

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

const int N = 81;
int t, h, w;
int grid[N][N];
const int mxN = 12721; // 80 * 159
bool dp[N][N][mxN];

inline void SET(int i, int j, int k, int v) {
  dp[i][j][abs(k - v)] = true;
  if (k + v < mxN)
    dp[i][j][k + v] = true;
}

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

  cin >> h >> w;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      cin >> grid[i][j];
    }
  }
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      cin >> t;
      grid[i][j] = abs(grid[i][j] - t);
    }
  }

  dp[0][0][grid[0][0]] = true;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      int v = grid[i][j];
      for (int k = 0; k < mxN; ++k) {
        if (i > 0 && dp[i - 1][j][k]) {
          SET(i, j, k, v);
        }
        if (j > 0 && dp[i][j - 1][k]) {
          SET(i, j, k, v);
        }
      }
    }
  }

  for (int i = 0; i < N; ++i) {
    if (dp[h - 1][w - 1][i]) {
      cout << i << endl;
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 79872
MOD = 10**9 + 7
N, K = map(int, input().split())
ans = 0
for i in range(K, N+1):
    ans = (ans +(2*N+1-i)*i//2 - (i-1)*i//2 + 1) %MOD
ans += 1
print(ans%MOD)


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

using ll = long long;

int main() {
  int n, m;
  cin >> n >> m;
  
  ll a;
  priority_queue<ll> pq;
  for(int i = 0; i < n; i++){
    cin >> a;
    pq.push(a);
  }
  
  for(int i = 0; i < m; i++){
    a = pq.top();
    pq.pop();
    pq.push(a / 2);
  }
  
  ll ans = 0;
  while(!(pq.empty())){
    ans += pq.top();
    pq.pop();
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define uint unsigned int
#define llong long long int
#define ullong unsigned long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
const static long long int MOD = 1000000000 + 7;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, a, b;
    cin >> n >> a >> b;
    cout << min(a, b) << " " << max(0, a + b - n) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include <climits>
#include<fstream>
using namespace std;
//---------------------------------------------------
//library zone!!!!!
typedef long long ll;
typedef long double ld;
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ld mod_pow(ld x, ll n, ll p) {
	ld res = 1;
	while (n > 0) {
		if (n & 1) res = res * x;
		x = x * x;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
string s;
string h = "keyence";
bool solve(int k, int e,int t, int r) {
	for (int i = k; i <= e; i++) {
		if (s[i] != h[t + i - k]) return 0;
	}
	return 1;
}
signed main() {
	cin >> s;
	if (solve(s.size() - h.size(), s.size() - 1, 0, h.size() - 1)) {
		cout << "YES\n";
		return 0;
	}
	for (int i = 0; i < h.size(); i++) {
		if (solve(0, i, 0, i)) {
			int r = h.size() - i;
			if (solve(s.size() - r+1, s.size() - 1, i + 1, h.size() - 1)) {
				cout << "YES\n";
				return 0;
			}
		}
	}
	cout << "NO\n";
}

Measured memory_bytes: 256
import std.stdio,std.string,std.conv,std.algorithm;

int main()
{
	int dp[5001];
	foreach(i;0..5001) dp[i] = 1000000;

	int p[6] = [200,300,500,1000,1200,1500];
	int v[6] = [380, 550, 850,1520,1870,2244];

	dp[0] = 0;

	foreach(i;0..6)
	{
		foreach(j;0..5001)
		{
			int x = p[i] + j;
			if(x < 5001)
			{
				dp[x] = min(dp[x],dp[j]+v[i]);
			}
		}
	}

	while(true)
	{
		int n = readln.chomp.to!int;
		if(n == 0) break;

		dp[n].writeln;

	}

	return 0;
}

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

using namespace std;

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

int main() {
    int r, c;
    cin >> r >> c;
    int myTable[r + 1][c + 1] = {};

    REP(i, r) {
        REP(j, c) cin >> myTable[i][j];
    }

    REP(i, r) {
        REP(j, c) {
            myTable[i][c] += myTable[i][j];
            myTable[r][j] += myTable[i][j];
            myTable[r][c] += myTable[i][j];
        }
    }

    REP(i, r+1) {
        REP(j, c+1) {
            if (j) cout << " ";
            cout << myTable[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 3132
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n,m=MI()
    s=input()[::-1]
    now=0
    ans=[]
    while now<n:
        for d in range(m,0,-1):
            if now+d>n:continue
            if s[now+d]=="0":
                now+=d
                ans.append(d)
                break
        else:
            print(-1)
            exit()
    print(*ans[::-1])

main()

Measured memory_bytes: 6408
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

vector<ll> find_divisor(ll n) {
	vector<ll> divisor;
	
	ll i = 1;
	for (; i * i <= n; i++) if (n % i == 0) divisor.push_back(i);
	i--;
	if (i * i == n) i--;
	for (; i >= 1; i--) if (n % i == 0) divisor.push_back(n / i);
	
	return divisor;
}

int main() {
	int N;
	cin >> N;
	
	ll ans = 0;
	
	vector<int> cnt(N + 1);
	FOR(i, 1, N) FOR(j, 1, N) {
		if (i * j > N) break;
		++cnt[i * j];
	}
	
	FOR(c, 1, N) {
		int diff = N - c;
		ans += cnt[diff];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 7136
#include <bits/stdc++.h>
#define long long long
using namespace std;
const int N = 1 << 18;
const long LINF = 1e16;

int n, m;
long ans;
vector<pair<int,int> > lsl[N], lsr[N];
long t[2*N], lz[2*N], dp[N], isect[N];

long f[N];
void update_fen(int i, long v) {
  while(i < N) f[i] += v, i += i & -i;
}

long query_fen(int i) {
  long ret = 0;
  while(i > 0) ret += f[i], i -= i & -i;
  return ret;
}

void apply(int i) {
  if(!lz[i]) return;
  t[i] += lz[i];
  if(i < N) {
    lz[i << 1] += lz[i];
    lz[i << 1 | 1] += lz[i];
  }
  lz[i] = 0;
}

void update(int tl, int tr, long v, int i = 1, int l = 0, int r = N-1) {
  apply(i);
  if(r < tl || l > tr) return;
  if(tl <= l && r <= tr) {
    lz[i] += v;
    apply(i);
    return;
  }
  int mid = l+r >> 1;
  update(tl, tr, v, i << 1, l, mid);
  update(tl, tr, v, i << 1 | 1, mid+1, r);
  t[i] = max(t[i << 1], t[i << 1 | 1]);
}

long query(int tl, int tr, int i = 1, int l = 0, int r = N-1) {
  apply(i);
  if(r < tl || l > tr) return -LINF;
  if(tl <= l && r <= tr) {
    return t[i];
  }
  int mid = l+r >> 1;
  return max(query(tl, tr, i << 1, l, mid), query(tl, tr, i << 1 | 1, mid+1, r));
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for(int i = 0, l, r, a; i < m; i++) {
    cin >> l >> r >> a;
    lsr[r].emplace_back(l, a);
    lsl[l].emplace_back(r, a);
    update_fen(l, a);
    update_fen(r+1, -a);
  }
  for(int i = 1; i <= n; i++) {
    isect[i] = query_fen(i);
    dp[i] = query(0, i-1) + isect[i];
    ans = max(dp[i], ans);
    // cout << query(i, i) << endl;
    update(i, i, dp[i]);
    // cout << "res " << i << ' ' << query(0, i-1) << ' ' << isect[i] << ' ' << dp[i] << ' ' << query(i, i) << endl;
    for(auto p: lsl[i]) {
      int r, a;
      tie(r, a) = p;
      update(i, r, -a);
      // cout << "add " << i << ' ' << r << ' ' << -a << endl;
    }
    for(auto p: lsr[i]) {
      int l, a;
      tie(l, a) = p;
      update(l, i, a);
      // cout << "sub " << l << ' ' << i << ' ' << a << endl;
    }
  }
  cout << ans;
}

Measured memory_bytes: 36864
#! usr/bin/env python
# -*- coding: utf-8 -*-

from collections import deque
import heapq
import math
import bisect


def main():
    cnt = [0, 0, 0, 0]
    for i in range(3):
        a, b = map(int, input().split())
        cnt[a-1] += 1
        cnt[b-1] += 1

    if 3 in cnt:
        print("NO")
    else:
        print("YES")


if __name__ == '__main__':
    main()


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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define ALL(V) (V).begin(),(V).end()

using namespace std;
typedef long long ll;

const double PI = 3.1415926535897932384626;
const ll MODN = 1000000007;
const ll MODN2 = 998244353;
const double EPS = 1e-10;

int main(){

    ll n, m, k;
    cin >> n >> m >> k;

    vector<ll> a(n);
    vector<ll> b(m);

    rep(i, n){
        cin >> a[i];
    }

    rep(i, m){
        cin >> b[i];
    }

    vector<ll> acca(1, 0);
    vector<ll> accb(1, 0);

    rep(i, n){
        acca.push_back(acca[i] + a[i]);
    }

    rep(i, m){
        accb.push_back(accb[i] + b[i]);
    }

    ll ans = 0;

    rep(i, n + 1){
        ll rest = k - acca[i];

        if(rest < 0) break;

        auto itr = lower_bound(ALL(accb), rest + 1);
        ll count = distance(accb.begin(), itr) - 1;

        //cerr << count << endl;
        //cerr << accb[count] << " " << rest << endl;

        if(ans < i + count){
            ans = i + count;
        }
    }

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


Measured memory_bytes: 11100
#include <bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  string s;
  cin >> n >> s;
  for (int i = 0; i < s.size(); ++i)
    if (s[i] + n > 90)
      cout << char(s[i] + n - 26);
    else
      cout << char(s[i] + n);
  cout << '\n';
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
	int sum = 0;
	int n;
	cin >> n;
	REP(i, n) sum += i + 1;
	cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

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

  int cnt = 0;
  rep(i, n){
    int a, b;
    cin >> a >> b;
    if(a == b){
      cnt++;
      if(cnt == 3){
        cout << "Yes" << endl;
        return 0;
      }
    }
    else cnt = 0;
  }

  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3676
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

x = I()
t = 0
for i in range(-1000,1000):
    for j in range(-1000,1000):
        if i**5 -j**5 == x:
            print(i,j)
            t = 1
            break
    if t==1:
        break

Measured memory_bytes: 9212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N;cin>>N;
    if(N%2==1){
        cout<<0<<endl;
    }else{
        ll sum=0;
        while(1){
            sum+=N/10;
            N/=10;
            
            break;
        }
        
        while(N){
            sum+=N/5;
            N/=5;
        }
        
        cout<<sum<<endl;
    }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define all(obj) (obj).begin(), (obj).end()
#define lpair pair<ll, ll>
#define vint vector<ll>
#define vinput(name) for(int i=0; i<(int)(name.size()); i++) cin >> name[i];
#define voutput(name) for(int i=0; i<(int)(name.size()); i++) cout << name[i] << endl;
typedef long long ll;

using namespace std;

ll ans = 0;

int main(void){
	string s; cin >> s;
	rep(i, 3){
		if(s[i] == '7'){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp make_pair
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

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

  const int W = 32;
  const int H = 40;
  vector<string> ans(H+2, string(W*3, '.'));
  rep(i,H+2) rep(j,W*3) if( (i+j/3)%2 == 1) ans[i][j] = '#';
  rep(i,W*3){ans[0][i] = '.'; ans[H+1][i] = '#';}

  int ca = W/2*(H-1)+1, cb = W/2*(H-1)+1;
// dbg(ca,cb);

  int x = 0;
  while(ca > a){
    int i = x/(W/2);
    int j = x%(W/2)*6;
    if(i%2==1) j += 3;
    ans[i+1][j] = '.';
    ca--;
    x++;
  }

  x = 0;
  while(cb > b){
    int i = x/(W/2);
    int j = x%(W/2)*6;
    if(i%2==1) j += 3;
    ans[H-i][j+2] = '#';
    cb--;
    x++;
  }

  cout << H+2 <<" " << W*3 << "\n";
  for(auto &s : ans) cout << s << "\n";

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
char a[1000];
using namespace std;
int main(){
	long long k,i,j,n,p=0;
//	freopen("infinity.in","r",stdin);
//	freopen("infinity.out","w",stdout);
	cin>>a;
	scanf("%lld",&k);
	for(i=0;i<strlen(a);i++)
		if(a[i]!='1'){
			p=1;
			break;
		}
	if(p==0)cout<<"1";
	else {
		for(i=0;i<strlen(a);i++){
			if(a[i]=='1')k--;
			if(a[i]!='1'){
				cout<<a[i];
				break;
			}
			if(a[i]=='1'&&k==0){
				cout<<1;
				break;
			}
		}	
	}
	return 0;
}

Measured memory_bytes: 256
from fractions import Fraction
from math import ceil, floor

# 入力
K = int(input())

# N = 50で決め打ち。操作回数がなるべく均等となるようにaを定める。
N = 50
a = [
    ceil(Fraction(K, N)) * (N + 1) + N - (K + 1)
    for _ in range(K % N)
] + [
    floor(Fraction(K, N)) * (N + 1) + N - (K + 1)
    for _ in range(N - K % N)
]
ans = '{}\n{}'.format(N, ' '.join(map(str, a)))

# 出力
print(ans)


Measured memory_bytes: 5180
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
void fast()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
}
int main()
{
   //fast();
  double r;
    cin>>r;
   cout<<2*3.14*r;
    return 0;
}


Measured memory_bytes: 3780
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

using mint = modint<MOD>;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    string K; cin >> K;
    int D; cin >> D;
    int N = K.size();

    vector<vector<vector<mint>>> dp(N+1, vector<vector<mint>>(2, vector<mint>(D)));

    dp[0][0][0] = 1;
    rep(i,N) {
        rep(j,D) {
            rep(k,10) {
                dp[i+1][1][(j+k)%D] += dp[i][1][j];
                if (k <= K[i] - '0') {
                    if (k == K[i] - '0') {
                        dp[i+1][0][(j+k)%D] += dp[i][0][j];
                    } else dp[i+1][1][(j+k)%D] += dp[i][0][j];
                }
            }
        }
    }

    cout << (dp[N][0][0] + dp[N][1][0] - 1).a << endl;
}

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

using namespace std;

typedef pair<long long,long long> P;

#define INF (1000000000000000LL)
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a>0)?(a):(-(a)))

int danger(P s, P t) {
    return (s.second+t.second)*ABS(s.first-t.first);
}

void solve(int n,int m) {
    vector<P> mp[n];
    vector<int> ki(n,0);

    for(int i=0; i<n; ++i) {
        cin >> ki[i];
        for(int j=0; j<ki[i]; ++j) {
            long long a,b;
            cin >> a >> b;
            mp[i].push_back(P(a,b));
        }
    }

    long long dp[m+1][n][10];
    for(int i=0; i<=m; ++i)
        for(int j=0; j<n; ++j)
            for(int k=0; k<10; ++k)
                dp[i][j][k]=INF;
    
    for(int k=0; k<ki[0]; ++k) dp[0][0][k]=0;
    if(m>0) for(int k=0; k<ki[1]; ++k) dp[1][1][k]=0;

    long long ans=INF;

    for(int i=0; i<=m; ++i) {
        for(int j=0; j<n; ++j) {
            for(int k=0; k<ki[j]; ++k) {
                if(j==n-1 || (j==n-2 && i<m)) ans=MIN(ans,dp[i][j][k]);
                if(j==n-1) continue;
                for(int l=0; l<ki[j+1]; ++l) {
                    dp[i][j+1][l]=MIN(dp[i][j+1][l],dp[i][j][k]+danger(mp[j][k],mp[j+1][l]));
                }
                if(j==n-2 || i==m) continue;
                for(int l=0; l<ki[j+2]; ++l) {
                    dp[i+1][j+2][l]=MIN(dp[i+1][j+2][l],dp[i][j][k]+danger(mp[j][k],mp[j+2][l]));
                }
            }
        }
    }

    cout << ans << endl;

    return;
}


int main() {
    while(true) {
        int n,m;
        cin >> n >> m;
        if(n==0 && m==0) break;
        solve(n,m);
    }
    return 0;
}

Measured memory_bytes: 4020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ll ans=0;
	int n;
	cin>>n;
	vector<int>a,b,c;
	for(int i=0;i<n;i++)
	{
		int x;
		cin>>x;
		a.push_back(x);
	}
	for(int i=0;i<n;i++)
	{
		int x;
		cin>>x;
		b.push_back(x);
	}
	for(int i=0;i<n;i++)
	{
		int x;
		cin>>x;
		c.push_back(x);
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	sort(c.begin(),c.end());
	for(int i=0;i<n;i++)
	{
		int x=lower_bound(a.begin(),a.end(),b[i])-a.begin();
		int y=upper_bound(c.begin(),c.end(),b[i])-c.begin();
		ans+=1LL*x*(n-y);
	}
	cout<<ans;
	return 0;
}

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

char arr[3][3];
int main()
{
   
    for(int i=1;i<=3;i++)
        for(int j=1;j<=3;j++)
            cin>>arr[i][j];
    cout<<arr[1][1]<<arr[2][2]<<arr[3][3];

}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split())) + [0]
rest = 0
ans = 0
for i in range(N):
  a = A[i]
  b = B[i]
  if a > rest:
    ar = a - rest
    ans += rest
  else:
    ar = 0
    ans += a
    
  if b > ar:
    rest = b-ar
    ans += ar
  else:
    rest = 0
    ans += b

if A[-1] > rest:
  temp = rest
else:
  temp = A[-1]

ans += temp

print(ans)

Measured memory_bytes: 18624
#include <cassert>
#define FOR(i, b, e) for (typeof(b) i = (b); assert((i) <= (e)), i != (e); ++i)
#define SZ(a) ((int)a.size())
#define PB(e) push_back(e)
#define RANGE(a, b, c) ((a) <= (b) && (b) <= (c))

#include <iostream>
#include <complex>
#include <vector>

using namespace std;

typedef complex<double> P;
#define EPS (1e-10)
#define EQ(a, b) (abs( (a) - (b) ) < EPS)
#define EQV(a, b) ( EQ( (a).real(), (b).real() ) && EQ( (a).imag(), (b).imag() ) )

// 外積
double cross(P a, P b) {
	return ( a.real() * b.imag() - a.imag() * b.real() );
}

// a1,a2を通る直線とb1,b2を通る直線の交差判定
int is_intersected_l(P a1, P a2, P b1, P b2) {
	return !EQ( cross(a1-a2, b1-b2), 0.0 );
}

// a1,a2を通る直線とb1,b2を通る直線の交点計算
P intersection_l(P a1, P a2, P b1, P b2) {
	P a = a2 - a1; P b = b2 - b1;
	return a1 + a * cross(b, b1-a1) / cross(b, a);
}


#define MAX_N 100
struct line_segment {
	P start;
	P end;
};
line_segment lines[MAX_N];

int main(int argc, char const* argv[])
{
	int n;
	while (cin >> n, n) {
		// input
		FOR(i, 0, n) {
			double x1, y1, x2, y2;
			cin >> x1 >> y1 >> x2 >> y2;
			lines[i].start.real() = x1;
			lines[i].start.imag() = y1;
			lines[i].end.real() = x2;
			lines[i].end.imag() = y2;
		}

		int ans = 1;

		// for each line
		FOR(i, 0, n) {
			vector<P> intersections;
			int area_increment_cnt = 0;

			// draw i-th line
			// check each line before i-th line
			FOR(j, 0, i) {
				P is = lines[i].start, ie = lines[i].end;
				P js = lines[j].start, je = lines[j].end;

				if (!is_intersected_l(is, ie, js, je)) {
					continue; // skip if parallel
				}

				P intersection = intersection_l(is, ie, js, je);

				// skip if (1) out of rectangular (2) on the edge of rectangular
				if (abs( intersection.real() ) > 100.0 - EPS) continue;
				if (abs( intersection.imag() ) > 100.0 - EPS) continue;

				bool duplicate = false;
				FOR(k, 0, intersections.size()) {
					if ( EQV(intersection, intersections[k]) ) {
						duplicate = true;
						break;
					}
				}

				if (!duplicate) {
					++area_increment_cnt;
					intersections.push_back(intersection);
				}
			}
			ans += area_increment_cnt + 1;
		}

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

Measured memory_bytes: 968
sx,sy,tx,ty=[int(i) for i in input().split()]
x=tx-sx
y=ty-sy

procedure=[]
#一回目
for i in range(x):
    procedure.append("R")
for i in range(y):
    procedure.append("U")
for i in range(x):
    procedure.append("L")
for i in range(y):
    procedure.append("D")
    
#2回目
procedure.append("D")
for i in range(x+1):
    procedure.append("R")
for i in range(y+1):
    procedure.append("U")
procedure.append("L")
procedure.append("U")
for i in range(x+1):
    procedure.append("L")
for i in range(y+1):
    procedure.append("D")
procedure.append("R")

print("".join(procedure))

Measured memory_bytes: 40560
import itertools

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

data = []
for i in range(1, N+1):
    data.append(i)

list_data = []
for val in itertools.permutations(data):
    list_data.append(val)

list_data.sort()

a = 0
b = 0
i = 1
for val in list_data:
    if val == P:
        a = i
    if val == Q:
        b = i
    i += 1

if a >= b:
    print(a-b)
else:
    print(b-a)

Measured memory_bytes: 45168
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int maxCount = 0;
		int ans = 0;
		
		for (int i = n; i >= 1; i--) {
			int num = i;
			int cnt = 0;
			
			while(true) {
				if (num % 2 == 0) {
					cnt++;
					num /= 2;
				} else {
					break;
				}
			}
			
			if (cnt >= maxCount) {
				ans = i;
				maxCount = cnt;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
}

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

int main() {
  int N ;
  cin >> N;
  
  vector<int> vec1 ( N) ;
  for (int i = 0; i < N; i++) {
    cin >> vec1.at(i);
  } 
  for (int j = 0; j < N; j++) {
     for (int k = (j+1); k < N; k++) {
          if (vec1.at(j)==vec1.at(k)){
            vec1.at(k) =0;
          }
          }
     }
  int count=0;
      for (int j = 0; j < N; j++) {
        if (vec1.at(j)!=0){
            count ++;
          }
  		}
  cout << count << endl;
}


Measured memory_bytes: 3600
fun main(args: Array<String>) {
    var ABC = readLine()!!.split(" ").map(String::toInt)

    val max = ABC.max()!!
    val sum = ABC.sum()

    val ans = if (sum % 2 == max % 2) {
        max
    } else {
        max + 1
    }

    // 答え*3 から　現在の和を引いて　操作回数（割る２）を導き出す
    ((ans * 3 - sum) / 2).let(::println)

}




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

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

    vector<int> enemy(n);
    for (int i = 0; i < n; i++){
        cin >> enemy.at(i);
    }

    sort(enemy.begin(), enemy.end());

    int64_t count = 0;
    for (int i = 0; i < n - k; i++){
        count += enemy.at(i);
    }

    cout << count << endl;
}

Measured memory_bytes: 1024
const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const inputs = input.trim().split('\n');
const n = Number(inputs[0]);
const adj = inputs.slice(1).map((s) => s.split(' ').map(Number));

class Edge {
  constructor(dest, weight = 1) {
    this.dest = dest;
    this.weight = weight;
  }
}

class GraphList {
  constructor(n) {
    this.n = n;
    this.adj = {};
  }
  fetchGraphMatrix(graphMatrix) {
    graphMatrix.forEach(this.addEdge.bind(this));
  }
  addEdge(source, edge) {
    this.adj[source] = this.adj[source] || [];
    this.adj[source].push(edge);
  }
  forEach(iterator) {
    Object.keys(this.adj).forEach(source => {
      this.adj[source].forEach(edge => iterator(Number(source), edge));
    });
  }
}

class GraphMatrix {
  constructor(n) {
    this.matrix = (new Array(n)).fill(0).map(() => (new Array(n)).fill(0));
  }
  fetchGraphList(graphList) {
    graphList.forEach(this.addEdge.bind(this));
  }
  addEdge(source, edge) {
    this.matrix[source - 1][edge.dest - 1] = edge.weight;
  }
  forEach(iterator) {
    this.matrix.forEach((row, source) => {
      row.forEach((weight, dest) => {
        if (weight) {
          iterator(source + 1, new Edge(dest + 1, weight));
        }
      });
    });
  }
  toString() {
    return this.matrix.map(list => list.join(' ')).join('\n');
  }
}

const graphList = new GraphList(n);
for (let i = 0; i < n; i++) {
  const u = adj[i][0];
  const k = adj[i][1];
  const vj = adj[i].slice(2);
  for (let j = 0; j < k; j++) {
    graphList.addEdge(u, new Edge(vj[j]));
  }
}
const graphMatrix = new GraphMatrix(n);
graphMatrix.fetchGraphList(graphList);
console.log(graphMatrix.toString());



Measured memory_bytes: 16740
#include <stdio.h>
int main(void){
    int i,t,n;
    
    for(i=0;i<4;i++){
         scanf("%d %d",&t,&n);
            if(t==1)printf("%d\n",6000*n);
            else if(t==2)printf("%d\n",4000*n);
            else if(t==3)printf("%d\n",3000*n);
            else if(t==4)printf("%d\n",2000*n);
    }
    return(0);
}



Measured memory_bytes: 2032
N, M = map(int, input().split())
S, C = [], []
for i in range(M):
    s, c = map(int, input().split())
    S.append(s)
    C.append(c)

res = ["?"] * N

for i in range(M):
    if S[i]-1 == 0 and C[i] == 0 and N > 1:
        print(-1)
        exit()
    elif res[S[i]-1] == "?":
        res[S[i]-1] = str(C[i])
    elif res[S[i]-1] != str(C[i]):
        print(-1)
        exit()

if res[0] == "?" and N > 1:
    res[0] = "1"
elif res[0] == "?" and N == 1:
    res[0] = "0"

res = "".join(res)
res = res.replace("?", "0")

print(res)

Measured memory_bytes: 61948
#include <stdio.h>

int main()
{
    int n,red = 0;
    char s[101];
    scanf("%d %s",&n,s);

    for (int i = 0; i < n; i++)
    {
        if(s[i] == 'R')red++;
    }
    printf(red > n - red ? "Yes":"No");
}

Measured memory_bytes: 128
#include <algorithm>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>

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

using namespace std;

typedef long long ll;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << fixed;

  int n;
  cin >> n;

  vector<int> a(n), b(n), c(n);

  rep(i, n) { cin >> a[i]; }
  rep(i, n) { cin >> b[i]; }
  rep(i, n) { cin >> c[i]; }

  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());

  ll ans = 0;

  rep(i, n) {
    // b を固定
    ll cand_a = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
    ll cand_c = c.end() - upper_bound(c.begin(), c.end(), b[i]);
    ans += (cand_a * cand_c);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1408
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
INT_MIN=-10**13
import bisect as B
###############################################################################\
x,k,d=INPUT()
x=abs(x)
if x<0:
    if k*d+x<=0:
        print(k*d+x)
    else:
        p=x//d
        neg=abs(p*d+x)
        pos=abs((p+1)*d)
        if neg<pos:
            if (k-p)%2==0:
                print(neg)
            else:
                print(pos)
        else:
            if (k-p-1)%2==0:
                print(pos)
            else:
                print(neg)
elif x==0:
    if k%2==0:
        print(0)
    else:
        print(d)
else:
    if x-k*d>=0:
        print(x-k*d)
    else:
        p=x//d
        pos=x-p*d
        neg=abs(x-(p+1)*d)
        if pos<neg:
            if (k-p)%2==0:
                print(pos)
            else:
                print(neg)
        else:
            if (k-p-1)%2==0:
                print(neg)
            else:
                print(pos)


Measured memory_bytes: 62540
#include <vector>
#include <stdio.h>
#include <iostream>
#include <algorithm>

using namespace std;

int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
};

int main()
{
    int h,w;scanf("%d%d",&h,&w);
    if (h==1 || w==1){
        printf("1");return 0;
    }

    long long ans=0;
    ans+=1LL*h/2*w;
    if (h%2){
        ans+=w/2+w%2;
    }
    printf("%lld",ans);

}


Measured memory_bytes: 256
w = input()
dic = {}
for c in w:
    if c in dic:
        dic[c] += 1
    else:
        dic[c] = 1

flag = True
for v in dic.values():
    if v % 2 == 1:
        flag = False
        break

if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long ans = b * d;
    ans = max(ans, a * c);
    ans = max(ans, a * d);
    ans = max(ans, b * c);
    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <iomanip>
using namespace std;


void solve(long long A, long long B, long long H, long long M){


    long long min = 60 * H + M;
    double angleA, angleB;
    double Ax, Ay, Bx, By;
    double dist;
    angleA = (2 * M_PI / 720 * min); // ji (tanshin)
    angleB = (2 * M_PI / 60 * M);    // fun (choshin)

    Ax = A * sin(angleA);
    Ay = A * cos(angleA);
    Bx = B * sin(angleB);
    By = B * cos(angleB);

    dist = sqrt((Ax-Bx)*(Ax-Bx) + (Ay-By)*(Ay-By));
    //cout << angleA / M_PI * 180 << endl;
    //cout << angleB / M_PI * 180 << endl;
    //cout << Ax << ", " << Ay << endl;
    //cout << Bx << ", " << By << endl;
    cout << fixed << setprecision(10) << dist << endl;

    return;

}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long H;
    scanf("%lld",&H);
    long long M;
    scanf("%lld",&M);
    solve(A, B, H, M);
    return 0;
}


Measured memory_bytes: 4164
#include<bits/stdc++.h>
using namespace std;
#define debug(n) cerr << #n << ':' << n << endl;

using ll = long long;

int main(){
  ll N; cin >> N;
  ll a = -1, b = -1, c = -1;
  map<ll, ll>mp;
  for(int i = 0; i < N; ++i){
    ll x; cin >> x;
    if(x < 0)continue;
    mp[x]++;
    if(mp[x] > 1)continue;
    if(a == -1)a = x;
    else if(b == -1)b = x;
    else if(c == -1)c = x;
  }
  if(a == 0 || b == 0 || c == 0){
    if(c != -1){
      cout << "No" << endl;
      return 0;
    }
    if(b == 0)swap(a,b);
    if(b == -1 || mp[a] * 2 == mp[b]){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;      
    }
    return 0;
  }
  if(N%3 != 0){
    cout << "No" << endl;
    return 0;
  }
  bool f;
  if(mp.size() != 3){
    debug(mp.size());
    f = false;
  }
  else{
    if(mp[a] != mp[b] || mp[b] != mp[c])
      f = false;    
    else{
      if((a ^ b) != c)
	f = false;
      else f = true;
    }
  }
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

using namespace std;
#define NIL -1
#define ll long long
#define MAX 100
#define pb push_back

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if(a==b&&a==c) {
		if(a%2==0) cout << -1 << endl;
		else cout << 0 << endl;
		return 0;
	}
	int cnt = 0;
	while(a%2==0 && b%2==0 && c%2==0) {
		int t1 = a/2;
		int t2 = b/2;
		int t3 = c/2;
		a = t2 + t3;
		b = t1 + t3;
		c = t1 + t2;
		cnt++;
	}
	cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3580
#include <iostream>

int main()
{
	std::string today;
	std::cin >> today;

	if (today == "Sunny")
	{
		std::cout << "Cloudy" << std::endl;
	}
	else if (today == "Cloudy")
	{
		std::cout << "Rainy" << std::endl;
	}
	else
	{
		std::cout << "Sunny" << std::endl;
	}
}

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

int main(void) {
    int Alice_score = 0;
    int Bob_score = 0;
    bool turn = false; // Alice
    int N = -1;
    cin >> N;
    vector<int> a;
    for (int i=0; i<N; i++) {
        int t;
        cin >> t;
        a.push_back(t); 
    }

    // sort
    for (int i=0; i<N; i++) {
        for (int j=0; j<N-1; j++) {
            int temp;
            if(a[j] < a[j+1]) {
                temp = a[j];
                a[j] = a[j+1];
                a[j+1] = temp;
            }
        }
    }


    for (int i=0; i<N; i++) {
        if(turn == false) { // Alice
            Alice_score += a[i];
        } else {
            Bob_score += a[i];
        }
        turn = (!turn);
    }

    cout << Alice_score - Bob_score << endl;
    

    return 0;
}

Measured memory_bytes: 256
//Catchharsh
#include<bits/stdc++.h>
#define ll long long int 
#define ld long double
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define F first
#define S second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define see(x) cout<<#x<<" = "<<x<<endl
const ll MOD = 1e9+7;
const ll INF = 1011111111;
const ll LLINF = 1000111000111000111LL;
const ld EPS = 1e-10;
const ld PI = 3.14159265358979323;
using namespace std;
ll power (ll base,ll exponent)
{
    ll ans=1;
    //base%=MOD;
    //exponent%=(MOD-1);
    while(exponent!=0)
    {
      if(exponent&1) ans=(1LL*ans*base);
      base=(1LL*base*base);
      exponent>>=1;
    }
    return ans;
}

int32_t main()
{   
     IOS;
     
     ll a,b,i,j,k;
     cin>>a>>b;
     for(ll i=1;i<=100000;i++)
     {
       ll x=(i*8)/100;
       ll y=(i*10)/100;
       if(x==a&&y==b) return cout<<i,0;
     }
     cout<<-1;
     
     cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';             
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
namespace fastio{
	template<typename tn> void read(tn &a){
	    tn x=0,f=1;char c=' ';
	    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	    for(;isdigit(c);c=getchar() ) x=x*10+c-'0';
	    a=x*f;
	}
	template<typename tn> void print(tn a){
	    if(a<0) putchar('-'),a=-a;
	    if(a>9) print(a/10);
	    putchar(a%10+'0');
	}
};
using namespace fastio;
map<int,int> s;
const int N=2e5+5;
int n,a[N];
long long ans;
int main(){
	read(n);
	for(int i=1;i<=n;i++) read(a[i]),s[a[i]+i]++;
	for(int i=1;i<=n;i++) ans+=s[i-a[i]];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 21492
n = int(input())
a = list(map(int,input().split()))
deno = 1
nume = 0.0
         
for i in range(n):
         deno *= a[i]
for j in range(n):
         nume_frac = deno / a[j]
         nume = nume + nume_frac
         
print((deno / nume))

Measured memory_bytes: 9088