akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define FOR(i,n) for(int i=0; i<int(n); i++)
#define FOR1(i,m,n) for(int i=int(m); i<int(n); i++)

const int MAXN = 2*1e5;
const int MOD = 1e9+7;

int N, X, Y;
int fac[MAXN+1], inv[MAXN+1], ifac[MAXN+1], mn[MAXN+1], c[MAXN+1], w[MAXN+1], same[MAXN+1], fr[MAXN+1];
pair<int, int> mna(0,1e9), mnb(0,1e9);

int comb(int n, int r) {
    return (ll)fac[n] * ifac[r] % MOD * ifac[n-r] % MOD;
}

int main(int argc, char *argv[])
{
    scanf("%d%d%d", &N, &X, &Y);
    
    fac[0]=1;
    FOR1(i,1,N+1) fac[i]=(ll)fac[i-1]*i%MOD;
    inv[1]=1;
    FOR1(i,2,N+1) inv[i]=(ll)(MOD-MOD/i)*inv[MOD%i]%MOD;
    ifac[0]=1;
    FOR1(i,1,N+1) ifac[i]=(ll)ifac[i-1]*inv[i]%MOD;

    FOR1(i,1,N+1) mn[i] = 1e9;

    FOR1(i,1,N+1) {
        scanf("%d%d", &c[i], &w[i]);
        if (w[i] < mn[c[i]]) mn[c[i]] = w[i];
    }

    FOR1(i,1,N+1) {
        if (mn[i] < mna.second) {
            mnb = mna;
            mna.first = i;
            mna.second = mn[i];
        }
        else if (mn[i] < mnb.second) {
            mnb.first = i;
            mnb.second = mn[i];
        }
    }

    FOR1(i,1,N+1) {
        if (w[i]+mn[c[i]] <= X)
            same[c[i]]++;

        if (c[i] == mna.first && w[i] + mnb.second <= Y)
            fr[c[i]]++;
        else if (c[i] != mna.first && w[i] + mna.second <= Y)
            fr[c[i]]++;
    }

    int ans = 1, S = 0;
    FOR1(i,1,N+1) {
        if ((i == mna.first && mn[i] + mnb.second <= Y) ||
            (i != mna.first && mn[i] + mna.second <= Y)) {
            same[i] = max(same[i], fr[i]);
            ans = (ll)ans * comb(same[i]+S, same[i]) % MOD;
            S += same[i];
        }
    }

    printf("%d\n", ans);
    
    return 0;
}


Measured memory_bytes: 6528
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
int main() {
    int A, B; cin >> A >> B;
    if((A + B) % 2) cout << "IMPOSSIBLE" << endl;
    else cout << (A + B) / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def power(b,p,f):
    """
    b: object (base)
    p: positive int (multiplier)
    f: multiple function
    return: f^p(b)
    """
    if not isinstance(p,int): raise ValueError("multiplier must be int")
    elif p<=0: raise ValueError("multiplier must be positive.")
    logp=p.bit_length()
    S=[0]*logp
    S[0]=b
    res='$'
    for i in range(logp):
        if i!=logp-1: S[i+1]=f(S[i],S[i])
        if p&(1<<i):
            if res=='$': res=S[i]
            else: res=f(res,S[i])
    return res

def mat_mul(A,B):
    assert len(A[0])==len(B)
    m=len(A)
    n=len(B)
    l=len(B[0])
    C=[[0]*l for _ in range(m)]
    for i in range(m):
        for j in range(l):
            for k in range(n):
                C[i][j]+=A[i][k]*B[k][j]
                C[i][j]%=MOD
    return C

def resolve():
    n,k=map(int,input().split())
    A=[list(map(int,input().split())) for _ in range(n)]
    dp=[[1]]*n
    A=power(A,k,mat_mul)
    dp=mat_mul(A,dp)
    res=0
    for i in range(n): res+=dp[i][0]
    print(res%MOD)
resolve()

Measured memory_bytes: 42676
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;


//      DEEP

using namespace std;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define all(v) v.begin(),v.end()
#define pb push_back
#define endl '\n'
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
typedef pair<long long,long long> pll;
typedef set<int> si;


/*
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
*/
/*
typedef tree<
pair<int, int>,
null_type,
less<pair<int, int>>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
*/

const ll mod = 1e9 + 7;
const ll modl=998244353;
const double pie=3.1415926535;
                                                    //power
ull power(ull x,ull y){
   if(y==0) return 1;
   else{
     if(y%2==0) return power(x*x,y/2);
     else return x*power(x*x,(y-1)/2);
   }
}

                        //                    Modular Exponentiation

ll mod_power(ll x, ll y, ll m)
{
    ll r = 1;     // Initialize result

    x = x % m; // Update x if it is more than or equal to m

    if (x == 0) return 0; // In case x is divisible by m;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            r = (r*x) % m;

        // y must be even now
        y = y/2;
        x = (x*x) % m;
    }
    return r;
}

                                                      //GCD
ll gcd(ll x,ll y){
   if(y==0)return x;
   return gcd(y,x%y);
}
                                              // SIEVE

/*
bool isPrime[100001];
void sieve(int N) {

        for(int i = 0; i <= N;++i) {
            isPrime[i]=true;
        }
        isPrime[0]=false;
        isPrime[1]=false;

        for(int i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {
                 for(int j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }
*/


int main(){
    boost;
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
       string s;
       cin>>s;
       int ans=0;
       int mx=0;
       for(int i=0;i<3;i++){
        if(s[i]=='R'){
            ans++;
        }
        else{
            mx=max(mx,ans);
            ans=0;
        }
       }
       cout<<max(mx,ans)<<endl;

    }
}















Measured memory_bytes: 3640
#include<iostream>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <vector>
using namespace std; 
const int Nmax = 10000;
const int INF = 1000000000;
const int MOD = 1000000007;

int main()
{   
	
    long long unsigned int n;
    cin>>n;
    vector<char>s;
    
    long long unsigned int cnt=0;
    while(n>0){
    	if(n%26==0) {
    		s.push_back('z');
    		n=n/26;
    		n--;
    	}

    	else {
    		s.push_back('a'+n%26-1);
    	n=n/26;
    }
    	cnt++;
    }
    vector<char>str(cnt);
    //cout<<cnt;
    for (long long unsigned int i=0;i<cnt;i++){
    	//cout<<s[i];
    	str[cnt-1-i]=s[i];
    }
    for (long long unsigned int i=0;i<cnt;i++){
    	cout<<str[i];
    	
    }
    
    return 0;
}

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

int main(){
  int n;
  cin>>n;
  vector<int> freq(n+5);
  //memset(freq,0,sizeof(freq));
  int a1;
  for(int i=0;i<n;i++){
    cin>>a1;
    freq[a1]+=1;
  }
  vector<int> c,f1;
  for(int i=0;i<=n;i++){
	  if(freq[i])
	    c.push_back(freq[i]);
	}
  sort(c.begin(),c.end());
  //vector<int> f1(n+5);
  //memset(f1,0,sizeof(f1));
  //f1[0]=freq[0];
  f1.push_back(c.front());
  for(int i=1;i<c.size();i++)
    f1.push_back(f1.back()+c[i]);
   //cout<<n<<endl; 
  for(int i=1;i<=n;i++){
    int l=0,u=n/i;
    int m;
    while(l!=u){
      m=(l+u)/2+1;	
      int i1=lower_bound(c.begin(),c.end(),m)-c.begin();
      int t1=c.size()-i1;
      if(i1>0)
        t1+=f1[i1-1]/m;
      if(t1>=i)
        l=m;
      else
        u=m-1;
    }
    cout<<l<<endl;
  }
}
             


Measured memory_bytes: 5616
#include <stdio.h>
#include <math.h>

int main(void)
{
    int n, x[100], y[100];

    scanf("%d", &n);

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

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

    int temp;
    double max = -1, D[3] = {0};

    for(i = 0; i < n; ++i)
    {
        temp = abs(x[i] - y[i]);
        max = temp > max ? temp : max;

        D[0] += temp;
        D[1] += pow(temp, 2);
        D[2] += pow(temp, 3);
    }

    D[1] = sqrt(D[1]);
    D[2] = pow(D[2], 1./3);

    printf("%f\n%f\n%f\n%f\n", D[0], D[1], D[2], max);

    return 0;
}

Measured memory_bytes: 696
import java.util.Scanner;

import java.util.*;

public class Main{
	static public void  main(String[] args){
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int k = scan.nextInt();
		List<Integer> h = new ArrayList<>(n);


		for(int i = 0; i < n; i++){
			h.add(scan.nextInt());
		}
		Collections.sort(h);

		int min = Integer.MAX_VALUE;
		for(int i = 0; i < n - k + 1; i++){
			int d = h.get(i+k-1) - h.get(i);
			if (d < min) min = d;
		}
		System.out.println(min);
	}
}


Measured memory_bytes: 63584
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
char s[50];
int main()
{
    scanf("%s",s);
    if (s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I')
     printf("Yes\n");
   else
  printf("No\n");
}


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

using namespace std;

int abnumber(int, int);

int main()
{
	int n,temp,dif=1000000;
	int a[1000];

	start:

	scanf("%d", &n);

	if (n == 0) {
		goto finish;
	}

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

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

	for (int i = 0; i < n - 1; i++) {
		if ((a[i] - a[i + 1]) < dif) {
			dif = a[i] - a[i + 1];
		}
	}
	
	cout << dif << endl;

	n = 0;
	dif = 1000000;

	goto start;

	finish:

	return 0;
}

int abnumber(int i, int j) {
	if ((i - j) > 0) {
		return i - j;
	}
	else {
		return j - i;
	}
}


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

#pragma warning( disable: 4996 )

using namespace std;

typedef long long ll;

#define INF 1000000000
#define EPS 1e-10

string str;

vector<int> ans_list;

string r = "yuiophjklnm";

int main(){

	while (true){

		cin >> str;
		if (str == "#")
			break;

		int ans = 0;
		bool right = false;

		for (int i = 0; i < str.length(); i++){
			if (i == 0){
				for (int j = 0; j < r.length(); j++){
					if (str[i] == r[j])
						right = true;
				}
			}

			else if (right){
				bool flag = false;
				for (int j = 0; j < r.length(); j++){
					if (str[i] == r[j])
						flag = true;
				}
				if (!flag){
					right = false;
					ans++;
				}
			}

			else{
				bool flag = false;
				for (int j = 0; j < r.length(); j++){
					if (str[i] == r[j])
						flag = true;
				}
				if (flag){
					right = true;
					ans++;
				}
			}

		}

		ans_list.push_back(ans);

	}

	for (int i = 0; i < ans_list.size(); i++){
		cout << ans_list[i] << endl;
	}

	return 0;

}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define reprr(i, m, n) for (ll i = m; i < n; i++)
#define inf (1ll<<60)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll A, B, Q; cin >> A >> B >> Q;
    vll s(A); rep(i, A) cin >> s[i];
    vll t(B); rep(i, B) cin >> t[i];
    vll x(Q); rep(i, Q) cin >> x[i];

    sort(all(s)), sort(all(t));
    s.insert(s.begin(), -inf);
    s.push_back(inf);
    t.insert(t.begin(), -inf);
    t.push_back(inf);
    rep(i, Q) {
        vll ns(2), nt(2);
        ll pos = x[i];
        ll left = 0, right = s.size() - 1;
        ll mid;
        while (left + 1 < right) {
            mid = (left + right) / 2;
            if (s[mid] < pos && pos <= s[mid+1]) {
                ns[0] = s[mid], ns[1] = s[mid+1];
                break;
            }

            if (pos <= s[mid]) right = mid; else left = mid;
        }

        ns[0] = s[mid], ns[1] = s[mid + 1];
        left = 0, right = t.size()-1;
        while (right - left > 1) {
            mid = (left + right) / 2;
            if (t[mid] < pos && pos <= t[mid+1]) {
                nt[0] = t[mid], nt[1] = t[mid+1];
                break;
            }

            if (pos <= t[mid]) right = mid; else left = mid;
        }
        nt[0] = t[mid], nt[1] = t[mid+1];

        ll min_num = inf;
        rep(i, 2) rep(j, 2) {
            min_num = min(min_num, abs(ns[i] - pos) + abs(nt[j] - ns[i]));
        }

        rep(i, 2) rep(j, 2) {
            min_num = min(min_num, abs(nt[i] - pos) + abs(ns[j] - nt[i]));
        }

        cout << min_num << endl;
    }
    return 0;
}

Measured memory_bytes: 5344
S = input()

tmp = []
ans = 0

for i in range(len(S)):
    if S[i] == 'S':
        tmp.append(S[i])
        ans = ans + 1
    else:
        if ans == 0:
            tmp.append(S[i])
            ans = ans + 1
        elif tmp[ans-1] == 'T':
            tmp.append(S[i])
            ans = ans + 1
        else:
            tmp.pop(ans-1)
            ans = ans-1
            
print(ans)

Measured memory_bytes: 5096
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n,m;
  while(cin>>n>>m,n){
    int p[n];
    for(int i=0;i<n;i++) cin>>p[i];
    vector<int> s;
    s.emplace_back(0);
    s.emplace_back(m+1);
    for(int i=0;i<n;i++)
      s.emplace_back(p[i]);
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)
	s.emplace_back(p[i]+p[j]);
    sort(s.begin(),s.end());
    s.erase(unique(s.begin(),s.end()),s.end());
    int ans=0;
    auto latte=--s.end();
    for(int x:s){
      if(x>m) continue;
      while(latte!=s.begin()&&x+*latte>m) --latte;
      int y=*latte;
      if(x+y>m) continue;
      ans=max(ans,x+y);
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 18916
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
long long int mod = (long long int)1000000007;
using namespace std;

void solve()
{
    ll i,j,k,n;
    std::cout.precision(10);
    int yes=0;
  cin>>n;
  ll curr=100;
  ll x=0;
 	while(curr<n)
    {
      x++;
     	curr+=curr/100; 
    }
  cout<<x;
}

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    int i,j,k;
    int t;
    std::cout.precision(10);
    t=1;
    while(t--)
    {
        solve();
        cout<<"\n";
    }
}

Measured memory_bytes: 3640
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<limits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
 
#include<deque>
#define pi 3.141592653589793238
#include<chrono>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
 
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
 
 
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    //cin >> T;
    while (T--) {
        ll k, x;
        cin >> k >> x;
        for(i = max(-1000000LL, x - k + 1); i <= min(1000000LL, x + k - 1); i++){
            cout << i <<" ";
        }
    }
    return 0;
}

Measured memory_bytes: 3620
N =  int(input())
S = [input() for _ in range(N)]

cnt = 0
b, a = 0, 0
ab = 0
for s in S:
  cnt += s.count("AB")
  if s[0] == "B" and s[-1] == "A":
    ab += 1
  elif s[0] == "B":
    b += 1
  elif s[-1] == "A":
    a += 1
if ab > 1:
  cnt += ab-1
  ab = 1
if ab:
  if a:
    cnt += 1
    a -= 1
  if b:
    cnt += 1
    b -= 1
at = 0
bt = 0
while a > 0 and b > 0:
  if a:
    at += 1
    a -= 1
  if b:
    bt += 1
    b -= 1
  if at + bt == 2:
    cnt += 1
  at = 0
  bt = 0
print(cnt)

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

int main() {
	int A,B,C;
	cin >>A>>B>>C;
	B -= C;
	A -= C;
	if( A*B > 0) cout << "No" << endl;
	if( A*B < 0) cout << "Yes" << endl;
}

Measured memory_bytes: 256
import Debug.Trace
import Data.Char

split :: Show a => [a] -> [[[a]]]
split [] = [[[], []]]
split l =
    foldr
        (\ h -> concatMap (\ [x, y] -> [[h : x, y], [x, h : y]]))
        [[[], []]]
        l

greedy :: Int -> [[Int]] -> Int
greedy g [] = if g <= 0 then 0 else 1000000
greedy g ([score, d, _]:t) 
    | g <= 0 = 0
    | g - d * score <= 0 = (g + score - 1) `div` score
    | otherwise = d + greedy (g - d * score) t

calc :: Int -> [[[Int]]] -> Int
calc g [s0, s1] =
    let valsum = sum $ map (\[score, d, c] -> score * d + c) s0 in
    let solvesum = sum $ map (\[_, d, _] -> d) s0 in
    solvesum + greedy (g-valsum) (reverse s1)

solve :: Int -> Int -> [[Int]] -> Int
solve d g pc = 
    let sets = split pc in
    let l = map (calc g) sets in
    minimum l


main :: IO ()
main = do
    [d, g] <- map (read :: String -> Int) . words <$> getLine
    pc <- fmap (fmap (read :: String -> Int) . words) . lines <$> getContents
    print $ solve d g $ zipWith (:) [100, 200..] pc

Measured memory_bytes: 892
from collections import defaultdict, deque
import sys

INF = float('inf')
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


n = I()
s = S()
ans = ''
for c in s:
    if ord(c) + n > ord('Z'):
        ans += chr((ord(c) + n) - ord('Z') + ord('A') - 1)
    else:
        ans += chr(ord(c) + n)
print(ans)


Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;
  if(a==0) cout<<1<<endl;
  else if(b==0) cout<<2<<endl;
  
 else   if(c==0) cout<<3<<endl;
    
else if(d==0) cout<<4<<endl;

else if(e==0) cout<<5<<endl;

}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();

		int[] array = new int[w];
		for(int i = 0; i < w; i++){
			array[i] = i + 1;
		}
		for(int i = 0; i < n; i++){
			String[] split = sc.next().split(",", 0);
			int a = Integer.valueOf(split[0]) - 1;
			int b = Integer.valueOf(split[1]) - 1;
			int tmp = array[a];
			array[a] = array[b];
			array[b] = tmp;
		}

		for(int i = 0; i < w; i++){
			System.out.println(array[i]);
		}

	}
}

Measured memory_bytes: 26260
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        while(true){
            int n = sc.nextInt();
            int x = sc.nextInt();
            int count=0;

            if(n==0 && x==0){break;}
            for(int i=1;i<=n-2;i++){
                for(int j=i+1;j<=n-1;j++){
                    for(int k=j+1;k<=n;k++){
                        if(i+j+k==x) count++;
                    }
                }

            }
            System.out.println(count);

        }
    }
}


Measured memory_bytes: 26360
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-03-24 15:13:00
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

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

  string s; cin >> s;
  int n = s.size();
  int cnt = 0;

  for (int i = 0; i < n - 1; ++i) {
    cnt += s[i] != s[i + 1];
  }

  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(),(v).end()
#define out(a) cout << (a) << endl
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    vector<int> vec(n);
    rep(i, n) cin >> vec[i];
    sort(all(vec));
    int sum = 0;
    rep(i, n){
        sum += vec[i];
    }
    if (sum % 10 != 0){
        out(sum);
        return 0;
    }
    for (int i=0; i<n; i++){
        if (vec[i] % 10 != 0){
            sum -= vec[i];
        }
        if (sum % 10 != 0){
            break;
        }
    }
    if (sum % 10 != 0){
        out(sum);
    }
    else out(0);
    return 0;
}

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

typedef long long ll;

int main() {
    int n;
    ll x;
    cin >> n >> x;
    ll r = 0;
    vector<ll> as(n);
    for(int i=0; i<n; i++){
        cin >> as[i];
        r += as[i];
    }

    for(int magic=1;;magic++) {
        bool out = true;
        ll tmp = 0;
        ll last = as[n-1];
        for(int i=n-1; i>0; i--) {
            if(as[i-1]<as[i]) {
                as[i] = as[i-1];
                out = false;
            }
            tmp += as[i];
        }
        if(last<as[0]) {
            as[0] = last;
            out = false;
        }
        tmp += as[0];
        if(r<tmp) break;
        r = min(r, tmp + x * magic);
        if(out) break;
    }
    cout << r << endl;

}

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

typedef long long int ll;

ll ans = 0;


int main()
{
    ll k;
    cin >> k;
    queue<string> s;
    for(ll i = 1;i < 10;i++){
        string ts;
        ts.push_back('0' + i);
        s.push(ts);
        ans++;
        if(ans == k){
            cout << ts;
            return 0;
        }
    }
    while(1){
        string ts = s.front();
        s.pop();
        if(ts[ts.size() - 1] - '0' - 1 >= 0){
            ts.push_back(ts[ts.size() - 1] - 1);
            s.push(ts);
            ans++;
            if(ans == k){
                cout << ts;
                return 0;
            }
            ts.pop_back();
        }
        ts.push_back(ts[ts.size() - 1]);
        s.push(ts);
        ans++;
        if(ans == k){
            cout << ts;
            return 0;
        }
        ts.pop_back();
        if(ts[ts.size() - 1] - '0' + 1 < 10){
            ts.push_back(ts[ts.size() - 1] + 1);
            s.push(ts);
            ans++;
            if(ans == k){
                cout << ts;
                return 0;
            }
            ts.pop_back();
        }
    }

    return 0;
}

Measured memory_bytes: 4608
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>
#include <map>

#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define NL << endl
using namespace std;
using ll = long long;
const int INFINT = 1 << 30;
const ll INFLL = 1LL << 60;
const int MOD = 1000000007;
int gcd(int a, int b) {return b ? gcd(b, a%b) : a;}

int main() {

	string s, t;

	cin >> s >> t;

	string a(s);
	vector<string> cand;

	REP(i, a.size()) {
		if (s[i] == '?') a[i] = 'a';
		else a[i] = s[i];
	}


	FOR(i, 0, s.size() - t.size() + 1) {
		string tt(a);
		bool e = true;
		FOR(j, i, i + t.size()) {
			if (s[j] != '?' && s[j] != t[j - i]) {
				e = false;
				break;
			}
			tt[j] = t[j - i];
		}
		if (e) cand.push_back(tt);
	}
	if(cand.empty())
		cout << "UNRESTORABLE" NL;
	else {
		sort(cand.begin(), cand.end());
		cout << cand[0] NL;
	}

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
using namespace std;
vector<string> arr;


int main()
{
	// your code goes here
  string s;
  cin>>s;
  int win=0;
  for(int i=0;i<s.length();i++)
  {
    if(s[i]=='x') win++;
  }
  if(win>7) cout<<"NO"<<endl;
  else cout<<"YES"<<endl;
  /*int t;
  cin>>t;
  while(t--)
  {
    int n;
    cin>>n;
    int z;
    stringstream geek(arr[n-1]);
    geek>>z;
    cout<<z<<endl;
  }

  /*for(int o=0;o<arr.size();o++)
  {
    stringstream geek(arr[o]);
    int xyz;
    geek>>xyz;
    cout<<xyz<<endl;
  }*/


	return 0;
}


Measured memory_bytes: 256
import sys
N, M = map(int, input().split())
k = []
s = []
for _ in range(M):
    input_list = list(map(int, sys.stdin.readline().split()))
    k.append(input_list[0])
    s.append(input_list[1:])
p = list(map(int, sys.stdin.readline().split()))

count = 0
for i in range(2 ** N):
    bin_str = format(i, 'b')
    if len(bin_str) < N:
        bin_str = '0' * (N - len(bin_str)) + bin_str
    bool = True
    for j in range(M):
        switch_count = 0
        for S in s[j]:
            if int(bin_str[S - 1]) == 1:
                switch_count += 1
        if switch_count % 2 != p[j]:
            bool = False
            break
    if bool:
        count += 1

print(count)

Measured memory_bytes: 3064
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int k = sc.nextInt();
        int maxAB = Math.max(a,b);
        int count = 0;
        int arrayCountAB = 0;

        for(int i = 1; i <= maxAB; i++){
            if(a % i == 0 && b % i == 0){
                count++;
            }
        }

        Integer[] divisorAB = new Integer[count];

        for(int i = 1; i <= maxAB; i++){
            if(a % i == 0 && b % i == 0){
                divisorAB[arrayCountAB] = i;
                arrayCountAB++;
            }
        }

        Arrays.sort(divisorAB,Collections.reverseOrder());

        System.out.println(divisorAB[k-1]);

    }
}

Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <algorithm>
using  namespace std;
int main(){
    int n,time;
    cin>>n>>time;
    vector< vector<int> > c (n, vector<int>(2) );
    for(int i=0;i<n;i++){
        cin>>c[i][0]>>c[i][1];
    }
    sort(c.begin(), c.end());
    for(int i=0;i<n;i++) {
        if (c[i][1] <= time) {
            cout << c[i][0] << endl;
            break;
        }
        if(i==n-1)cout<<"TLE"<<endl;
    }
    return 0;
}

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

void Main() {
	string S, T;
	cin >> S >> T;
	if ((T.length() - S.length()) == 1
		&& (T.substr(0, T.length() - 1) == S)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}
int main() {
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF = 1e9;
const int MOD = 1000000007;
 
int main() {
        string s,t;
        cin >> s >> t;
        map<char,vector<ll>> mp;
        rep(i,s.size()) mp[s[i]].push_back(i);
        

        ll ans = 0;
        ll before = s.size() - 1;
        bool ok = true;
        rep(i,t.size()){
                if(mp[t[i]].size() == 0){
                        ok = false;
                        break;
                }
                int idx = upper_bound(mp[t[i]].begin(),mp[t[i]].end(),before) - mp[t[i]].begin();
                if(idx == mp[t[i]].size()){
                        ans += mp[t[i]][0] + 1 + (s.size() - 1 - before); 
                        before = mp[t[i]][0];
                }else{
                        ans += mp[t[i]][idx] - before;
                        before = mp[t[i]][idx];
                }
        } 
        if(ok) cout << ans << endl;
        else cout << -1 << endl;
        return 0;
}




Measured memory_bytes: 1728
#include <bits/stdc++.h>
#define inf 10000000
using namespace std;
typedef long long int ll;

int main(){

    int N,i,j=0,b=0;
    cin >> N;
    int a[N];

    for(i=0 ; i<N ; i++){
        cin >> a[i];
    }

    for(i=0 ; i<N ; i++){
        if(a[i]%2 == 0){
            j++;
        }
    }

    if(j == N){
        cout << "second" << endl;
    }else{
        cout << "first" << endl;
    }
}

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

int main(){
  
  string s;
  string weather[3];
  
  weather[0] = "Sunny";
  weather[1] = "Cloudy";
  weather[2] = "Rainy";
    
  cin >> s;
  if(s=="Sunny"){
    cout << weather[1] << endl;
  }
  if(s=="Cloudy"){
    cout << "Rainy" << endl;
  }
  if(s=="Rainy"){
    cout << "Sunny" << endl;
  }
  
  return 0;
}
  
  
  
    





Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int sum = a + b;
    int div = a - b;
    int mul = a * b;
    int ans;
    if (sum >= div && sum >= mul) {
      ans = sum;
    } else if (div >= mul) {
      ans = div;
    } else {
      ans = mul;
    }
    System.out.println(ans);
  }
}


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

ll s, c;

int main() {
    cin >> s >> c;
    ll ans;
    if (s >= c/2) ans = c/2;
    else{ //s < c/2
        ans += s;
        c -= s*2;
        ans += c/4;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int N;
    std::cin >> N;
    std::string s[N],X;
    int t[N];
    int Ans=0;
    
    for(int i=0;i<N;++i){
        std::cin >> s[i] >> t[i];
        Ans+=t[i];
    }
    
    std::cin >> X;
    
    for(int i=0;i<N;++i){
        if(s[i]==X){
            Ans-=t[i];
            break;
        } else {
            Ans-=t[i];
        }
    }
    
    std::cout << Ans << std::endl;
    
    return 0;
}

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

int main() {
	int n ;
	cin >> n ;
	double a[n+1] , b[n+1][n+1] = {0} ;
	for(int i = 1 ; i <= n ; i++)
		cin >> a[i];
	b[1][0] = 1-a[1] ;
	b[1][1] = a[1] ;
	for(int i = 2 ; i<= n ; i++)
		for(int j = 0 ; j <= i ; j++)
		{
			if(j==0)
				b[i][j] = 1-a[i];
			if(i==j)
				b[i][j] = b[i-1][j-1]*a[i];
			else
				b[i][j] = b[i-1][j]*(1-a[i]) + b[i-1][j-1]*a[i];
		}
	double ans = 0;
	for(int i = n/2+1 ; i<= n ; i++)
		ans+=b[n][i];
	cout << std::setprecision(10) << ans;
	return 0;
}

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

#ifdef _DEBUG
#define dout cout
#define debug() if (true)
#define dvout(v) vout(v)
#else
#define dout if (false) cout
#define debug() if (false)
#define dvout(v) if(false) vout(v)
#endif

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define vout(v)           \
	for (auto &i : v)     \
	{                     \
		cout << i << " "; \
	}                     \
	cout << "\n"; //配列出力
#define vec(v, n) vector<int> v(n, 0);
#define vecll(v, n) vector<ll> v(n, 0);
#define vecvec(v,n,m) vector<vector<int>> v(n, vector<int>(m));
#define vin(v)        \
	for (auto &i : v) \
		cin >> i; //配列入力

#define mod (int)(1e9+7)
typedef long long ll;
typedef unsigned long long ull;
#define next asdnext
#define prev asdprev
#define _n "\n"
#define _n2 "\n\n"
#define _t "\t"

//	LLONG_MAX 9.2*1e18	9223372036854775807LL = (2^63)-1
//	INT_MAX 2.1*1e9 2147483647 = (2^31)-1
//	O(1e8) 1.2sec

void Main()
{
	int X;
	cin>>X;
	if(X>=30)cout<<"Yes"<<_n;
	else cout<<"No"<<_n;
}


void Test();
int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << std::fixed << std::setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int N,M,A[1100],B[1100],mx,num,Ac[1100];
int main(){
	cin>>N>>M;
	for(int i=1;i<=N;i++){
		cin>>A[i];
	}
	for(int i=1;i<=M;i++){
		cin>>B[i];
	}
	for(int i=1;i<=M;i++){
		for(int j=1;j<=N;j++){
			if(A[j]<=B[i]){
				Ac[j]++;
				break;
			}
		}
	}
	for(int i=1;i<=N;i++){
		if(mx<Ac[i]){
			num=i;
			mx=Ac[i];
		}
	}
	cout<<num<<endl;
	return 0;
}

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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))

using namespace std;

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

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


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

    ll N;
    cin >> N;

    ll base = N;
    ll cnt=0;

    ll div = 10;
    while(div<=N)
    {
        cnt+=base/div;
        div*=5;
    }

    

    if(N%2!=0)
    {
        cout << 0 << endl;
    }
    else
    {
        

        cout << cnt << endl;



    }
    
    

 

 

    return 0;
}
 

//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find



Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;


void main() {
    int N, x;
    scan(N, x);
    auto a = readln.split.to!(int[]);

    auto dp = new int[][](N, N);
    foreach (i ; 0 .. N) {
        dp[0][i] = a[i];
    }

    foreach (k ; 1 .. N) {
        foreach (i ; 0 .. N) {
            dp[k][i] = min(a[(i - k + N) % N], dp[k - 1][i]);
        }
    }

    debug {
        writefln("%(%s\n%)", dp);
    }

    long ans = infl;

    long solve(int k) {
        long res = 1L * k * x;

        foreach (i ; 0 .. N) {
            res += dp[k][i];
        }

        return res;
    }

    foreach (k ; 0 .. N) {
        chmin(ans, solve(k));
    }

    writeln(ans);
}



void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


Measured memory_bytes: 18428
coin = [10,50,100,500,999999]
J = True
while True:
    n = int(input())
    if n == 0:
        break
    else:
        if not J:
            print()
        else:
            J = False
        L = list(map(int,input().split()))
        S = 10*L[0]+50*L[1]+100*L[2]+500*L[3]
        res = S-n #とりあえず硬貨を全部使ったものと仮定する
        change = [res%coin[i+1]//coin[i] for i in range(4)] #ここでお釣りとしてどの硬貨が何枚戻ってくるかを計算している
        
        for i in range(4):
            if change[i] < L[i]: #お釣りとして戻ってくる枚数の方が少なければ採用
                print(coin[i],L[i]-change[i])


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

int main() {
  
  int numStones;
  cin >> numStones;
  int K;
  cin >> K;
  vector<int> heights(numStones);
  for(int& height : heights) {
      cin >> height;
  }
  vector<int> costs(numStones, INT_MAX);
  costs[0] = 0;

  for(int i = 1; i < costs.size(); i++) {
  	int step = K;
  	for(int j = i-1; j >= 0 && step > 0; j--, step--) {
      costs[i] = min(costs[i], costs[j] + abs(heights[i] - heights[j]));
    }
  }

  cout << costs[costs.size()-1];

  return 0;
}


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

dup = sum(a) - n * (n + 1) // 2
d1 = a.index(dup)
d2 = a.index(dup, d1 + 1)

N = n + 1
Ndup = d1 + n - d2

MOD = 10 ** 9 + 7

# inv[k]: kの逆元
inv = [0 for i in range(N + 1)]
inv[1] = 1
for i in range(2, N + 1):
    inv[i] = (-(MOD // i) * inv[MOD % i]) % MOD

C = N
Cdup = 1
print(N - 1)
for k in range(2, N + 1):
    C = (C * (N - k + 1) * inv[k]) % MOD
    Cdup = (Cdup * (Ndup - k + 2) * inv[k - 1]) % MOD
    print((C - Cdup) % MOD)


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

void swap(int& a, int& b) {
	int x = a;
	a = b;
	b = x;
}

int main(){
	int first = 0;
	int second = 0;
	int third = 0;

	for(int i = 0; i < 10; ++i) {
		int x;
		cin >> x;
		if(third <= x)		third = x;
		if(second <= third)	swap(second, third);
		if(first <= second)	swap(first, second);
	}
	printf("%d\n%d\n%d\n", first, second, third);

	return 0;
}

Measured memory_bytes: 3104
n,k = map(int,input().strip().split())
ls = [0]*n
for _ in range(k):
    d = int(input())
    temp = list(map(int,input().strip().split()))
    for val in temp:
        ls[val-1] = 1
c = 0
for val in ls:
    if val==0:
        c += 1
print(c)


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

using namespace std;

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

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int a, b; cin >> a >> b;
    cout << (a + b) % 24 << endl;
}


Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())

c = 0
for i in range(A + 1):
    if 500 * i > X:
        break
    for j in range(B + 1):
        if 500 * i + 100 * j > X:
            break
        K = X - 500 * i - 100 * j
        if K % 50 == 0:
            k = K / 50
            if k <= C:
                c += 1
print(c)


Measured memory_bytes: 9148
#include<stdio.h>
#include<cstring>
#include<cstdlib>
main()
{
	char a[100001];
	int l,i;
	scanf("%s",a);
	l=strlen(a);
	for(i=0;i<=l;i++)
		if(a[i]=='C')
			for(int j=i+1;j<=l;j++)
				if(a[j]=='F')
				{
					printf("Yes");
					exit(0);
				}
	printf("No");
}

Measured memory_bytes: 128
import java.io.*;
import java.util.*;

public class Main{
    static MyReader in = new MyReader();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args){
        int[] A = in.ii();
        out.println(A[0]+A[1]+A[2] >= 22 ? "bust" : "win");
        out.flush();
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        ArrayList<Integer> li(){
            String[] ss = ss();
            ArrayList<Integer> li = new ArrayList<>();
            for(int j = 0; j < ss.length; j++) li.add(Integer.parseInt(ss[j]));
            return li;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
typedef long long ll;

int main()
{
    string s;
    int n;
    cin >> n >> s;
    for(int i = 0; i < s.size(); ++i) {
        s[i] = (s[i] - 'A' + n) % 26 + 'A';
    }
    cout << s << endl;
    return 0;
}

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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		System.out.println(fib(n));
	}
	public static int fib(int n) {
		if(n < 2){
			return 1;
		}else{
			int a = 1;
			int b = 1;
			int c = 0;
			for(int i = 2; i <= n; ++i) {
				c = a + b;
				a = b;
				b = c;
			}
			return c;
		}
	}
}

Measured memory_bytes: 24064
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N, A, B = map(int, input().split())

ans = 0
for i in range(1, N+1):
    sum_ = sum(map(int, list(str(i))))
    if A <= sum_ <= B:
        ans += i
print(ans)

Measured memory_bytes: 9204
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor

import heapq
import itertools
import operator


inf = float('inf')


def get_int():
    return int(input())


def get_str():
    return input().strip()


def get_list_of_int():
    return [int(i) for i in input().split()]


def get_char_list():
    return list(input().strip())


# inputs
N, W = 0, 0
Ws, Vs = [0], [0]


def set_inputs():
    global N, W, Ws, Vs
    N, W = get_list_of_int()
    ws, vs = [], []
    for _ in range(N):
        w, v = get_list_of_int()
        ws.append(w)
        vs.append(v)
    Ws, Vs = ws, vs


def main():
    set_inputs()
    values = [0] * (W + 1)
    items = [0] * (W + 1)
    for w in range(1, W + 1):
        values[w], items[w] = max((values[w - Ws[i]] + Vs[i], items[w - Ws[i]] | 1 << i) if w - Ws[i] >= 0 and (items[w - Ws[i]] & 1 << i) == 0 else (values[w-1], items[w-1]) for i in range(N))
    print(values[W])


if __name__ == '__main__':
    main()


Measured memory_bytes: 61020
#include <iostream>  
#include <cstdio>  
#include <cstring>  
#include <algorithm>  
  
using namespace std;  
const int maxn=2e5+100;  
int par[maxn],sum[maxn];  
int N,K,p,tot;  
  
void init(int n)  
{  
    for(int i=0;i<=n;i++)  
        par[i]=i;  
}  
  
int find(int x)  
{  
    if(par[x]==x)  
        return x;  
    return par[x]=find(par[x]);  
}  
void unit(int x,int y)  
{  
    int fx=find(x),fy=find(y);  
    if(fx!=fy)  
        par[fx]=fy;  
}  
bool same(int x,int y)  
{  
    return find(x)==find(y);  
}  
int main()  
{  
    while(~scanf("%d%d",&N,&K))  
    {  
        int ans=0;  
        memset(sum,0,sizeof(sum));  
        memset(par,0,sizeof(par));  
        tot=0;  
        init(N);  
        int t;  
        scanf("%d",&t);  
        sum[t]++;  
        p=t;  
        tot++;  
        for(int i=2;i<=N;i++)  
        {  
            scanf("%d",&t);  
            sum[t]++;  
            if(!same(t,p))  
            {  
                tot++;  
                unit(t,p);  
            }  
        }  
        sort(sum,sum+N+1);  
        if(tot<=K)  
            ans=0;  
        else  
        {  
            int cnt=tot-K;  
            int pos=lower_bound(sum,sum+N+1,1)-sum;  
            while(cnt--)  
                ans+=sum[pos++];         
        }  
        printf("%d\n",ans);  
    }  
    return 0;  
}  

Measured memory_bytes: 1792
int main() {
	int n, a, b, c, p;
	int Z[10000];
	c = 0;

	scanf("%d", &n);

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

	for (a = 0;a < n;a++) {
		b = 1;
		for (p = 2;p <= sqrt(Z[a]) && b != 0;p++) {
			b = Z[a] % p;
			if (b == 0) c++;
		}
	}

	printf("%d\n", n - c);

	return 0;
}

Measured memory_bytes: 1776
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]

count = 0
for A in A:
    ans = C
    for a, b in zip(A, B):
        ans += a * b
    if ans > 0:
        count += 1
print(count)

Measured memory_bytes: 9196
#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int M=2147483647;
int a[400010];
int f(int x,int y,int i,int l,int r){
  if(r<=x||y<=l)return M;
  if(x<=l&&r<=y)return a[i];
  return MIN(f(x,y,i*2,l,(l+r)/2),f(x,y,i*2+1,(l+r)/2,r));
}  
int main(){
  int n,t,q,x,y,i,m;
  scanf("%d %d",&n,&m);
  for(t=1;t<n;t*=2);
  for(i=1;i<t*2;i++)a[i]=M;
  while(m--){
    scanf("%d %d %d",&q,&x,&y);
    if(q)printf("%d\n",f(x,y+1,1,0,t));
    else{
      x+=t;
      for(a[x]=y;x-1;x/=2)a[x/2]=MIN(a[x],a[x^1]);
    }
  }
  return 0;
}

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

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

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

  vector<P> v(n);
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;

    P ab(a, b);
    v[i] = ab;
  }

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

  ll ans = -1;
  for (int i = 0; i < n; i++) {
    ll a = v[i].first;
    ll b = v[i].second;

    k -= b;

    if (k > 0) {
      continue;
    } else {
      ans = a;
      break;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792