akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int n, a, b;
string s;

int main(void) {
	cin >> n >> a >> b;
	cin >> s;
	int la = 0, lb = 0;
	string ret;
	for (int i = 0; i < n; i++) {
		char c = s[i];
		if (c == 'a') {
			if (la + lb < a + b) {
				ret = "Yes";
				la++;
			}
			else
				ret = "No";
		}
		else if (c == 'b') {
			if (la + lb < a + b) {
				if (lb < b) {
					ret = "Yes";
					lb++;
				}
				else
					ret = "No";
			}
			else
				ret = "No";
		}
		else {
			ret = "No";
		}
		cout << ret << endl;
	}
	return 0;
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    ll n, k, s;
    cin >> n >> k >> s;

    REP(i, n){
        if(i < k){
            cout << s << " ";
        }else{
            cout << (s == inf ? 1 : s + 1) << " ";
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define ll long long
#define f(i, x, n) for(int i = x; i < n; i++)
#define dbg(x) cout << x << endl
#define dbg2(x, y) cout << x << "  " << y << endl
#define dbg3(x, y, z) cout << x << "  " << y << "  " << z << endl
#define mod 1000000007
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    ll n;
    cin >> n;
    ll sum = (n * (n+1))/2;
    f(i, 0, n){
        f(j, i+1, n){
            sum += 6 * __gcd(i+1, j+1);
        }
    }
    f(i, 0, n){
        f(j, i+1, n){
            f(k, j+1, n){
                sum += 6 *__gcd(__gcd(i+1, j+1), k+1);
            }
        }
    }
    cout << sum << endl;
}

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

int main(int argc, char const *argv[])
{
	int n;
	int a[205];
	cin >> n;
	for (int i = 0; i < 2*n; ++i)
	{
		cin >> a[i];
	}
	sort(a,a+2*n);
	int sum=0;
	for (int i = 0; i < 2*n; i=i+2)
	{
		sum += a[i];
	}
	printf("%d\n", sum);
	return 0;
}

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

void dfs(int u, vector<vector<int> >& G, int& t, vector<int>& ord, vector<int>& low, int& k, vector<int>& cmp, stack<int>& s) {
	ord[u] = low[u] = t++;
	s.push(u);
	for (int v: G[u]) {
		if (ord[v] == -1) {
			dfs(v, G, t, ord, low, k, cmp, s);
			low[u] = min(low[u], low[v]);
		}
		else if (cmp[v] == -1)
			low[u] = min(low[u], ord[v]);
	}
	if (ord[u] == low[u]) {
		for (;;) {
			int v = s.top(); s.pop();
			cmp[v] = k;
			if (v == u) break;
		}
		k++;
	}
}

vector<int> scc(vector<vector<int> >& G) {
	int N = G.size(), t = 0, k = 0;
	vector<int> ord(N, -1), low(N), cmp(N, -1);
	stack<int> s;
	for (int u = 0; u < N; u++)
		if (ord[u] == -1)
			dfs(u, G, t, ord, low, k, cmp, s);
	return cmp;
}

int main() {
	int N; cin >> N;
	vector<vector<int> > G(N);
	int M; cin >> M;
	while (M--) {
		int u, v; scanf("%d%d", &u, &v);
		G[u].push_back(v);
	}
	vector<int> cmp = scc(G);
	int Q; cin >> Q;
	while (Q--) {
		int u, v; scanf("%d%d", &u, &v);
		printf("%d\n", cmp[u] == cmp[v]);
	}
}

Measured memory_bytes: 4932
#include<bits/stdc++.h>
#define ll long long int
#define vll vector<ll>
using namespace std;

int main(){
    ios_base::sync_with_stdio(true);
    cin.tie(NULL);
    ll n, a;
    cin >> n;
    vll x;
    for(ll i=0; i<n-1; i++){
        cin >> a;
        x.push_back(a);
    }
    ll ans = x[0] + x[n-2];
    for(ll i=1; i<n-1; i++){
        ans += min(x[i], x[i-1]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	d := getNextInt64(scanner)
	var ans int
	for i := 0; i < n; i++ {
		x := getNextInt64(scanner)
		y := getNextInt64(scanner)
		if x*x+y*y <= d*d {
			ans++
		}
	}
	fmt.Fprintln(writer, ans)
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>


int main(){
    string s,t; cin>>s>>t;
    bool ok = false;
    if(s.size()+1==t.size() && s==t.substr(0,t.size()-1) ){ok =true;}
    
    cout << (ok?Liny:Linn);
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_set>
#include <bitset>
#include <time.h>
#include <limits.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) (int)x.size()
#define sz(x) (int)x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
typedef tuple<int, int, int> t3;

int main() {
	ll N, K; scanf("%lld%lld", &N, &K);
	if(K <= (N + 1) / 2) {
		puts("YES");
	}
	else puts("NO");
	return 0;
}


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

using namespace std;

int main() {
    int N, M, C;
    cin >> N >> M >> C;
    vector<int> B(M);
    for(int j=0; j<M; j++) {
        cin >> B.at(j);
    }
    vector<vector<int>> A(N, vector<int> (M));
    for(int i=0; i<N; i++) {
        for(int j=0; j<M; j++) {
            cin >> A.at(i).at(j);
        }
    }
    int count = 0;
    for(int i=0; i<N; i++) {
        int sum = C;
        for(int j=0; j<M; j++) {
            sum += A.at(i).at(j) * B.at(j);
        }
        if (sum > 0) count++;
    }
    
    cout << count << endl;
}

Measured memory_bytes: 3580
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<stack>
#include<queue>
#include<map>
#include<cstring>
#include<functional>

#define MOD 1000000007

using namespace std;

int main()
{
	//freopen("input.txt", "r", stdin);

	int n;
	long long cur = 0;
	long long sol = 0;

	scanf("%d", &n);

	for (int i = 0; i < n; i++)
	{
		long long input;

		scanf("%lld", &input);

		sol = (sol + input*cur%MOD) % MOD;

		cur = (cur + input) % MOD;
	}

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

	return 0;
}

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

int main(){
  int64_t N, A, B;
  cin >> N >> A >> B;
  int64_t sho, amari;
  sho = N / (A + B);
  amari = N % (A + B);
  int64_t amari_dash;
  if (amari > A) amari_dash = A;
  else amari_dash = amari;
  cout << sho * A + amari_dash;
}

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

public class Main{

	static class FastReader{ 
		BufferedReader br; 
		StringTokenizer st; 

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

		String next() 
		{ 
			while (st == null || !st.hasMoreElements()) 
			{ 
				try
				{ 
					st = new StringTokenizer(br.readLine()); 
				} 
				catch (IOException e) 
				{ 
					e.printStackTrace(); 
				} 
			} 
			return st.nextToken(); 
		} 

		int nextInt() 
		{ 
			return Integer.parseInt(next()); 
		} 

		long nextLong() 
		{ 
			return Long.parseLong(next()); 
		} 

		double nextDouble() 
		{ 
			return Double.parseDouble(next()); 
		} 

		String nextLine() 
		{ 
			String str = ""; 
			try
			{ 
				str = br.readLine(); 
			} 
			catch (IOException e) 
			{ 
				e.printStackTrace(); 
			} 
			return str; 
		} 
	}

	static boolean check(long n, long s){
		long sum=0, num=n;
		
		while(n>0){
			sum += (n%10);
			n/=10;
		}


		return ((num-sum)<s);


	} 

	static long find(long start, long end, long s){
		
		while(start<end){
			
			long mid = (start+end)/2;
			System.out.println(mid+" "+s+" "+check(mid, s));

			if(check(mid, s)){
				start = mid+1;
			}else{
				end = mid;
			}

		}

		return end-1;
	}

	public static void main(String[] args) 
	{ 
		FastReader sc = new FastReader(); 
		int a = sc.nextInt();
      	int b = sc.nextInt();
      	int c = sc.nextInt();
		System.out.println(c-Math.min(c, a-b)); 
	} 
} 


Measured memory_bytes: 22996
import math as m
 
def main():
    l = map(int,raw_input().split())

    ans = min([
        case(l,0,1,2), 
        case(l,1,2,0),
        case(l,2,0,1),
    ])
    print ans
    
def case(l,a,b,c):
    if l[c] % 2 == 0:
        return 0
    else:
        return l[a] * l[b]
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 2568
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int a,b,x;
    cin >> a >> b >> x;
    if(x >= a && x <= a+b){
        cout << "YES" << endl;
    }
    else 
        cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*
fun main(args: Array<String>) {

    val sc = Scanner(System.`in`)
    val N = sc.nextLong()
    val a = sc.nextLong()
    val b = sc.nextLong()
    val c = sc.nextLong()
    val d = sc.nextLong()
    val e = sc.nextLong()
    var num = N
    val list = longArrayOf(a,b,c,d,e)
    val min = list.min()!!
    var ans = (N-1)/min + 5
    println(ans)
}


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

// Optimization

//#pragma GCC optimize("O3")
#define endl '\n'

// Shortcut

#define int long long
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) Fora(iiii, a) cout << iiii << ' '; cout << endl;
#define PrintVl(a) Fora(iiii, a) cout << iiii << endl;
#define PrintA(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << ' '; cout << endl;
#define PrintAl(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a))
#define mset1(a) memset(a, 1, sizeof(a))
#define msetn1(a) memset(a, -1, sizeof(a))
#define msetinf(a) memset(a, 0x3f, sizeof(a))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
#define y0 _y0_
#define y1 _y1_
#define div divi
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 2e5 + 5;
int mod = 1e9 + 7, mod1 = 998244353, mod2 = 1e9 + 9, inf = 1e9 + 7;
ll infll = 1e18 + 7;

bool a[N];

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int k, n; cin >> k >> n;
    ForE(i, 1, n){
        int x; cin >> x;
        a[x] = 1;
    }
    if (!a[k]) Ptest(k);
    ForE(i, 1, N){
        if (k - i < 0 || !a[k - i]) Ptest(k - i);
        if (!a[k + i]) Ptest(k + i);
    }
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/


Measured memory_bytes: 3648
// copied by Nurstan Duisengaliev
#include <bits/stdc++.h>
 
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define mp make_pair
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <int, int>
#define boost() ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) x.size()
 
using namespace std;
 
const int N = (int)2e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
int cnt[N];
void solve () {
	string a;
	cin >> a;
	for (int i = 0; i < a.size(); i ++) cnt[a[i]] ++;
	ll sum = 0;
	for (int i = 0; i < a.size(); i ++) {		
		cnt[a[i]] --;
		sum += ((int)a.size() - 1 - i - cnt[a[i]]); 
	}
	cout << sum + 1;
}
 
main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	boost ();
	int TT = 1;
//  cin >> TT;
	while (TT --) {
		solve ();
	}
	return 0;	
}

Measured memory_bytes: 720
from sys import stdin
from bisect import bisect_left

def solve():
    n = int(stdin.readline())
    A = [int(stdin.readline()) for i in range(n)]

    inf = 10**9 + 1
    dp = [inf] * n

    for a in A:
        j = bisect_left(dp, a)
        dp[j] = a

    for i, v in enumerate(dp):
        if v == inf:
            print(i)
            return

    print(n)

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

if __name__ == '__main__':
    solve()

Measured memory_bytes: 12464
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

    int N; cin >> N;
    int cnt1 = 0, cnt2 = 0, cnt4 = 0;
    vel a(N); 
    rep(i,N) {
        cin >> a[i];
        if(a[i] % 2 == 1) cnt1++;
        else if (a[i] % 4 == 0) cnt4++;
        else cnt2++;
    }

    if(N % 2 == 1) {
        if(cnt1 > cnt4+1 ) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    else {
        if(cnt1 > cnt4) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    return 0;
}



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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

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

    int p[n];
    rep(0, n) cin >> p[i];

    int cnt = 0;
    rep(0, n - 2) {
        if (p[i] < p[i+1] && p[i+1] < p[i+2]) cnt++;
        if (p[i] > p[i+1] && p[i+1] > p[i+2]) cnt++;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn.readLine

object Main extends App {
  def gcd(x:Int,y:Int,cnt:Int):String = if(y>0) { if(x>=y) gcd(y,x%y,cnt+1) else gcd(x,y%x,cnt+1) } else x + " " + cnt

  var s = "0 0"
  while( {s=readLine.trim;s} != "0 0" ){
    val n = s.split(" ").map(_.toInt);val x = n(0);val y = n(1)
    println(gcd(x,y,0))
  }
}

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

int main() {

  int N,K;
  cin >> N >> K;
  int sum = 0;
  for (int i = 1; i <= N; i++) {
  	int x = 0;
  	cin >> x;
  	if(x < K - x)
  	{
  		sum += x * 2;
  	}
  	else
  	{
  		sum += (K - x) * 2;
  	}
  }
  cout << sum << endl;
}


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

int main(){
    int N,M,X,Y;
    cin >> N >> M >> X >> Y;
    int A[101];
    int B[101];
    for(int i=0;i<N;++i) cin >> A[i];
    for(int i=0;i<M;++i) cin >> B[i];
    sort(A,A+N,greater<int>());
    sort(B,B+M);
    if(max(X,A[0])<min(Y,B[0])){
        cout <<"No War" << endl;
    }
    else cout << "War" << endl;
 }


Measured memory_bytes: 256
def cin():
	return map(int,input().split())

def cino(test=False):
    if not test:
        return int(input())
    else:
        return input()
def cina():
  return list(map(int,input().split()))


s = cino(True)
s+='A'
s = list(s)
cnt = -1
for i in range(len(s)-1):
    if s[i+1]!=s[i]:
        cnt += 1
print(cnt)


Measured memory_bytes: 3956
from itertools import accumulate

N = int(input())
lst = list(map(int, input().split()))

cumsum = list(accumulate(lst))

mi = 2 * 10 ** 9
su = cumsum[-1]
for i in range(len(cumsum)-1):
  mi = min(mi, abs(cumsum[i] - (su-cumsum[i])))
print(mi)

Measured memory_bytes: 86736
#高速化heapqダイクストラ
from collections import *
from heapq import*
import sys
input=lambda:sys.stdin.readline()


def BFS(point,d):
    cost=[1e7]*(n+1)
    cost[point]=0
    Q=[]
    heappush(Q,(0,point))
    
    while Q:
        c,p=heappop(Q)
        for np in d[p]:
            if cost[np]==1e7:
                cost[np]=c+1
                heappush(Q,(c+1,np))
    return cost

n=int(input())
d={}
for i in range(n-1):
    a,b=map(int,input().split())
    if a in d:
        d[a].append(b)
    else:
        d[a]=[b]
    if b in d:
        d[b].append(a)
    else:
        d[b]=[a]
        
x=BFS(1,d)[1:]
y=BFS(n,d)[1:]

#print(x,y)

F=0
S=0

for s,t in zip(x,y):
    if s<=t:
        F+=1
    else:
        S+=1

if F<=S:
    print("Snuke")
else:
    print("Fennec")


Measured memory_bytes: 106332
# 146A

S = input()

if S == 'SUN':
    print(7)
elif S == 'MON':
    print(6)
elif S == 'TUE':
    print(5)
elif S == 'WED':
    print(4)
elif S == 'THU':
    print(3)
elif S == 'FRI':
    print(2)
else:
    print(1)

Measured memory_bytes: 8832
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    ll n, k; cin >> n >> k;
    if (n % k == 0) cout << 0 << endl;
    else cout << 1 << endl;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const double eps = 1e-8;
const ll INF = 2000000000;

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

ll sad(vector<ll> &A, ll b) {
    ll ret = 0;
    for (int i=0; i<(int)A.size(); ++i) {
        ret += abs(A[i] - (b+i+1));
    }
    return ret;
}

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i=0; i<N; ++i) cin >> A[i];
    
    ll l = -INF;
    ll r = INF;
    for (int i=0; i<200; ++i) {
        ll c1 = (2*l+r)/3;
        ll c2 = (l+2*r)/3;
        if (sad(A, c1) > sad(A, c2)) l = c1;
        else r = c2;
    }
    cout << min({sad(A,l), sad(A,l+1), sad(A,r)}) << endl;

    return 0;
}

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

using namespace std;

vector<pair<double, double> > v;

double dist(int i, int j)
{
    double x1 = v[i].first, y1 = v[i].second;
    double x2 = v[j].first, y2 = v[j].second;
    double ans = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
    ans = sqrt(ans);
    return ans;
}

int main()
{
    int n;
    scanf("%d", &n);
    for(int i=0; i<n ; i++){
        double x, y;
        cin >> x >> y;
        v.push_back(make_pair(x, y));
    }
    vector<int> stock;
    for(int i=0; i<n; i++) stock.push_back(i);
    vector<int> temp = stock;
    double tot = 0.0;
    double cnt = 0;
    while(true){
        for(int i=1;i<n; i++){
            tot += dist(temp[i-1], temp[i]);
        }
        cnt = cnt + 1.0;
        next_permutation(temp.begin(), temp.end());
        if(temp == stock) break;
    }
    tot = tot/cnt;
    printf("%0.8f\n", tot);
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int A = int.Parse(input);
            int div_num = 0;
            foreach (char c in input)
            {
                div_num += int.Parse(c.ToString());
            }
            if (A % div_num == 0) { Console.WriteLine("Yes"); }
            if (A % div_num != 0) { Console.WriteLine("No"); }
        }
    }
}


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

using namespace std;

typedef long long ll;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define INF 1000000000

int main() {

	int n;
	cin >> n;
	vector<int> a(n);
	FOR(i, n)cin >> a[i];
	SORT(a);
	cout << a[n - 1] - a[0] << endl;

	return 0;
}


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

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

	string str;
	cin >> str;

	for(int i=1; i<str.length(); i++){
		if(str[i-1]==str[i]){
			cout << i << " " << i+1 << endl;
			return 0;
		}
	}
	for(int i=2; i<str.length(); i++){
		if(str[i-2]==str[i]){
			cout << i-1 << " " << i+1 << endl;
			return 0;
		}
	}
	cout << -1 << " " << -1 << endl;

	return 0;
}


Measured memory_bytes: 512
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

N = int(input())
l = [int(i) for i in input().split()]
l.sort()

lset = set(l)

if N%3 == 0:
    if len(lset) == 1:
        if l[0] == 0:
            print("Yes")
        else:
            print("No")
            
    elif len(lset) == 2:
        k = list(lset)
        k.sort()
        if k[0]^k[1] == k[1] and l[int(N/3)] == k[1] and l[int(N/3 - 1)] == 0:
            print("Yes")
        else:
            print("No")
    
    elif len(lset) == 3:
        k = list(lset)
        k.sort()
        if k[0]^k[1]^k[2] == 0:
            c0 = 0
            c1 = 0
            for i in l:
                if i == k[0]:
                    c0 += 1
                elif i == k[1]:
                    c1 += 1
            if c0 == N/3 and c1 == N/3:
                print("Yes")
            else:
                print("No")
        else:
            print("No")
            
    else:
        print("No")

else:
    if len(lset) == 1:
        if l[0] == 0:
            print("Yes")
        else:
            print("No")
    else:
        print("No")

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

int main() {
    int n, k;
    vector< int > a;

    cin >> n >> k;
    a.resize(n);
    for(int i = 0; i < n; i++)
        cin >> a[i];

    int res = (n - 1) / (k - 1);
    if((n - 1) % (k - 1)) res++;
    cout << res << endl;
}


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

const char symbol[4] = { '.', '?', '!', ' ' };

int main()
{
	std::string s;
	while( std::cin >> s )
	{
		if( s.size() & 1 )
			std::cout << "NA" << std::endl;
		else
		{
			std::string res;
			bool f = true;

			for( int i = 0; i < s.size(); i += 2 )
			{
				if( s[i] < '1' || s[i] > '6' || s[i+1] < '1' || s[i+1] > '5' )
				{
					f = false; 
					break;
				}

				int n = ( s[i] - '1' ) * 5 + s[i+1] -'1';
	
				if( n > 29 )
				{
					f = false;
					break;
				}
				else
					res += n >= 26 ? symbol[n-26] : 'a' + n;
			}

			std::cout << ( f ? res : "NA" ) << std::endl;
		}
	}

	return 0;
}

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

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

  int ans = -1;
  int n = 7;
  for(int i=1;i<=k+1;i++) {
    if(n % k == 0) {
      ans = i;
      break;
    }
    n = (n * 10 + 7) % k;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3620
import java.util.Scanner;
class Main {
    public static void main(String[] args) {

    int A = 0;
    int B = 0;

    Scanner sc = new Scanner(System.in);

    A = sc.nextInt();
    B = sc.nextInt();

    int add = A + B;
    int sub = A - B;
    int C = Math.max(add,sub);

      System.out.println(Math.max(A*B, C));
   }
}

Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/
#define ull            unsigned long long
#define ll             long long
#define vi             vector<int>
#define pb             push_back
#define mp             make_pair
#define pii            pair<int,int>
#define vit            vector<int> :: iterator
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*/
#define error(args...) {vector <string> _v = split(#args, ','); err(_v.begin(), args); cout << endl;}
vector <string> split(const string &s, char c) {
    vector <string> v;
    stringstream ss(s); string x;
    while (getline(ss, x, c)) v.emplace_back(x);
    return move(v);
}
void err(vector <string> :: iterator it) {}
template <typename T, typename... Args>
void err(vector <string> :: iterator it, T a, Args... args) {
    cout << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", ";
    err(++it, args...);
}
 
int ini(){int x; scanf("%d",&x);return x;}
long long inl(){ long long x;scanf("%lld",&x); return x;}
double ind(){double x; scanf("%lf",&x);return x;}
#define Iin ini();
#define Lin inl();
#define Din ind();

int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;

int a[N];

int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
    int t=1,te=0;

    while(t--){
        string s;

        cin>>s;

        if(s=="SUN"){
            cout<<7<<endl;
        }
        if(s=="MON"){
            cout<<6<<endl;
        }
        if(s=="TUE"){
            cout<<5<<endl;
        }
        if(s=="WED"){
            cout<<4<<endl;
        }
        if(s=="THU"){
            cout<<3<<endl;
        }
        if(s=="FRI"){
            cout<<2<<endl;
        }
        if(s=="SAT"){
            cout<<1<<endl;
        }

        //printf("Case %d: ",++te);
    }
    return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  string S;
  cin>>S;
  map<char, int> amap;
  for(int i=0;i<S.size();++i) {
    amap[S[i]]++;
  }
  char ans = 'A';
  for(char a='a';a<='z';++a) {
    if(amap[a]==0) {
      ans = a;
      break;
    }
  }
  if(ans=='A') cout<<"None"<<endl;
  else cout<<ans<<endl;
}



Measured memory_bytes: 3664
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

from itertools import combinations

# Union Find
class UF(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        '''
        x が属するグループを探索
        '''
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        '''
        x と y のグループを結合
        '''
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        '''
        x と y が同じグループか否か
        '''
        return self.find(x) == self.find(y)

    def get_size(self, x):
        '''
        x が属するグループの要素数
        '''
        x = self.find(x)
        return self.size[x]

N,M = LI()
uf = UF(N+M)
for i in range(N):
    kl = LI()
    for l in kl[1:]:
        uf.union(i,N+l-1)

root = uf.find(0)
for i in range(1,N):
    now = uf.find(i)
    if now != root:
        print('NO')
        exit()
print('YES')

Measured memory_bytes: 70660
N = int(input())
S = input()


r = 1
ans = 0
for l in range(N):

    while True:
        #print(S.rfind(S[l:r+1]), S[l:r+1], l, r)

        if S.rfind(S[l:r+1]) >= r+1:
            r += 1
            ans = max(ans, r-l)
        else:
            break

print(ans)


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;
int e[100];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c,d;
  cin >>a>>b;
  for(int n=0;n<b;n++){
    cin >>c>>d;
    e[c]++,e[d]++;
  }
  for(int n=1;n<=a;n++){
    cout <<e[n]<<'\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << 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; }

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n;
  cin >> n;
  string s;
  cin >> s;

  ll ans = 0;

  // Check all case.
  rep(i, 10) rep(j, 10) rep(k, 10) {
    // Here, we check the validity of (i, j, k);

    vector<int> tri(3);
    tri[0] = i; tri[1] = j; tri[2] = k;
    int l = 0; // index of tri

    bool found = false;
    rep(iter, n) {
      if (found) { break; }

      int c = s[iter] - '0';
      if (c == tri[l]) { // found
        ++l;
        if (l == 3) {
          ++ans;
          found = true;
          break;
        }
      }
    }
  }

  cout << ans << endl;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//end



int main(){
   int n; scanf("%d",&n);
   vector<int> a(n),b(n);
   rep(i,0,n)a[i]=i*20000+1,b[i]=20000*(n-i);
   int rev[501000];
   rep(i,0,n){
      int tmp; scanf("%d",&tmp); rev[tmp-1]=i;
   }
   rep(i,0,n)b[i]+=rev[i];
   rep(i,0,n)printf("%d ",a[i]); puts("");
   rep(i,0,n)printf("%d ",b[i]);
   return 0;
}

Measured memory_bytes: 896
H, W = map(int, input().split())
grid = [input() for _ in range(H)]

paintable = True

for i in range(H):
    for j in range(W):
        if grid[i][j] == '#':
            if i != 0:
                if grid[i-1][j] == '#':
                    continue
            if i != H - 1:
                if grid[i+1][j] == '#':
                    continue
            if j != 0:
                if grid[i][j-1] == '#':
                    continue
            if j != W - 1:
                if grid[i][j+1] == '#':
                    continue
            paintable = False
    if not paintable:
        break
        
print("Yes" if paintable else "No")

Measured memory_bytes: 3064
import copy
def hashnum(state):
    num = 0
    for i in range(3):
        for j in range(3):
            num *= 10
            num += state[i][j]
    return num

answer = 123456780
ini_state = []
for i in range(3):
    temp = [int(n) for n in input().split(" ")]
    if 0 in temp:
        zero_x, zero_y = temp.index(0), i
    ini_state.append(temp)
end_state = [[1, 2, 3], [4, 5, 6], [7, 8, 0]]
queue = [[ini_state, zero_x, zero_y, 0], [end_state, 2, 2, 1]]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
visited = {}
if hashnum(ini_state) == answer:
    print(0)
else:
    visited[hashnum(ini_state)] = [0, 0]
    visited[answer] = [0, 1]
    trial = 0
    ended = 0
    while queue:
        new_queue = []
        trial += 1
        for q in queue:
            if ended:
                break
            state, zero_x, zero_y, direction = q
            for i in range(len(dx)):
                new_state = copy.deepcopy(state)
                new_x = zero_x + dx[i]
                new_y = zero_y + dy[i]
                if 0 <= new_x < 3 and 0 <= new_y < 3:
                    new_state[new_y][new_x], new_state[zero_y][zero_x] = new_state[zero_y][zero_x], new_state[new_y][new_x]
                    perm = hashnum(new_state)
                    if perm in visited and direction != visited[perm][1]:
                        print(trial + visited[perm][0])
                        ended = 1
                        break
                    elif perm not in visited:
                        visited[perm] = [trial, direction]
                        new_queue.append([new_state, new_x, new_y, direction])
        queue = new_queue

Measured memory_bytes: 16260
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;

int k, t;
int a[123];
int big = 0;

int main(void)
{
	cin >> k >> t;
	for (int i = 0; i < t; ++i)
	{
		cin >> a[i];
		big = max(a[i], big);
	}
	cout << max(0, big - (k - big + 1)) << endl;
	return 0;
}





Measured memory_bytes: 256
#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,cnt;

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

	ll x;
	cin >> x;

	ll amari = x % 11;
	if (amari == 0) {
		ans = (x / 11) * 2;
	}
	else if (amari <= 6) {
		ans = (x / 11) * 2 + 1;
	}
	else {
		ans = (x / 11) * 2 + 2;
	}


	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
k=[0]*m
s=[[]for _ in range(m)]
for i in range(m):
  k[i], *s[i] = map(int, input().split())
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
  res=0
  for a in range(m):
    tmp=p[a]^1
    for j in s[a]:
      if (i >> (j-1)) & 1:
        tmp^=1
    res+=tmp
  if res==m:
    ans+=1
print(ans)

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl
#define DOUBLE(d) cout << fixed << setprecision(15) << (d) << endl

ll X;

int main() {
    cin >> X;
    ll v = 100;
    int ans = 0;
    while (v < X) {
        ans++;
        v += v/100;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
mod = 10**9 + 7
stering = [[-1]*1001 for _ in range(1001)]
for i in range(1001):
    stering[i][1] = 1
    stering[i][i] = 1

def roop(n, k):
    if stering[n][k] != -1:
        return stering[n][k]
    else:
        stering[n][k] = (roop(n-1, k-1) + k * roop(n-1, k)) % mod
        return stering[n][k]

n, k = [int(s) for s in input().split()]
if n < k:
    print(0)
else:
    ans = roop(n, k)
    print(ans)




Measured memory_bytes: 20764
//io
#include <iostream>
#include <cstdio>

//data structure
#include <vector>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>

//algorithm
#include <algorithm>
#include <cmath>
#include <cstdlib>

#include <cassert>
using namespace std;
typedef pair<int, int> ii;
typedef long long ll;

const int maxn = 2e5+1;
ll a[maxn];
int n;

int main()
{
  scanf("%d", &n);
  a[0] = 0;
  for (int i = 1; i <= n; ++i)
    {
      scanf("%lld", a+i);
      //      a[i] += a[i-1];
    }


  ll ans = 1e18;
  for (int t = 0; t < 2; ++t)
    {
      ll sum = 0;
      int flag = 1-2*t;
      ll cnt = 0;
      for (int i = 1; i <= n; ++i, flag *= -1)
	{
	  if ((sum+a[i])*flag <= 0)
	    {
	      int target = flag-sum;
	      cnt += abs(target - a[i]);
	      sum = flag;
	    }
	  else
	    {
	      sum += a[i];
	    }
	}
      ans = min(ans, cnt);
      cerr << t << " " << cnt << endl;
    }
  printf("%lld\n", ans);
  
  
}


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

int main() {

    for(int i = 1; i <= 5; i++){
        int x;
        cin >> x;
        if(i != x){
            cout << i << "\n";
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 3632
def countingsort(A, k):
    C = [0 for i in range(k+1)]
    B = [0 for i in range(len(A))]
    for e in A:
        C[e] += 1
    for i in range(1, k+1):
        C[i] += C[i-1]
    for e in A[::-1]:
        B[C[e]-1] = e
        C[e] -= 1
    return B
    
n = input()
x = map(int, raw_input().split())

x = countingsort(x, max(x))

for e in x:
    print e,

Measured memory_bytes: 176488
n,m=map(int,input().split())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
mod=10**9+7
dp=[[0]*(m+1)for i in range(n+1)]
sum=[[0]*(m+1)for i in range(n+1)]
for i in range(1,n+1):
  for j in range(1,m+1):
    if s[i-1]==t[j-1]: dp[i][j]=sum[i-1][j-1]+1
    sum[i][j] = (sum[i][j-1]+sum[i-1][j]-sum[i-1][j-1]+dp[i][j]+mod)%mod
ans=1
for d in dp: 
  for x in d: ans+=x
print(ans%mod)


Measured memory_bytes: 105052
getMonthGroup :: Int -> Int
getMonthGroup x | elem x [2] = 28
                | elem x [4, 6, 9, 11] = 30
                | otherwise = 31

main = do
    [x, y] <- map read . words <$> getLine :: IO [Int]
    putStrLn $ if getMonthGroup x == getMonthGroup y then "Yes" else "No"


Measured memory_bytes: 508
import java.util.*;
import java.util.ArrayDeque;
import java.util.Queue;
import java.math.RoundingMode;
import java.math.BigDecimal;


public class Main{
	 public static void main(String[] args){
	   Scanner sc = new Scanner(System.in);
	   long n = sc.nextLong();
	   long ans = 0;
	   if(n>=2) {
		   ans= n*(n-1)/2;
	   }
	   System.out.println(ans);
	}
}

Measured memory_bytes: 23508
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main()
{
    int64_t A, B;
    char op;
    cin >> A >> op >> B;
    if (op == '+') {
        cout << A + B << endl;
    } else {
        cout << A - B << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
x, y, z, k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort(reverse = 1)
b.sort(reverse = 1)
c.sort(reverse = 1)

v = []

for p in range(x):
  for q in range(y):
    for r in range(z):
      if (p+1)*(q+1)*(r+1) > 3000:
        break
      v.append(a[p]+b[q]+c[r])

v.sort(reverse = 1)
for i in range(k):
  print(v[i])


Measured memory_bytes: 8708
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n), b(n), p(n);
    rep(i, n){
        cin >> a[i] >> b[i];
        p[i] = a[i] + b[i];
    }
    vector<ll> srt(n);
    iota(ALL(srt), 0);
    sort(ALL(srt), [&](ll x, ll y){
        return p[x] > p[y];
    });

    ll ans = 0;
    rep(i, n){
        if(i&1)ans-=b[srt[i]];
        else ans+=a[srt[i]];
    }
    cout << ans << endl;
}

Measured memory_bytes: 3328
#include <iostream>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    if(a==1){
        if(b==2) cout << 3 << endl;
        else cout << 2 << endl;
    }
    if(a==2){
        if(b==1) cout << 3 << endl;
        else cout << 1 << endl;
    }
    if(a==3){
        if(b==1) cout << 2 << endl;
        else cout << 1 << endl;
    }
}

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

bool flag;
int res,cnt,t;
int resn[6];
int num[6];
string str;

void dfs(int v,int val,int cut){
	if(v==str.size()){
		if(val<=t){
			if(res==val)flag=true;
			if(res<val){
				flag=false;
				res=val;
				cnt=cut;
				for(int i=0;i<cnt;i++){
					resn[i]=num[i];
				}
			}
		}
		return;
	}
	int pp=0;
	for(int i=v;i<str.size();i++){
		pp=pp*10+str[i]-'0';
		num[cut]=pp;
		dfs(i+1,val+pp,cut+1);
	}
}

int main(void){
	while(1){
		cin >> t >> str;
		if(t==0 && str=="0")break;
		res=0;
		flag=false;
		dfs(0,0,0);
		if(res==0)printf("error\n");
		else if(flag)printf("rejected\n");
		else{
			printf("%d ",res);
			for(int i=0;i<cnt;i++){
				printf("%d%c",resn[i],i==cnt-1?'\n':' ');
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T&a,T b){if(a>b){a=b;return 1;}return 0;}
typedef long long ll;

int n,k,m;
string s,t;

int main() {
  cin >> s;
  int n=s.size(); vector<int> v(n+1);
  rep(i,n)if(s[i]=='<') chmax(v[i+1],v[i]+1);
  for(int i=n-1;i>=0;i--)if(s[i]=='>') chmax(v[i],v[i+1]+1);
  cout << accumulate(all(v),0ll) << endl;
}

Measured memory_bytes: 2820