akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>

int main() {
  int N, K; std::cin >> N >> K;
  std::vector<int> H(N);
  for (int i = 0; i < N; ++i) std::cin >> H[i];
  std::sort(H.rbegin(), H.rend());

  long long sum = 0;
  for (int i = K; i < N; ++i) {
    long long h = H[i];
    sum += h;
  }
  std::cout << sum << std::endl;
}


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

using namespace std;

int main(void) {
    long long int N;
    long long int acom[5];
    vector<long long int> acom_max(5);
    cin >> N;
    for (int i = 0; i < 5; ++i) {
        cin >> acom[i];
        acom_max[i] = (N % acom[i] == 0) ? N / acom[i] : N / acom[i] + 1;
    }

    cout << *max_element(acom_max.begin(),acom_max.end()) + 4 << endl;

}

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

using namespace std;
typedef long long int ll;
int main()
{
	int n,k;
	cin>>n>>k;
	vector<int> x(n);
	for(int i=0;i<n;i++)
	{
		cin>>x[i];
	}
	    ll ans = 1ll << 60;
    for (int i = 0; i + k - 1 < n; ++i) {
        ll left = x[i], right = x[i + k - 1];
        ans = min(ans, min(abs(left), abs(right)) + right - left);
    }
    cout << ans << endl;
	return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

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

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; }

int main(){
    int A,B,C; cin >> A >> B >> C;
    cout << max(0,C-(A-B)) << en;
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<cstring>
#include<algorithm>

#define Kinds 6
#define DP 55
const int cost[Kinds]={380,550,850,(int)(380*5*0.8),(int)(550*4*0.85),(int)(850*3*0.88)};
const int Volume[Kinds]={200,300,500,1000,1200,1500};

unsigned int dp[DP];

int main(){
	int n;
	
	std::fill(dp,dp+DP,10000000);
	dp[0]=0;
	for(int i=0;i<DP;++i)
		for(int l=0;l<Kinds;++l)
			if(i-Volume[l]/100>=0)
				dp[i]=std::min(dp[i],dp[i-Volume[l]/100]+cost[l]);
	while( std::cin>>n, n )
		std::cout<<dp[n/100]<<std::endl;
	
	return 0;
}

Measured memory_bytes: 1156
n,x=map(int,input().split())
a,b=[1],[1]
for i in range(50):
    a.append(a[-1]*2+3)
    b.append(b[-1]*2+1)
def paty(l,u):
    if l==0 and u==1:
        return 1
    if u==1:
        return 0
    elif u<a[l]//2+1:
        return paty(l-1,u-1)
    elif u==a[l]//2+1:
        return b[l-1]+1
    elif u<a[l]:
        return b[l-1]+1+paty(l-1,u-a[l]//2-1)
    else:
        return b[l]
print(paty(n,x))


Measured memory_bytes: 3064
while True:
  H, W = map(int, input().split())
  if H == 0 and W == 0:
    break
  else:
    for r in range(H):
      for c in range(W):
        if (r + c) % 2:
          print('.', end = '')
        else:
          print('#', end = '')
      print()
  print()


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

int main() {
	int i, cc[26] = { 0 },len, index, flag=0;
	char str[100001];
	
	scanf("%s", &str);

	len = strlen(str);
	for (i = 0; i < len; i++) {
		index = ((int)str[i] - 97);
		cc[index] = 1;
	}

	for (i = 0; i < 26; i++) {
		if (cc[i] == 0) {
			printf("%c\n", (i+97));
			flag = 1;
			break;
		}
	}

	if (flag == 0) printf("None\n");
	
	

	//getchar();
	//getchar();
	return 0;
}

Measured memory_bytes: 256
(function(stdin) {
    var lines = stdin.toString().split('\n');
    var t = lines[0];
    var h = ~~(t / (60 * 60));
    var m = ~~((t % (60 * 60)) / 60);
    var s = ~~((t % 60));
    console.log(h + ":" + m + ":" + s);

}(require('fs').readFileSync('/dev/stdin', 'utf8')));

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

using namespace std;

int main() {

    int n;
    cin >> n;

    vector<int> dp(n+1);

    dp[0] = 1;
    dp[1] = 1;

    for ( int i = 0; i <= n - 2; ++i ) {
        dp[i+2] = dp[i+1]+dp[i];
    }

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


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

#define rep(i,n) for (int i=0; i<(n); i++)
const int INF =1001001001;
const ll BIG = 1000000007;
const double PI = 3.141592653589793;

int main(){
    int a,b,c;
    cin >> a >> b;
    cout <<a*b<< endl;
    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

const double PI=acos(-1.0);

int main()
{
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    double tm = (m / 60) * 2 * PI;
    double th = (60 * h + m) / 720 * 2 * PI;
    double ans = a*a + b*b - 2*a*b*cos(tm-th);
    printf("%.10f\n", sqrt(ans));

    return 0;
}


Measured memory_bytes: 4304
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(void){
    int x, y;
    cin>>x>>y;
    if((4*x-y)%2==0 && 4*x-y>=0 && (y-2*x)%2==0 && y-2*x>=0){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3636
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := makeWordScanner()
	a := eGetInt(scanner)
	b := eGetInt(scanner)
	c := eGetInt(scanner)
	if a+b+c >= 22 {
		fmt.Println("bust")
	} else {
		fmt.Println("win")
	}
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeCharScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanRunes)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}


Measured memory_bytes: 640
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
getInt = readInt <$> BS.getLine

main = do
    n <- getInt
    print $ length [() |k <- [1..n], odd (length (show k))]

Measured memory_bytes: 892
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include <string>
#include <numeric>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
map<int, int> mp;
map<int, int>mm;
#define ll long long
#define ld long double
#define PI 3.14159265358979l

int gcd(int a, int b) {
	if (a < b) {
		int tmp = a;
		a = b;
		b = tmp;
	}
	int r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}


int main() {
	int n, m;
	cin >> n >> m;
	pair <long long, int> ab[100000];
	rep(i, n) {
		cin >> ab[i].first >> ab[i].second;
	}
	sort(ab, ab + n);
	ll ans = 0, now = 0;
	rep(i, n) {
		if (ab[i].second + now <= m) {
			ans += ab[i].first*ab[i].second;
			now += ab[i].second;
		}
		else {
			ans += (m - now)*ab[i].first;
			cout << ans << endl;
			return 0;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int a,b,N,M;
  cin >> N >> M;
  vector<int> city(N,0);
  
  for(int i = 0; i < M; i++) {
    cin >> a >> b;
    city[a-1]++;
    city[b-1]++;
  }
  
  for(int i = 0; i < N; i++) {
    cout << city[i] << endl;
  }

}


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


public class Main {
	private	static	BufferedReader	br = null;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		while (true) {
			String	stdin  = null;
			String	prev   = "000000000000";
			int		island = 0;
			int		len    = prev.length();

			for(int n = 0; n < len; n++) {
				stdin = parseStdin();
				if (stdin.contains("1")) {
					for (int i = 0; i < len; i++) {
						if (stdin.charAt(i) == '1') {
							boolean	isnew = true;
		
							for (int j = i; j < len; j++, i++) {
								if (stdin.charAt(j) != '1') {
									break;
								}
								isnew = (prev.charAt(j) == '1') ? false : isnew;
							}
		
							island = (isnew) ? island + 1: island;
						}
					}
				}

				prev = stdin;
			}

			System.out.println(island);

			if (parseStdin() == null) {
				break;
			}
		}
	}

	private static String parseStdin() {
		String	stdin = null;

		try {
			stdin = br.readLine();
		}
		catch (IOException e) {}

		return stdin;
	}
}

Measured memory_bytes: 16868
def search_xx(s)
    pos = s.each_index.find {|i| s[i] == s[i + 1]}
    [pos + 1, pos + 2] if pos
end
def search_xyx(s)
    pos = s.each_index.find {|i| s[i] == s[i + 2]}
    [pos + 1, pos + 3] if pos
end
def answer(s)
    search_xx(s)|| search_xyx(s) || [-1,-1]
end
puts "%d %d" % answer(gets.chomp.chars)

Measured memory_bytes: 6908
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}
	
	void solve(){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int[] x=new int[m];
		int[] y=new int[m];
		int[] BallCount=new int[n+1];
		boolean[] poss=new boolean[n+1];
		
		for(int i=0;i<m;i++){
			x[i]=sc.nextInt();
			y[i]=sc.nextInt();
		}
		Arrays.fill(poss, false);
		poss[1]=true;
		Arrays.fill(BallCount, 1);
		for(int i=0;i<m;i++){
			
			if(poss[x[i]])poss[y[i]]=true;
			
			BallCount[x[i]]-=1;
			BallCount[y[i]]+=1;
			
			if(BallCount[x[i]]==0)poss[x[i]]=false;
			
		}
		int BallBox=0;
		for(int i=1;i<=n;i++){
			if(poss[i])BallBox++;
		}
		System.out.println(BallBox);
		
	}

}


Measured memory_bytes: 80300
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<limits>
#include<map>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define ll_INF 	9223372036854775807
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int,int>

using namespace std;

int main(){
  vi vec(8);
  int N;
  cin >> N;
  int temp = 0;
  rep(i,N){
    int a;
    cin >> a;
    if(a < 3200){
      vec[a / 400] = 1;
    }
    else{
      temp += 1;
    }
  }
  int min = 0;
  rep(i,8){
    min += vec[i];
  }
  if(min == 0){
    cout << 1 << " " << temp << endl;
  }
  else{
    cout << min << " " << min + temp << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	string s, p, t, circle;
	cin >> s >> p;
	t = s;
	circle = s + t;
	int ans = circle.find(p);
	if (ans == -1)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
}


Measured memory_bytes: 3252
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n;
Vi a;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>n;
    a.resize(n);
    ll inp;
    ll tmp = 0;
    rep(i,n){
        cin>>inp;
        a[i] = inp - i-1;
        tmp += a[i];
        //princ(a[i]);
    }
    sort(all(a));
    ll b = a[a.size()/2],b2 = a[a.size()/2+1];
    ll ans = 0,Ans = INF;
    rep(i,n){
        ans += abs(a[i]-b);
    }
    chmin(Ans,ans);
    ans = 0;
    rep(i,n){
        ans += abs(a[i]-b2);
    }
    chmin(Ans,ans);
    print(Ans);
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <set>
#include <string>
#include <algorithm>

int main() {
  std::string s;
  size_t K;
  std::cin >> s >> K;

  std::set<std::string> cand;
  for (size_t i = 0; i < s.length(); ++i)
    for (size_t j = 1; j <= K; ++j)
      if (i+j <= s.length())
        cand.insert(s.substr(i, j));

  auto it = cand.begin();
  std::advance(it, K-1);
  std::cout << *it << std::endl;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0; i<n; i++)
	{
		cin>>a[i];
		
	}
	
	int dp[k+1]={0};
	
	for(int i=0; i<=k; i++)
	for(int j=0; j<n; j++)
     {
		if(i>=a[j]&&dp[i-a[j]]==0)
	 dp[i]=1;
	
     }
	 
	 if(dp[k]==0)
	 cout<<"Second";
	 else
	 cout<<"First";
	 
}

Measured memory_bytes: 640
//
//  main.cpp
//  ABC170A
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    int x=1001001001;
    int ans=0;
    for (int i=0; i<5; i++) {
        cin>>x;
        if (x==0) {
            ans=i+1;
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);
#define MOD 1000000007LL
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string T;
  cin >> T;
  for(int i = 0; i < sz(T); i++){
    if(T.at(i) == '?') T.at(i) = 'D';
  }
  cout << T << endl;
}

Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int main(){
int x,y,z;
cin >> x >> y >> z;
int d = min(min(x+y,y+z),x+z);
cout << d << endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#define llint long long

using namespace std;

llint n;
set<llint> S;

int main(void)
{
	cin >> n;
	
	for(llint i = 1; i <= min(n, 1000005LL); i++){
		if(n % i == 0) S.insert(i), S.insert(n/i);
	}
	llint ans = 0;
	for(auto v: S){
		llint x = v-1;
		if(x <= 0) continue;
		if(n/x == n%x) ans += x;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <string>

#include<stdio.h>
#include<math.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

using namespace std;

int main(){

  int i,j,k;
  int n=0,m=0,l=0;
  long a[101][101]={0};
  long b[101][101]={0};
  long c[101][101]={0};

  cin >>n >>m >>l;

  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      cin >>a[i][j];
    }
  }
  for(i=0;i<m;i++){
    for(j=0;j<l;j++){
      cin >>b[i][j];
    }
  }

  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      for(k=0;k<l;k++){
	c[i][k]+=a[i][j]*b[j][k];
      }
    }
  }

  for(i=0;i<n;i++){
    for(j=0;j<l-1;j++){
      cout <<c[i][j] <<" ";
    }
    cout <<c[i][j];
    cout <<endl;
  }


  return 0;
}

Measured memory_bytes: 1408
<?php
  list($n, $m) = explode(" ", trim(fgets(STDIN)));

  $min = 0;
  $max = PHP_INT_MAX;
  for($i=1; $i<=$m; $i++){
    list($a, $b) = explode(" ", trim(fgets(STDIN)));
    $min = max($min, $a);
    $max = min($max, $b);
  }

  if($max < $min) {
    echo 0; 
    exit;
  }

  echo $max - $min + 1;

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

int main(){
  int i,len;
  char s[101];
  
  scanf("%s",s);
  len = strlen(s);
  
  for(i=0;i<len;i++){
    if(i%2==0 && s[i]=='L')break;
    if(i%2==1 && s[i]=='R')break;
  }
  if(i<len)
    printf("No\n");
  else
    printf("Yes\n");
  
  return 0;
}

Measured memory_bytes: 128
a1 = [int(x) for x in input().split()]
a2 = [int(x) for x in input().split()]
a3 = [int(x) for x in input().split()]
n = int(input())
b = []
for _ in range(n):
    b.append(int(input()))
res = []
for x in b:
    for i in range(3):
        if x == a1[i]:
            res += "1"
        if x == a2[i]:
            res += "2"
        if x == a3[i]:
            res += "3"
    if x == a1[0] or x == a2[0] or x == a3[0]:
        res += "4"
    if x == a1[1] or x == a2[1] or x == a3[1]:
        res += "5"
    if x == a1[2] or x == a2[2] or x == a3[2]:
        res += "6"
    if x == a1[0] or x == a2[1] or x == a3[2]:
        res += "7"
    if x == a1[2] or x == a2[1] or x == a3[0]:
        res += "8"
if res.count("1")>=3 or res.count("2")>=3 or res.count("3")>=3 or res.count("4")>=3 or res.count("5")>=3 or res.count("6")>=3 or res.count("7")>=3 or res.count("8")>=3:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
N = int(input())
H = list(map(int, input().split()))
H.append(0)

ans = 'Yes'
for i in range(N):
    if H[i-1] <= H[i] - 1:
        H[i] -= 1
    if H[i - 1] > H[i]:
        ans = 'No'
        break

print(ans)


Measured memory_bytes: 63984
#include <iostream>
using namespace std;
int main(void){
    int n, x;
    cin >> n;
    
    for(int i = 1; i <= n; i++){
        x = i;
        if(x % 3 == 0){
            cout << " " << i;
            
        }else while(x){
            if(x % 10 == 3){
                cout << " " << i;
                break;
            }
            x /= 10;
        }
        
    }
    
    cout << endl;
}

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

int main(){
  int n, a, b;
  cin >> n >> a >> b;
  int count = 0;
  for (int i = 1; i <= n; i++){
    int u = i;
    int dsum = 0;
    while (u != 0){
      dsum += u % 10;
      u /= 10;
    }
    if (dsum >= a && dsum <= b) count+=i;
  }
  printf("%d\n", count);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long int

using namespace std;

void solve()
{
  string a,b;
  cin>>a>>b;
  cout<<(b.substr(0,(int)b.size()-1)==a ? "Yes" : "No")<<endl;




}
signed main()

{
  FAST_IO;
  int t = 1;

  // cin>>t;

  while(t--)
  {
    solve();
  }
  
  return 0;
}

Measured memory_bytes: 3600
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[ohara], b[ohara], c[ohara], d, tmp, m, h, w, x, y, sum, k, q;
ll dp[3010][3010][5];
ll fir;
ll sco[3010][3010];

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

  cin >> h >> w >> k;
  rep(i, k) {
    cin >> a[i] >> b[i] >> c[i];
    a[i]--;
    b[i]--;
    sco[a[i]][b[i]] = c[i];
    if (a[i] == 0 && b[i] == 0) fir = c[i];
  }
  rep(i, h + 1) rep(j, w + 1) rep(k, 5) dp[i][j][k] = -LINF;
  dp[0][0][0] = 0;
  if (fir != 0) dp[0][0][1] = fir;
  rep(i, h) {
    rep(j, w) {
      tmp = -LINF;
      rep(z, 4) { tmp = max(tmp, dp[i - 1][j][z]); }
      dp[i][j][0] = max({dp[i][j][0], tmp});
      dp[i][j][1] = max(dp[i][j][1], tmp + sco[i][j]);
      rep(k, 4) {
        if (j >= 1 && k >= 1)
          dp[i][j][k] = max(
              {dp[i][j][k], dp[i][j - 1][k], dp[i][j - 1][k - 1] + sco[i][j]});
        else if (j >= 1)
          dp[i][j][k] = max(dp[i][j][k], dp[i][j - 1][k]);
      }
    }
  }
  rep(i, 4) ans = max(ans, dp[h - 1][w - 1][i]);
  Cout(ans);
  return 0;
}

Measured memory_bytes: 431576
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

ll ans;

// a^n mod を計算する
ll modpow(ll a, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % 2019;
		a = a * a % 2019;
		n >>= 1;
	}
	return res;
}

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

	string s;
	cin >> s;

	ll n = s.size();

	vector<ll> num(n);
	rep(i,n) {
		num[i] = s[i] - '0';
	}
	
	vector<ll> snum(n);
	snum[n-1] = num[n-1];
	

	repk(i, 1, n) {
		snum[n - i - 1] = (snum[n - i] + num[(n - 1) - i] * modpow(10, i) % 2019) % 2019;
	}

	map<int, int> t;
	t[0]++;
	rep(i, n) {
		t[(snum[i] % 2019)]++;
	}

	for (auto p : t) {
		ans += p.second * (p.second - 1) / 2;
	}

	cout << ans << endl;

	return 0;
}

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

int main() {
    int n, K;
    scanf("%d %d", &n, &K);
    if (!K) printf("%lld\n", 1LL * n * n), exit(0);
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j += i) {
            int k = min(n, (j / i + 1) * i - 1);
            ans += max(0, k % i - K + 1);
        }
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		while(true){
			int n=in.nextInt();
			if(n==0)break;
			int A[]=new int[n];
			
			int ave=0;
			for(int i=0;i<n;i++){
				A[i]=in.nextInt();
				ave+=A[i];
			}
			ave/=n;
			int cnt=0;
			for(int i=0;i<n;i++){
				if(A[i]<=ave)cnt++;
			}
			System.out.println(cnt);
		}
	}

}



Measured memory_bytes: 58428
#include <bits/stdc++.h>
 
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define fff(i,a,b) for(int (i)=(a);(i)<=(b);i++)
#define pb push_back
#define len(a) (a).length()
#define all(a) (a).begin(),(a).end()
#define sz(a) (a).size()
#define mp make_pair
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long ,long long > pll;
typedef unsigned long long ull;
typedef long double ld;
 
const int mn=1e6+69;
vector<set<int> > kg(mn);
vector<int> inf(mn);
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	ll a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	ll comfort=0;
	comfort+=a[n-1];
	int pom=n-2;
	int kolko=n-2;
	while(kolko>0)
	{
		if(kolko>=2)
		{
			kolko-=2;
			comfort+=2*a[pom];
			pom--;
		}
		else
		{
			kolko--;
			comfort+=a[pom];
		}
	}
	cout<<comfort<<endl;
}

Measured memory_bytes: 55472
#include <stdio.h>

int main(void) {
  int n, m, p, x[1000], i, sum;
  while (1) {
    scanf("%d%d%d", &n, &m, &p);
    if (n == 0 && m == 0 && p == 0) return 0;

    for (i = 0; i < n; i++)
      scanf("%d", &x[i]);

    sum = 0;
    for (i = 0; i < n; i++)
      sum += x[i] * 100;

    sum = sum * (100 - p) / 100;
    if (x[m - 1] == 0) printf("%d\n", 0);
    else printf("%d\n", sum / x[m - 1]);
  }
}

Measured memory_bytes: 604
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

K, X = MAP()
ans = []
for i in range(X-K+1, X+K):
  if -1000000 <= i <= 1000000:
    print(i, end="")
    print(" ", end="")
    
print()

Measured memory_bytes: 5208
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int x = Integer.parseInt(sa[1]);
		sa = br.readLine().split(" ");
		int[] s = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		Arrays.sort(s);

		int mx = 100000;
		int mod = 1000000007;
		long total = 1;
		for (int i = 2; i <= n; i++) {
			total *= i;
			total %= mod;
		}

		Set<Integer> set = new HashSet<>();
		set.add(x);
		long[] dp = new long[mx + 1];
		dp[x] = 1;
		for (int i = n - 1; i >= 0; i--) {
			Integer[] arr = set.toArray(new Integer[0]);
			for (int o : arr) {
				int next = o % s[i];
				long val = dp[o] * modinv(i + 1, mod) % mod;
				dp[next] += val;
				dp[next] %= mod;
				dp[o] += mod - val;
				dp[o] %= mod;
				set.add(next);
			}
		}

		long ans = 0;
		for (int i = 1; i < s[0]; i++) {
			ans += i * dp[i] % mod * total;
			ans %= mod;
		}
		System.out.println(ans);
	}

	static long modinv(long a, int m) {
		long b = m;
		long u = 1;
		long v = 0;
		long tmp = 0;

		while (b > 0) {
			long t = a / b;
			a -= t * b;
			tmp = a;
			a = b;
			b = tmp;

			u -= t * v;
			tmp = u;
			u = v;
			v = tmp;
		}

		u %= m;
		if (u < 0) u += m;
		return u;
	}
}


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

int main() {
	int N, L;
	cin >> N;
	int total = 0;
	vector<int> vec(N);
	for (int i = 0; i < N; i++) {
		cin >> L;
		vec.at(i) = L;
	}
	sort(vec.begin(), vec.end());
	for (int j = 0; j < N - 1; j++) {
		total += vec.at(j);
	}
	if (vec.at(N - 1) < total) {
		cout << "Yes" << endl;
	}
	else if (vec.at(N - 1) >= total){
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3604
K = int(input())
S = input()
n = len(S)
MOD = 10 ** 9 + 7
MAX = 2 * 10 ** 6 + 5

fac = [0] * MAX
finv = [0] * MAX
inv = [0] * MAX
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD

def nCk(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

A = 0
for i in range(K + 1):
    A1 = pow(26, K - i, MOD)
    A2 = (pow(25, i, MOD) * nCk(i + n - 1, n - 1)) % MOD
    A = (A + (A1 * A2) % MOD) % MOD

print(A % MOD)

Measured memory_bytes: 135636
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int fib(int n){
  static vector<int> dp(45, -1);
  if(dp.at(n) != -1) return dp.at(n);
  if(n == 0 || n == 1) return dp.at(n) = 1;
  else return dp.at(n) = fib(n-1) + fib(n-2);
}

int main(){
  int n;
  cin >> n;
  cout << fib(n) << endl;
  return 0;
}


Measured memory_bytes: 3120
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <list>
#include <algorithm>

using namespace std;

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

    vector<int> nl;
    int mx = 0;
    do{
        int n;
        cin >> n;
        if (!cin.eof()){
            nl.push_back(n);
            mx = max(mx, n);
        }else{
            break;
        }
    }while(1);

    double r = sqrt(mx);

    list<int> sl;
    vector<int> primes;

    for (int i = 2; i <= mx; i++) {
        sl.push_back(i);
    }

    while (sl.front() <= r) {
        int p = sl.front();
        primes.push_back(p);
        sl.pop_front();

        auto i = sl.begin();
        while(i != sl.end()){
            if(*i % p == 0){
                i = sl.erase(i);
            }
            else {
                i++;
            }
        }
    }

    for (auto&& i : sl) {
        primes.push_back(i);
    }

    for (auto&& n : nl) {
        auto p = upper_bound(primes.begin(), primes.end(), n);
        cout << p - primes.begin() << endl;
    }

    return 0;
}

Measured memory_bytes: 34608
#include<bits/stdc++.h>
using namespace std;
char s[10][10];
bool R[10];
bool C[10];
int main(){
	int H,W,K;
	scanf("%d %d %d",&H,&W,&K);
	for(int i=1;i<=H;i++){
		scanf("%s",s[i]+1);
	}
	int ans2=0;
	for(int i=0;i<=(2<<H)-1;i++){
		for(int j=0;j<=(2<<W)-1;j++){
			int ans=0;
			for(int r=1;r<=H;r++){
				if((i>>(r-1))&1) R[r]=1;
			}
			for(int c=1;c<=W;c++){
				if((j>>(c-1))&1) C[c]=1;
			}
			
			for(int r=1;r<=H;r++){
				for(int c=1;c<=W;c++){
					if(!R[r]&&!C[c]&&s[r][c]=='#') ans++;
				}
			}
			if(ans==K) ans2++;
			
			for(int r=1;r<=H;r++) R[r]=0;
			for(int c=1;c<=W;c++) C[c]=0;
		}
	}
	printf("%d",ans2/4);
	return 0;
}

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

using namespace std;

#define ll long long
#define F first
#define S second
#define ii pair < int , int >

const int N=1e6+9;
int v[N];
int a[N];
int main()
{
    int g=0;
    int n;
    memset(v,-1,sizeof(v));
    scanf("%d",&n);
    bool q=0;
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
        g=__gcd(g,a[i]);
        if(q)
            continue;
        if(v[a[i]] != -1 && a[i]!=1)
        {
            q=1;
            continue;
        }
        v[a[i]]=i;
        for(int j=2; j<=sqrt(a[i]); j++)
        {
            if(a[i]%j==0)
            {
                if(v[j]!=-1)
                {
                    q=1;
                    break;
                }

                int tmp=a[i]/j;
                if(v[tmp]!=-1)
                {
                    q=1;
                    break;
                }
                v[tmp]=i;
                v[j]=i;
            }
        }

    }

    if(!q)
    {
        cout<<"pairwise coprime";
    }
    else if(g==1)
    {
        cout<<"setwise coprime";
    }
    else
    {
        cout<<"not coprime";
    }
}


Measured memory_bytes: 11476
N, Y = list(map(int, input().split()))
for i in range(N+1):
    for j in range(N+1):
        if ((N-i-j) >= 0 and i*10000 + j*5000 + (N-(i+j))*1000 == Y):
            print(i, j, N-i-j)
            exit()
print(-1, -1, -1)


Measured memory_bytes: 3060
s = input().rstrip()
n = len(s)
res = 1
prev = s[0]
index = 1
while index < n:
    c = s[index]
    res += 1
    if c != prev:
        index += 1
        prev = c
    else:
        index += 2
        prev = ''
        if index > n:
            res -= 1
print(res)

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

int main() {
	
	int a, b, x;
	cin >> a >> b >> x;
	if(x < a) puts("NO");
	else if(x <= a + b) puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 256
#include <time.h>

#include <stdlib.h>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <bitset>

using namespace std;
const int64_t INF=10000000000000000;
#include <cstdint>
#include <iostream>
#include <utility>
#include <map>

int64_t gcd(int64_t a,int64_t b){//calc gcd
	if(a==0){
		return b;
	}else if(b==0){
		return a;
	}else if(a>b){
		return gcd(a%b,b);
	}else{
		return gcd(b%a,a);
	}
}
std::pair<int64_t,int64_t> extgcd(int64_t a,int64_t b){//a*(pair->first) + b*(pair->second) = gcd(a,b)
	if(a==0){
		return std::make_pair(0,1);
	}else if(b==0){
		return std::make_pair(1,0);
	}else{
		if(a>b){
			std::pair<int64_t,int64_t> d=extgcd(a%b,b);
			return std::make_pair(d.first,d.second-(a/b)*d.first);
		}else{
			std::pair<int64_t,int64_t> d=extgcd(a,b%a);
			return std::make_pair(d.first-(b/a)*d.second,d.second);
		}
	}

}
int64_t inline normalize_mod(int64_t a,int64_t m){
	return (m+a%m)%m;
}
int64_t mod_inv(int64_t a,int64_t m){//a^-1(mod m),m is a prime number
	int64_t raw=extgcd(a,m).first;
	return normalize_mod(raw,m);;
}
std::map<int64_t,int64_t> factorization(int64_t n){
	std::map<int64_t,int64_t> retval;
	for(int64_t i=2;i*i<=n;i++){
		int64_t counter=0;
		while(n%i==0){
			n=n/i;
			counter++;
		}
		if(counter!=0){
			retval.emplace(i,counter);
		}
	}
	return retval;
}
std::pair<int64_t,int64_t> mod_fact(int64_t n,int64_t m){//n!=first*m^second
	if(n==0){
		return std::make_pair(1,0);
	}else{

		std::pair<int64_t,int64_t> d=mod_fact(n/m,m);
		int64_t second=d.second+n/m;
		int64_t first;
		if((n/m)%2==0){
			first=1;
		}else{
			first=m-1;
		}
		for(int64_t i1=1;i1<=(n%m);i1++){
			first=normalize_mod(first*i1,m);
		}
		return std::make_pair(first,second);
	}
}
int main(){
	const int64_t mod=1000000007;
	int64_t n;
	cin>>n;
	int64_t *fact=new int64_t[n];
	fact[0]=1;
	for(int64_t i1=1;i1<n;i1++){
		fact[i1]=(fact[i1-1]*i1)%mod;
	}
	int64_t ans=0;
	int64_t under_k=0;
	for(int64_t k=(n+1)/2;k<n;k++){
		int64_t temp=(fact[k-1]*mod_inv(fact[n-k-1]*fact[2*k-n],mod))%mod;
		temp=(((temp*fact[k])%mod)*fact[n-1-k])%mod;
		ans=normalize_mod(ans+(temp-under_k)*k,mod);
		under_k=temp;
	}
	cout<<ans<<endl;



}

Measured memory_bytes: 8064
#pragma GCC optimize(2,3,"Ofast","unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define in inline
namespace fast_io
{
	char buf[1<<12],*p1=buf,*p2=buf,sr[1<<23],z[23],nc;int C=-1,Z=0,Bi=0,ny;
	in char gc() {return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<12,stdin),p1==p2)?EOF:*p1++;}
	in ll read()
	{
		ll x=0;ny=1;while(nc=gc(),(nc<48||nc>57)&&nc!=EOF)if(nc==45)ny=-1;Bi=1;if(nc<0)return nc;
		x=nc-48;while(nc=gc(),47<nc&&nc<58&&nc!=EOF)x=(x<<3)+(x<<1)+(nc^48),Bi++;return x*ny;
	}
	in db gf() {int a=read(),y=ny,b=(nc!='.')?0:read();return (b?a+(db)b/pow(10,Bi)*y:a);}
	in int gs(char *s) {char c,*t=s;while(c=gc(),c<=32);*s++=c;while(c=gc(),c>32)*s++=c;return s-t;}
	in void ot() {fwrite(sr,1,C+1,stdout);C=-1;}
	in void flush() {if(C>1<<22) ot();}
	template <typename T>
	in void write(T x,char t)
	{
		int y=0;if(x<0)y=1,x=-x;while(z[++Z]=x%10+48,x/=10);
		if(y)z[++Z]='-';while(sr[++C]=z[Z],--Z);sr[++C]=t;flush();
	}
	in void write(char *s) {int l=strlen(s);for(int i=0;i<l;i++)sr[++C]=*s++;sr[++C]='\n';flush();}
};
using namespace fast_io;
#define pb push_back
const int N=1e6+5;
int n,m,ans;ll k,a[N],b[N];
int main()
{
	n=read(),m=read(),k=read();
	for(int i=1;i<=n;i++) a[i]=read()+a[i-1];
	for(int i=1;i<=m;i++) b[i]=read()+b[i-1];
	for(int i=0;i<=n;i++) if(k>=a[i])
	{
		int j=upper_bound(b+1,b+m+1,k-a[i])-b;
		ans=max(ans,i+j-1);
	}
	write(ans,'\n');
	return ot(),0;
}
//Author: disangan233

Measured memory_bytes: 6752
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
	int x, y;
	cin >> x >> y;

	while (!(x==0 && y == 0)) {
		cout << min(x, y) << " " << max(x, y) << endl;
		cin >> x >> y;
	}

	return 0;
}


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

using namespace std;
const int64_t N=1000000000000000000;

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

    int n;
    cin >> n;
    int64_t val,mul,m;
    cin >> val;
    for(int i=1;i<n;i++){
        if(val > 0)
            m=N/val;
        cin >> mul;
        if(mul==0 || val==0) {val=0;continue;}
        if(val==-1) continue;
        if(mul>m) val=-1;
        else val*=mul;
    }
    if(val > N) val=-1;
    cout << val << "\n";
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S; 
  string A = S.substr(0,2);
  string B = S.substr(2,2);
  
  int C = stoi(A);
  int D = stoi(B);
  
  int a = 0;
  int b = 0;
  
  if(0 <= C && C <= 99){
    if(1 <= D && D <=12){
      a = 1;
    }
  }
  if(1 <= C && C <= 12){
    if(0 <= D && D <=99 ){
      b = 1;
    }
  }
    
  if(a == 1 && b == 0){
    cout << "YYMM" << endl;
  }
  if(a == 0 && b == 1){
    cout << "MMYY" << endl;
  }
  if(a == 1 && b == 1){
    cout << "AMBIGUOUS" << endl;
  }
  if(a == 0 && b == 0){
    cout << "NA" << endl;
  }
}



Measured memory_bytes: 256
MAX = 2*10**5+100
MOD = 10**9+7
fact = [0]*MAX #fact[i]: i!
inv = [0]*MAX #inv[i]: iの逆元
finv = [0]*MAX #finv[i]: i!の逆元
fact[0] = 1
fact[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
    
for i in range(2, MAX):
    fact[i] = fact[i-1]*i%MOD
    inv[i] = MOD-inv[MOD%i]*(MOD//i)%MOD
    finv[i] = finv[i-1]*inv[i]%MOD

def C(n, r):
    if n<r:
        return 0
    if n<0 or r<0:
        return 0
    return fact[n]*(finv[r]*finv[n-r]%MOD)%MOD
    
N, K = map(int, input().split())

for i in range(1, K+1):
    print(C(N-K+1, i)*C(K-1, K-i)%MOD)

Measured memory_bytes: 47344
#include<stdio.h>
int main(){
    int a,b,c,msg=0;
    scanf("%d %d %d",&a,&b,&c);
    for(int i=a; i<=b; i++){
        if(c%i==0){
            msg++;
        }
    }
    printf("%d\n",msg);
    return 0;
}


Measured memory_bytes: 2108
// Kab khoon khaulega re tera?

#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

const int N = 3e5 + 5;
ll a[N];
int main()
{
    ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n;
    cin >> n;
    ll sq = sqrtl(n);
    map<ll, int> mp;
    for(int i = 2; i <= sq; i++){
        while(n % i == 0){
            n /= i;
            mp[i]++;
        }
    }
    if(n > 1)
        mp[n]++;
    ll ans = 0;
    for(auto i : mp){
        ll x = i.S;
        ll sum = 0;
        for(int j = 1; j <= 1e7; j++){
            sum += j;
            if(sum <= x)
                ans++;
            else
                break;
        }
    }
    cout << ans;
return 0;
}


Measured memory_bytes: 3680
#include<iostream>
using namespace std;
int main() {
	int N, X;
	cin >> N >> X;
	int m[N];
	int ans = 0;
	for (int i = 0; i < N; i++) {
		cin >> m[i];
	}
	for (int i = 0; i < N; i++) {
		X = X - m[i];
		ans++;
	}
	int min = 100000;
	for (int i = 0; i < N; i++) {
		if (min > m[i]) {
			min = m[i];
		}
	}
	ans = ans + X / min;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <cmath>
using namespace std;

int myfind(int a, vector<int>& relation) {
    if (relation[a] == a) return a;
    int res = myfind(relation[a], relation);
    relation[a] = res;
    return res;
}

void myunion(int a, int b, vector<int>& relation) {
    int ta = myfind(a, relation);
    int tb = myfind(b, relation);
    if (ta == tb) return;
    relation[ta] = tb;
}

int main() {
    int n;
    cin >> n;
    vector<pair<int, pair<int, int>>> v;
    for (int i = 0; i < n; i++) {
    	int x, y;
    	cin >> x >> y;

    	v.push_back(make_pair(x - 1, make_pair(y - 1, i)));
    }
    sort(v.begin(), v.end());
    vector<int> relation(n, 0);
    for (int i = 0; i < n; i++) {
    	relation[i] = i;
    }
    map<int, int> m;
    for (int i = 0; i < n; i++) {
    	if (m.size() > 0 && m.begin()->first < v[i].second.first) {
    		vector<int> d;
    		for (auto it = m.begin(); it != m.end() && it->first < v[i].second.first; it++) {
    			d.push_back(it->first);
    			myunion(v[i].second.second, it->second, relation);
    		}
    		for (int i = 1; i < d.size(); i++) {
    			m.erase(d[i]);
    		}
    	} else {
    		m.insert(make_pair(v[i].second.first, v[i].second.second));	
    	}
    }
    unordered_map<int, int> um;
    for (int i = 0; i < n; i++) {
    	um[myfind(i, relation)]++;
    }
    for (int i = 0; i < n; i++) {
    	cout << um[myfind(i, relation)] << endl;
    }
}






Measured memory_bytes: 13632
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

/* define */
#define Yes(X) puts ( X ? "Yes" : "No")
#define YES(X) puts ( X ? "YES" : "NO")
#define FOR(i, a, b) for ( int i = a; i < b ; i++)
#define REP(i, n) for ( int i = 0; i < n ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))

/* const */
const int MOD = (int)1e9 + 7;

/* alias */
typedef long long ll;
typedef unsigned  u;

/* function */
int cmp(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
ll Lgcd(ll a, ll b) {
	if (b != 0) return Lgcd(b, a % b); 
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
ll Llcm(ll a, ll b) {
	return a / Lgcd(a, b) * b;
}

/* main */


int main() {
	int f, c = 0, ms, mt;
	char s[100], t[100];
	scanf("%s%*c%s",s, t);
	ms = strlen(s);
	mt = strlen(t);
	if (ms >= mt) {
		for(int i = ms - mt; i >= 0; i--) {
			f = 1;
			REP(j, mt) if (!(s[i + j] == t[j] || s[i + j] == '?')) f = 0;
			if (f) {
				strncpy(&s[i], t, mt);
				REP(j, ms)if (s[j] == '?')s[j] = 'a';
				c = 1;
				break;
			}
		}
	}
	if(c)puts(s);
	else puts("UNRESTORABLE");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

ll combup(ll x, ll y){
	ll a = 1;
	for(int i=0; i<y; i++){
		a = (a*(x-i))%mod;
	}
	return a;
}

ll combdown(ll y){
	ll b = 1;
	for(int i=0; i<y; i++){
		b = (b*(y-i))%mod;
	}
	return b;
}

ll modpow(ll x, ll y){
	if(y == 0){
		return 1;
	}
	if(y % 2 == 0){
		return (modpow(x, y/2)*modpow(x, y/2))%mod;
	}else{
		return (x*modpow(x, y-1))%mod;
	}
}

int main(){
	int N, M;
	vector<int> index(20, 0);
	cin >> N >> M;
	int m = M;
	int p = -1;
	for(int i=2; i<=sqrt(M); i++){
		if(m == 1){
			break;
		}
		if(m%i == 0){
			p++;
		}
		while(m%i == 0){
			m /= i;
			index[p]++;
		}
	}
	if(m != 1){
		index[p+1]++;
	}
	ll up = 1, down = 1;
	for(int i=0; index[i] != 0; i++){
		up = (up * combup(index[i]+N-1, index[i]))%mod;
		down = (down * combdown(index[i]))%mod;
	}
	ll ans = (up * modpow(down, mod-2))%mod;
	cout << ans << endl;
}

Measured memory_bytes: 256