akhauriyash/Code-Regression huggingface dataset:
#define ll				long long
#define MOD				1000000007

#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int n;
char s[200010];
int c[2][200010];

typedef struct data {
	int a;
	int b;
} data;

FILE *in, *ans;
int tno;


int out(const char *s) {
#ifdef TEST
	char buf[8192];
	fgets(buf, sizeof(buf), ans);
	if (strcmp(buf, s)) {
		printf("err\n");
	}
#else
	printf(s);
#endif
	return 0;
}

int outi(int i) {
	char s[128];
	sprintf(s, "%d\n", i);
	out(s);
	return 0;
}

int outll(ll l) {
	char s[128];
	sprintf(s, "%lld\n", l);
	out(s);
	return 0;
}

int geti() {
	int i;
	fscanf(in, "%d", &i);
	return i;
}

ll getll() {
	ll l;
	fscanf(in, "%lld", &l);
	return l;
}

int getstr(char *s) {
	fscanf(in, "%s", s);
	return 0;
}

int fnc() {

	memset(c, 0, sizeof(c));

	int n = geti();
	getstr(s);

	int i;
	for (i = 0; i < n; i++) {
		if (s[i] == '.') {
			c[0][i]++;
		}
		else {
			c[1][i]++;
		}
		if (i > 0) {
			c[0][i] += c[0][i - 1];
			c[1][i] += c[1][i - 1];
		}
	}

	int m = c[0][n - 1];
	if (m > c[1][n - 1]) {
		m = c[1][n - 1];
	}
	for (i = 0; i < n; i++) {
		int v = c[1][i] + c[0][n - 1] - c[0][i];
		if (m > v) {
			m = v;
		}
	}

	outi(m);

	return 0;
}

int main() {
#ifdef TEST
	for (tno = TEST_SNO; tno <= TEST_ENO; tno++) {
		char str[128];
		sprintf(str, "test%d.txt", tno);
		in = fopen(str, "r");
		sprintf(str, "ans%d.txt", tno);
		ans = fopen(str, "r");
		fnc();
		fclose(in);
		fclose(ans);
	}
	printf("end\n");
#else
	in = stdin;
	fnc();
#endif

	return 0;
}


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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    set<int> s;
    int a, b, k;
    cin >> a >> b >> k;
    for(int i = a, c = 0; i <= b && c < k; ++i, ++c)
        s.insert(i);
    for(int i = b, c = 0; i >= a && c < k; --i, ++c)
        s.insert(i);
    for(auto& x : s)
        cout << x << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>
#include<bits/stdc++.h>

using namespace std;

typedef pair<long long,bool> Pair;
const long long INF = 1LL<<60;
long long GCD[200][200][200] = {-1};

int main(){

long long K,sum = 0;

cin >> K;



for(int i = 1;i <= K;++i){

    for(int j = 1;j <= K;++j){

        for(int k = 1;k <= K;++k){

            sum += __gcd(__gcd(i,j),k);

        }

    }

}

cout << sum << endl;

return 0;

}   


Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define all(x) (x).begin(), (x).end()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end());
const long long INF = 1LL << 60;
// map<int,int> mp;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> P(N);
  REP(i, N) cin >> P[i];

  sort(all(P));
  int ans = 0;
  for (int i = 0; i < K; i++) {
    ans += P[i];
  }
  cout << ans << endl;
}

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

/* #pragma */
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int GCD(int a,int b){return b?GCD(b,a%b):a;}
long long GCD(long long a, long long b){return b ? GCD(b, a%b) : a;}
int LCM(int a, int b){return a * b / GCD(a, b);}
long long LCM(long long a, long long b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
const int INF = 1001001001;
const long long LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const double EPS = 1e-9;
const int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right

//#define int ll
//#define int long long

//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//chcp 65001

signed main()
{
	int n; cin >> n;
	int mcnt{};//int cnt{};
	vector<int> a(n);
	for(int i = 0, i_len = n; i < i_len; ++i) cin >> a[i];

	map<int, int> mp;
	for(const auto &i: a){
		++mp[i];
		++mp[i+1];
		++mp[i-1];
	}

	for(const auto &i: mp){
		amax(mcnt, i.second);
	}

	cout << mcnt << endl;
	return 0;
}
//	sort(a.begin(), a.end());
/*	auto func = [&]{
		return a[i]+1 == x || a[i] == x || a[i]-1 == x;
	};
	for (size_t i = 0; i < n; i++)
	{
		cnt = count_if(a.begin(), a.end(), );
		amax(mcnt, cnt);
	}
*/
/*	for(auto i = 0; i < n; ++i){
		int x = a[i];
		for(auto j = 0; j < n; ++j){
			if(a[j]+1== x || a[j] == x || a[j]-1 == x){
				++cnt;
			}
		}
		amax(mcnt, cnt);cnt = 0;
	}
*/

Measured memory_bytes: 6656
module Main where

import           Data.Maybe                     ( fromJust )
import           Data.List
import           Control.Monad
import qualified Data.ByteString.Char8         as BS
import qualified Data.Vector                   as VU

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


main :: IO ()
main = do
    n <- getInt
    print $ culc . VU.fromList $ divisor n


culc :: VU.Vector Int -> Int
culc v =
    (if l == 2
            then VU.sum v
            else if odd l then v VU.! lh * 2 else v VU.! (lh - 1) + v VU.! lh
        )
        - 2
  where
    l  = VU.length v
    lh = div l 2


primes :: Integral a => [a]
primes = map fromIntegral prime_c
  where
    prime_c = [2, 3, 5] ++ f 5 7 (drop 2 prime_c)
    f m s (p : ps) = [ n | n <- ns, gcd m n == 1 ] ++ f (m * p) (p * p) ps
        where ns = [ x + y | x <- [s, s + 6 .. p * p - 2], y <- [0, 4] ]

factorize :: Integral a => a -> [(a, Int)]
factorize 1 = [(1, 0)]
factorize n = format $ factorize_c n primes
  where
    format ps = [ (x, length xs) | xs@(x : _) <- group ps ]
    factorize_c n ps@(p : ps') | p * p > n    = [n]
                               | rem n p == 0 = p : factorize_c (div n p) ps
                               | otherwise    = factorize_c n ps'

divisor :: Integral a => a -> [a]
divisor n = sort $ foldr distribute [1] ns
  where
    ns = [ map (f ^) [0 .. i] | (f, i) <- factorize n ]
    distribute ns1 ns2 = [ x * y | x <- ns1, y <- ns2 ]



Measured memory_bytes: 7932
import java.util.Scanner;

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

		int[] s = new int[n];
		int[] ss = new int[n + 1];
		ss[0] = 0;
		long sum = 0;
		int i;
		for(i = 0; i < n; i++) {
			s[i] = scan.nextInt();
			ss[i + 1] = ss[i] + s[i];
			sum += s[i];
		}

		long min = Long.MAX_VALUE;
		long temp;
		for(i = 0; i < n; i++) {
			temp = sum - ss[i];
			min = Math.min(Math.abs(temp - ss[i]), min);
		}

		System.out.println(min);
	}
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define endl "\n";
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=3e5+10;
int32_t main()
{
	IOS;
	int n,m;
	cin>>m>>n;
	map<int,int>mp;
	for(int i=1;i<=n;i++)
	{
		int x;
		cin>>x;
		mp[x]++;
	}
	int ans=0;
	int mn=MOD;
	for(int i=-100;i<=102;i++)
	{
		if(mp[i]==0)
		{
			if(abs(m-i)<mn)
			{
				mn=abs(m-i);
				ans=i;
			}
		}
	}
	cout<<ans<<endl;

	
}

Measured memory_bytes: 3688
import copy as cp

alp  ="abcdefghij"

N = int(input())

list_old = [("a",1)]

if N == 1:
    print("a")
else:
    for i in range(N-1):
        list_new = []
        for elem in list_old:
            for j in range(elem[1]+1):
                list_new.append((elem[0]+alp[j],max(j+1, elem[1])))
        list_old = cp.deepcopy(list_new)
    for elem in list_old:
        print(elem[0])

Measured memory_bytes: 23152
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,a[10005];
	cin>>n>>m;
	for(int i=0;i<m;i++){
		cin>>a[i];
		n-=a[i];
	}
	if(n<0){
		cout<<"-1"<<endl;
	}
	else{
		cout<<n<<endl;
	}
  return(0);
}

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

using namespace std;

int main(int argc, char *argv[])
{
  string s;
  size_t s_size;
  char first;
  char end;

  cin >> s;
  s_size = s.size();
  first = s[0];
  end = s[s_size-1];

  cout << first << s_size-2 << end << endl;
  return 0;
}

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

int main() {

	int n; cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	const int p = 1000005;
	vector<int> num(p, 0);
	for (int i = 0; i < n; i++) {
		if (num[a[i]] != 0) {
			num[a[i]] = 2;
		}
		else {
			for (int j = a[i]; j < p; j += a[i]) {
				num[j]++;
			}
		}
	}
	int ans = 0;
	for (int x : a) {
		if (num[x] == 1) ans++;
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7984
#include<stdio.h>
 
int main(){
  int x,y,tx,ty;
  int i;
  scanf("%d %d %d %d", &x, &y, &tx, &ty);
  
  for(i=x;i<tx;i++){
    printf("R");
  }
  for(i=y;i<ty;i++){
    printf("U");
  }
  for(i=tx;i>x;i--){
    printf("L");
  }
  for(i=ty;i>y;i--){
    printf("D");
  }
  printf("D");
  for(i=x;i<tx+1;i++){
    printf("R");
  }
  for(i=y;i<ty+1;i++){
    printf("U");
  }
  printf("L");
  printf("U");
  for(i=tx;i>x-1;i--){
    printf("L");
  }
  for(i=ty;i>y-1;i--){
    printf("D");
  }
  printf("R");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using P = pair<int,int>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k, bool b) {
    if (k < 0 || k > n) return 0;
    if(b) return fact[n]*ifact[k]*ifact[n-k];
    else return fact[n]*ifact[n-k];
  }
}comb(1000005);


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

    vector<mint> ans(K);
    rep(i,K){
        ans[i] = comb(N - K + 1,i + 1,true) * comb(K - 1, i, true);
    }

    rep(i,K) cout << ans[i] << endl;

    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

Measured memory_bytes: 15872
import java.util.*;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int N = sc.nextInt();
        int T = sc.nextInt();

        int[] c = new int[N];
        int[] t = new int[N];

        int minCost = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            c[i] = sc.nextInt();
            t[i] = sc.nextInt();
            if (t[i] <= T) {
                minCost = Math.min(minCost, c[i]);
            }
        }
        if (minCost == Integer.MAX_VALUE) {
            System.out.println("TLE");
            return;
        }
        System.out.println(minCost);
    }
}

Measured memory_bytes: 23124
def solve():
    from sys import stdin
    f_i = stdin
    
    a, b = map(int, f_i.readline().split())
    N = int(f_i.readline())
    for i in range(N):
        s, f = map(int, f_i.readline().split())
        if b <= s or f <= a:
            pass
        else:
            print(1)
            break
    else:
        print(0)

solve()


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

int main(){
  long long int trans[5],n,ans = 0;
  cin >> n;
  for(int i=0;i<5;i++){
    cin >> trans[i];
  }
  sort(trans,trans+5);
  ans = 4 + (n + trans[0] - 1)  / trans[0];
  cout << ans << endl;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    int m;cin >>m;
    int ans=24;
    ans+=24-m;
    cout <<ans <<endl;
    return 0;
}

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

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }


/*
--------------------------------------------

	type

--------------------------------------------
*/
using LL = long long;
using ULL = unsigned long long;
//using pair<T1, T2> = p12;

/*
--------------------------------------------

	container

--------------------------------------------
*/
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())

/*
--------------------------------------------

	repetition

--------------------------------------------
*/
#define REP(n) for(int i=0; i<n; i++)
#define REPj(n) for(int j=0; j<n; j++)
#define REPinit(a,n) for(int i=a; i<n; i++)
#define REPinitj(a,n) for(int j=a; j<n; j++)

//algorithm
//#define SORT(c) sort((c).begin(),(c).end())

/*
--------------------------------------------

	constant

--------------------------------------------
*/
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))



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

	string S, T;
	cin >> S >> T;

	for (int i = 0; i < N; i++)
	{
		cout << S[i] << T[i];
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define forn(i,n)for(ll i=0;i<(n);i++)
#define forn_rev(i,n)for(ll i=(n)-1;i>=0;i--)
#define for1n(i,n) for(ll i=1;i<=(n);i++)
#define ARRAY_SIZE(a) sizeof(a)/sizeof(*a)
#define MOD 1000000007
#define MAXN 1000005

using namespace std;




int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);cout.tie(NULL);
    ll T=1;
    //cin>>T;
    while(T--)
    {
        ll N;
        cin>>N;
        vector<ll> arr(N-1);
        forn(i,N-1) cin>>arr[i];
        vector<ll> mp[N+1];
        forn(i,N-1){
            mp[arr[i]].push_back(i+2);
        }
        forn(i,N){
            cout<<mp[i+1].size()<<endl;
        }




    }



    return 0;
}


Measured memory_bytes: 15512
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
 
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
 
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
 
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
 
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
 
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        a: i32,
        b: i32,
        c: i32,
    }
    if a < b && b < c {
        println!("Yes")
    } else {
        println!("No")
    }
}


Measured memory_bytes: 5028
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#define ALL(x) (x).begin(),(x).end()
typedef long long ll;

using namespace std;

int main(){
    int N;	cin >> N;
    ll ans, a;
    vector<ll> A(N);
    ans = 0;
    for(int i=0; i<N; i++){
        cin >> A[i];
        ans ^= A[i];
    }
    for(int i=0; i<N; i++){
        a = ans^A[i];
        cout << a << " ";
    }
}

Measured memory_bytes: 4732
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b;
  cin>>a>>b;
  ll c=min(a,b),d=max(a,b);
  if(d-c<=1){
    vi kaijo(222222);
    kaijo[0]=1;
    for(int i=1;i<222222;i++)
      kaijo[i]=(kaijo[i-1]*i)%MOD;
    if(d-c==1)
    cout<<(kaijo[c]*kaijo[d])%MOD<<endl;
    else cout<<kaijo[c]*kaijo[c]*2%MOD<<endl;
  }else cout<<0<<endl;
  return 0;
}


Measured memory_bytes: 2048
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int main()
{
    int N;
    while(scanf("%d",&N)!=EOF)
    {
        int X[105],i,a;
        double p=0;
        long long sum=0;
        for(i=0;i<N;i++)
            {scanf("%d",&X[i]);
            p=p+X[i];
            }
            p=p/N;
            a=p;
            if(p-a>0.5)
                p=a+1;
            else p=a;

            for(i=0;i<N;i++)
                sum+=pow(p-X[i],2);
        printf("%lld\n",sum);
    }
    return 0;
}


Measured memory_bytes: 256
n, x, y = map(int, input().split())
a = [0]*(n-1)
for i in range(1, n):
    for j in range(i+1, n+1):
        b = min(j-i, abs(x-i)+1+abs(y-j))
        a[b-1] += 1
print(*a, sep="\n")

Measured memory_bytes: 9284
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define REP(i,n) for(int i = 0; i < n; i++)
const int N = 1e5+3;
const int INF = 1e9;

int a[51][26];
int cnt[26];

int main(){

  int n; cin >> n;
  REP(i,n){
    string str; cin >> str;
    REP(j,str.size()){
      int t = str[j] - '0';
      a[i][t-49]++;
    }
  }

  string ans = "";
  char c = 'a';
  REP(j,26){
    int cnt = INF;
    REP(i,n){
      cnt = min(cnt,a[i][j]);
    }
    while( cnt-- ) ans += c;
    c++;
  }
  cout << ans << endl;

  return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    int N, K; cin >> N >> K;
    vector<int> l(N);
    int sum = 0;
    for(int i = 0; i < N; i++) {
        cin >> l[i];
    }
    sort(l.begin(), l.end());
    reverse(l.begin(), l.end());
    for(int i = 0; i < K; i++) sum += l[i];
    cout << sum << endl;
    return 0;
}

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

int n, m, a, b, total = 0;
vector<int> subset;
vector<vector<int>> connections;

void solve(int x) {
  if (subset.size()==n) {
    total++;
    return;
  }
  
  for (auto i : connections[x]) {
    if (find(subset.begin(),subset.end(),i) != subset.end()) continue;
    subset.push_back(i);
    solve(i);
    subset.pop_back();
  }
  
  return;
}

int main() {
  cin >> n >> m;
  
  for (int i=0; i<=n; i++) {
    connections.push_back({});
  }
  
  for (int i=0; i<m; i++) {
    cin >> a >> b;
    connections[a].push_back(b);
    connections[b].push_back(a);
  }
  
  subset.push_back(1);
  solve(1);
  
  cout << total;
  
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a += b;
	if(a>MOD){
		a -= MOD;
	}
}

int main(void){
	int n,i,ans=0;
	string s;
	cin >> n;
	cin >> s;
	for(i=0; i<n; ++i){
		if(s[i]=='R'){
			++ans;
		}else{
			--ans;
		}
	}
	cout << ((ans>0)?"Yes":"No") << endl;
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

from pprint import pprint
from collections import deque, defaultdict
import itertools
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.buffer.readline
INF = float("inf")

n, m, q = map(int, input().split())
queries = []
for i in range(q):
    line = list(map(int, input().split()))
    queries.append(line)

numbers = range(1, m + 1)

combs = itertools.combinations_with_replacement(numbers, n)
# print(list(combs))

res_max = 0
for A in combs:
    res = 0
    for a, b, c, d in queries:
        if A[b-1] - A[a-1] == c:
            res += d
    res_max = max(res_max, res)

print(res_max)


Measured memory_bytes: 69552
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <queue>

using namespace std;

const int MAX_N = 51;
const int MAX_WH = 2 * 1e6;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

int W, H, n;
int X1[MAX_N], X2[MAX_N], Y1[MAX_N], Y2[MAX_N];

// 塗りつぶし用
bool fld[MAX_N * 6][MAX_N * 6];

// x1, x2を座標圧縮し，座標圧縮した際の幅を返す
int compress(int *x1, int *x2, int w)
{
    vector<int> xs;

    xs.push_back(-1);
    xs.push_back(w + 1);
    for (int i = 0; i < n; i++) {
        for (int d = -1; d <= 1; d++) {
            int tx1 = x1[i] + d;
            int tx2 = x2[i] + d;

            if (0 <= tx1 && tx1 <= w)
                xs.push_back(tx1);
            if (0 <= tx2 && tx2 <= w)
                xs.push_back(tx2);
        }
    }

    sort(xs.begin(), xs.end());
    xs.erase(unique(xs.begin(), xs.end()), xs.end());

    for (int i = 0; i < n; i++) {
        x1[i] = find(xs.begin(), xs.end(), x1[i]) - xs.begin();
        x2[i] = find(xs.begin(), xs.end(), x2[i]) - xs.begin();
    }

    return xs.size();
}

void solve()
{
    // 座標圧縮
    W = compress(X1, X2, W);
    H = compress(Y1, Y2, H);

    // 四角形で塗りつぶし
    memset(fld, 0, sizeof(fld));
    for (int i = 0; i < n; i++) {
        for (int x = X1[i]; x <= X2[i]; x++)
            fld[Y1[i]][x] = fld[Y2[i]][x] = true;

        for (int y = Y2[i]; y <= Y1[i]; y++)
            fld[y][X1[i]] = fld[y][X2[i]] = true;
    }

    // 領域を数える
    int ans = 0;
    for (int y = 0; y < H; y++) {
        for (int x = 0; x < W; x++) {
            if (fld[y][x])
                continue;
            ans++;

            // 幅優先探索
            queue<pair<int, int> > que;
            que.push(make_pair(x, y));

            while (!que.empty()) {
                int sx = que.front().first;
                int sy = que.front().second;
                que.pop();

                for (int i = 0; i < 4; i++) {
                    int tx = sx + dx[i];
                    int ty = sy + dy[i];

                    if (tx < 0 || W <= tx || ty < 0 || H <= ty)
                        continue;
                    if (fld[ty][tx])
                        continue;
                    que.push(make_pair(tx, ty));
                    fld[ty][tx] = true;
                }
            }
        }
    }
    cout << ans << endl;
}

int main()
{
    while (cin >> n, n) {
        for (int i = 0; i < n; i++) {
            cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];

            /*
              11   111　左のような矩形を右のように変形するために座標を2倍
              11   101
                   111
             */
            X1[i] *= 2;
            X2[i] *= 2;
            Y1[i] *= 2;
            Y2[i] *= 2;
        }

        W = H = MAX_WH;
        solve();
    }

    return 0;
}

Measured memory_bytes: 1324
#include "bits/stdc++.h"

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

ll nCr(int n, int r) {
	if(n<r)return -1;
    ll ans = 1;
	for (int i = 0; i < r; i++) {
		ans *= n - i;
		ans /= i + 1;
	}
	return ans;
}
int main(){
    ll N,ans=0;
    cin >> N;
    vector<string> input(N);
    
    REP(i,0,N){
        cin >> input[i];
    }
    REP(i,0,N){
        sort(input[i].begin(),input[i].end());
    }

    map<string,ll> anagram;
    REP(i,0,N){
        anagram[input[i]]++;
    }
    for(auto itr = anagram.begin(); itr != anagram.end(); ++itr) {
        if(itr->second != 1)ans+=nCr(itr->second,2);
    }
    P(ans);
    // REP(i,0,N){
    //     P(input[i]);
    // }
}

Measured memory_bytes: 18176
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  ll N;
  cin>>N;
  ll ans = 10;
  ll ans2 = 8;
  ll ans3 = 9;
  for(ll i = 1;i<N;i++){
    ans*=10;
    ans = ans%MOD;
    ans2*=8;
    ans2 = ans2%MOD;
    ans3*=9;
    ans3 = ans3%MOD;
  }
  if((2*ans3)>(ans+ans2)){
    cout << (MOD+MOD+ans+ans2-ans3-ans3)%MOD << endl;
  }
  else{
    ll ppp = (ans+ans2-2*ans3)%MOD;
    cout << ppp%MOD << endl;
  }
  //cout << ans << " " <<  ans2 << " " << ans3 << endl;
  return 0;
}

Measured memory_bytes: 3620
# -*- coding: utf-8 -*-


def main():
    """Function."""
    line = list(map(int, input().split()))

    counter = 0
    check = set()

    line.sort()
    last = tuple(line)
    check.add(last)
    for _ in range(10**8):
        a, b, c = last[0], last[1], last[2]
        if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
            print(counter)
            break

        else:
            temp_a, temp_b, temp_c = a//2, b//2, c//2
            dum = [temp_b+temp_c, temp_a+temp_c, temp_a+temp_b]
            dum.sort()
            last = tuple(dum)
            if last in check:
                print(-1)
                break
            else:
                counter += 1
                check.add(last)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			Dice dice1 = new Dice(sc.nextLine().split(" "));
			Dice dice2 = new Dice(sc.nextLine().split(" "));

			System.out.println(dice1.equals(dice2)?"Yes":"No");
		}
	}
	static class Dice{

		private int[] face;
		
		public Dice(String[] face) {
			this.face = new int[6];
			for(int i=0;i<this.face.length;i++) {
				this.face[i] = Integer.parseInt(face[i]);
			}
		}

		/**
		 * 東西南北EWSN+右左RLでさいころを回転させます
		 * @param to 回転向き?
		 */
		public void rotate(char to){
			int buf;
			switch(to) {
			case 'E':
				buf = this.face[0];
				this.face[0] = this.face[3];
				this.face[3] = this.face[5];
				this.face[5] = this.face[2];
				this.face[2] = buf;
				break;
			case 'W':
				buf = this.face[0];
				this.face[0] = this.face[2];
				this.face[2] = this.face[5];
				this.face[5] = this.face[3];
				this.face[3] = buf;
				break;
			case 'S':
				buf = this.face[0];
				this.face[0] = this.face[4];
				this.face[4] = this.face[5];
				this.face[5] = this.face[1];
				this.face[1] = buf;
				break;
			case 'N':
				buf = this.face[0];
				this.face[0] = this.face[1];
				this.face[1] = this.face[5];
				this.face[5] = this.face[4];
				this.face[4] = buf;
				break;
			case 'R':
				buf = this.face[1];
				this.face[1] = this.face[2];
				this.face[2] = this.face[4];
				this.face[4] = this.face[3];
				this.face[3] = buf;
				break;
			case 'L':
				buf = this.face[1];
				this.face[1] = this.face[3];
				this.face[3] = this.face[5];
				this.face[5] = this.face[2];
				this.face[2] = buf;
				break;
			}
		}
		
		/**
		 * 2つのさいころが同じ物か判定します
		 * 比較する側は回されます。
		 * @param dice
		 * @return 同じか否か
		 */
		public boolean equals(Dice dice) {
			for(int i=0;i<4;i++) {
				dice.rotate('N');
				for(int j=0;j<4;j++) {
					dice.rotate('R');
					int k;
					for(k=0;k<6;k++) {
						if(this.showN(k) != dice.showN(k)) break;
					}
					if(k==6) return true;
				}
			}
			for(int i=0;i<2;i++) {
				dice.rotate('E');
				for(int j=0;j<4;j++) {
					dice.rotate('R');
					int k;
					for(k=0;k<6;k++) {
						if(this.showN(k) != dice.showN(k)) break;
					}
					if(k==6) return true;
				}
				dice.rotate('E');
			}
			return false;
		}
		public int showN(int n) {
			return this.face[n];
		}
	}
}


Measured memory_bytes: 26296
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include<iomanip>

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;
ll mod=1e9+7;
ll modn(ll a,ll mod)
{
  a%=mod;
  if(a<0)a+=mod;
  return a;
}
vector<ll> mem(100,0);
long long modinv(long long a,long long mod)
{
  if(a<100 && mem[a]>0)return mem[a];
  long long cnt=a,res=1;
  long long m=mod-2;
  while(m>0)
  {
    if(m%2)res*=cnt;
    cnt=cnt*cnt;
    cnt%=mod;
    res%=mod;

    m>>=1;
  }
  //cout<<a<<"modinv"<<res<<endl;
  if(a<100)mem[a]=res;
  return res;
}
ll c(ll num,ll d)
{
  if(num==1 || num==d || d==0)return 1;
  return modn(modn(c(num-1,d-1)*num,mod)*modinv(d,mod),mod);
}

int  main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout<<setprecision(10);
  ll n,m;
  cin>>n>>m;
  map<ll,ll> pd;
  ll sqrtm=sqrt(m)+1;
  ll tm=m;
  repi(i,2,sqrtm+1000)
  {
    while(tm%i==0){pd[i]++;tm/=i;}
    if(tm==1)break;
  }
  if(tm>1)pd[m]++;
  ll res=1;
  for ( auto p : pd)
  {
    //cout<<p.first<<" "<<p.second<<endl;
    res=modn((ll)res*c(p.second+n-1,p.second),mod);
  }
  cout<<res<<endl;

  return 0;

}


Measured memory_bytes: 256
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = if n <= m then  List.range n `To m else []
let (++-) n m = if n >= m then List.range n `Downto m else []
let (++^) n m = if n < m then List.range n `To (pred m) else []

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (0 ++^ n)

let scan_list ?sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv
let scan_array ?sep cnv = Array.of_list @@ scan_list ?sep cnv
let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list ?sep conv);
  arr

let atoi c = Char.code c - Char.code '0'
let itoa n = Char.chr (n + Char.code '0')

let between n x m = n <= x && x < m


(* ===== MAIN ===== *)

let s = scan "%s" id
let t = scan "%s" id

let () =
  if String.length s + 1 <> String.length t ||
     s <> String.sub t 0 (String.length t - 1)
  then Printf.printf "No\n"
  else Printf.printf "Yes\n"


Measured memory_bytes: 5312
k = int(input())
cnt = 1
red = 7
memo = [0]*(10**6+10)
while cnt:
    red = red % k
    if red == 0:
        print(cnt)
        exit()
    if memo[red] == 1:
        print(-1)
        exit()
    memo[red] = 1
    red = red * 10 + 7
    cnt += 1

Measured memory_bytes: 16676
from sys import exit
def groupby(a):
    a2=[[a[0],1]]
    for i in range(1,len(a)):
        if a2[-1][0]==a[i]:
            a2[-1][1]+=1
        else:
            a2.append([a[i],1])
    return a2

n,k=map(int,input().split())
s=list(input())
x=groupby(s)
l=len(x)
y=[x[i][1] for i in range(l)]

if x[0][0]=="0":
    su=sum(y[:2*k])
    ans=su
    y.pop(0)
    l-=1
else:
    ans=0
su=sum(y[:2*k+1])
ans=max(ans,su)
l_sub=(l-(2*k+1))//2
if l_sub<=0:
    print(ans)
    exit()
for i in range(l_sub):
    su-=y[2*i]
    su-=y[2*i+1]
    su+=y[2*k+1+(2*i)]
    su+=y[2*k+1+(2*i+1)]
    ans=max(su,ans)
#最後のところの判定っぽいな
if 2*k+1+2*l_sub<l:
    su-=y[2*l_sub]
    su-=y[2*l_sub+1]
    su+=y[2*k+1+2*l_sub]
    ans=max(su,ans)
print(ans)


Measured memory_bytes: 15156
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,m;
cin>>n>>m;
string str[n];
for(int i=0;i<n;i++)
    cin>>str[i];
    int dp[n][m]={};
    if(str[0][0]=='#')
    dp[0][0]=1;
    for(int i=1;i<m;i++)
    {
        if(str[0][i-1]=='#'&&str[0][i]=='#')
            dp[0][i]=dp[0][i-1];
        else if(str[0][i]=='#'&&str[0][i-1]!='#')
        {
            dp[0][i]=dp[0][i-1]+1;
        }
        else
        {
            dp[0][i]=dp[0][i-1];
        }

    }
    for(int i=1;i<n;i++)
    {
       if(str[i][0]=='#'&&str[i-1][0]!='#')
        {
            dp[i][0]=dp[i-1][0]+1;
        }
        else
        {
            dp[i][0]=dp[i-1][0];
        }
    }
    for(int i=1;i<n;i++)
    {
        for(int j=1;j<m;j++)
        {
            if(str[i][j]=='#'&&str[i][j-1]!='#')
            {
                dp[i][j]=dp[i][j-1]+1;
            }
            else
                dp[i][j]=dp[i][j-1];
            if(str[i][j]=='#'&&str[i-1][j]!='#')
            {
                dp[i][j]=min(dp[i][j],dp[i-1][j]+1);
            }
            else
                dp[i][j]=min(dp[i][j],dp[i-1][j]);
        }
    }
    cout<<dp[n-1][m-1]<<endl;
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main()
{
	int n, x;
	scanf("%d %d", &n, &x);
	int i;
	int l[102];
	for (i = 0; i < n; i++)
		scanf("%d", &l[i]);
	int ans = 1;
	int now = 0;
	for (i = 0; i < n; i++)
	{
		now += l[i];
		if (now <= x)
			ans++;
	}
	printf("%d\n", ans);
	return 0;
}

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

using namespace std;

int main() {
    int n, m, i, a[1000], dap=0, sum=0;
    scanf("%d %d", &n, &m);
    for(i=1;i<=n;i++)
    {
        scanf("%d", &a[i]);
        sum+=a[i];
    }
    for(i=1;i<=n;i++)
    {
        if((4*m*a[i])>=sum)
        dap++;
    }
    if(dap>=m)
        printf("Yes");
    else
        printf("No");
    
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int n,m;
	int a[1000],face;
	while(cin>>n>>m,n||m){
		int i;
		for(i=0;i<n;i++)cin>>a[i];
		int ans,pos=0;
		for(i=0;i<m;i++){
			cin>>face;
			pos += face;
			if(n-1<=pos){
				ans=i+1;
				break;
			}
			pos += a[pos];
			if(n-1<=pos){
				ans=i+1;
				break;
			}
		}
		for(i++;i<m;i++){
			cin>>face;
		}
		cout<<ans<<endl;
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define Cout(n) cout<<(n)<<endl
#define INF 1000000000000000000LL

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;
typedef vector<string> vs;
const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

int main()
{
	ll n,m;
	cin >> n >> m;
	cout << (n==m?"Yes\n":"No\n");
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;
using ll = long long;
int main(){
    ll N;
    cin >> N;
    ll sum=0;
    for(ll i=1; i<=N; i++){
        if(i%3!=0 && i%5!=0) sum+=i;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int, int>;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main() {
    int a, b;
    string ans;
    cin >> a >> b;
    if (a < b) ans = "a < b";
    if (a > b) ans = "a > b";
    if (a == b) ans = "a == b";
    cout << ans << endl;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int X,Y;
    cin >> X >> Y;
    if(Y%2 == 0 && 2*X <= Y && Y <= 4*X){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

using namespace std;

int main() {
	int N;
	cin >> N;
	string S, T, A;
	cin >> S >> T;
	for (int i = 0; i < N; i++) {
		A.push_back(S[i]);
		A.push_back(T[i]);
	}
	cout << A << endl;
	return 0;
}

Measured memory_bytes: 3580
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include <numeric>
#include<vector>

#define LL long long
#define MOD 1000000007

using namespace std;

LL gcd(LL C, LL D) {
	if (C < D) gcd(D, C);

	if (C%D == 0)return D;
	else gcd(D, C%D);
}

///<summary>
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

int main() {

	int X;
	cin >> X;


	int divide100num = X / 100;
	int num = 0;

	int over = X - divide100num * 100;

	if (over <= 5 * divide100num) {
		for (int i = 5; i > 0; i--) {
			while (over - i >= 0) {
				num++;
				over -= i;
			}
		}
	}

	if (over == 0 && num <= divide100num) cout << 1 << endl;
	else cout << 0 << endl;


}





Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int A,B,i,N,l,sum=0;
  
  scanf("%d",&N);
  
  for(i=1;i<=N;i++)
  {
    A=i;
    l=N/A;
    if(N%A==0)
    {
      l=l-1;
    }
    sum=sum+l;
  }
  printf("%d",sum);
  return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

vector<long long> divisor(long long n){
    vector<long long> res;
    for(int i = 1; (long long)i * i <= n; i++){
        if(n % i == 0){
            res.push_back(i);
            if(i != n / i) res.push_back(n / i);
        }
    }
    sort(begin(res), end(res));
    return res;
}

signed main(){
    ll n, m;
    cin >> n >> m;
    vector<ll> div = divisor(m);
    reverse(ALL(div));
    for(auto d : div){
        if(m / d >= n){
            cout << d << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
unordered_map<string,int> hashh;
int main(){
    int n;
    cin>>n;
    ll res=0;
    for(int i=0;i<n;i++){
        string str;
        cin>>str;
        sort(str.begin(),str.end());
        if(hashh.find(str)==hashh.end()){
            hashh[str]=1;
        }
        else{
            res+=hashh[str];
            hashh[str]++;
        }
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 10660
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL n, a;
LL fp(LL a, LL b) {
    LL res = 1;
    for (; b; a = a * a, b >>= 1) {
        if (b & 1) res = a * res;
    }
    return res;
}
int main() {
    while (~scanf("%lld%lld", &n, &a)) {
        LL ans = n;
        for (int step = 1; (1LL << step) <= n; step++) {
            // cout << "current step " << step << endl;
            for (int pace = 2; fp(pace, step + 1) <= n; pace++) {
                LL x = pace * step, y = a * step, z = fp(pace, step);
                // cout << x << ',' << y << ',' << z << endl;
                ans = min(ans, x + y + (n + z - 1) / z);
                for (int i = 1; i <= step; i++) {
                    z /= pace;
                    z *= pace + 1;
                    ans = min(ans, x + i + y + (n + z - 1) / z);
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 384
while 1:
	n,m = map(int,raw_input().split())
	if n == 0: break
	EBY = [raw_input().split() for i in range(n)]
	EBY = [[e,int(b),int(y)] for e,b,y in EBY]
	for i in range(m):
		year = int(raw_input())
		for j in range(n):
			if EBY[j][2]-EBY[j][1] < year <= EBY[j][2]:
				print EBY[j][0], year-EBY[j][2]+EBY[j][1]
				break
		else:
			print "Unknown"

Measured memory_bytes: 4732
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        String S = stdIn.next();
        String T = stdIn.next();
        int A = stdIn.nextInt();
        int B = stdIn.nextInt();
        String U = stdIn.next();
        stdIn.close();

        if (U.equals(S)) {
            A += -1;
        } else if (U.equals(T)){
            B += -1;
        }
        
        System.out.printf("%d %d", A, B);
    }
}

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

using namespace std;

int main()
{
	int n;
	string s1, s2;
	
	scanf("%d", &n);
	
	map<string, int> m;
	
	for(int i = 0; i < n; i++)
	{
		cin >> s1 >> s2;
		
		if(s1 == "insert")
			m[s2] = 1;
		else if(s1 == "find")
		{
			if(m[s2])
				printf("yes\n");
			else
				printf("no\n");
		}
	}
	return 0;
}


Measured memory_bytes: 52704
#include<iostream>
#include<cstring>
using namespace std;
int a[25];
int main()
{
	int n, cnt = 0;
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	for(int i = 2; i <= n-1; i++)
	{
		if((a[i] < a[i+1] && a[i] > a[i-1]) ||(a[i] > a[i+1] && a[i] < a[i-1]))
		{
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
 } 

Measured memory_bytes: 256
#include <iostream>
using namespace std;
template <typename T>
T gcd(T a,T b){
  if(a%b==0)return b;
  else return gcd(b,a%b);
}
template <typename T>
T lcm(T a,T b){
  return a/gcd(a,b)*b;
}
int main(){
    int n;cin>>n;
    long long nw = 1;
    for(int i = 0; n > i; i++){
        long long t;cin>>t;
        nw = lcm(nw,t);
    }
    cout << nw <<endl;
}


Measured memory_bytes: 3116
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define eb          emplace_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define mp(x,y)     make_pair(x,y) 
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,a,n)   for(ll i=a;i<n;i+=2)
#define frr(i,a,n)  for(ll i=n-1;i>=a;i--)


const ll N   =  500005;
const ll mod = 1e9 + 7;

using namespace std;


void solve()
{
 string s;
  ll n,m,k,x=0,y=0,c=0,q,ans=1;
ll a[5];
for(ll j=0;j<5;j++)
{
  cin>>a[j];
}
cin>>k;
sort(a,a+5);
if(a[4]-a[0]>k)
{
  c(":(");
}
else c("Yay!");
}

signed main(){
     
      ios_base::sync_with_stdio(false);   
      cin.tie(NULL);
      ll T=1;
      //cin>>T;
      while(T--)
      {
      solve();
      }
      return 0;
    }


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

int main()
{
    int n,i,temp;
    cin >> n;
    vector<int> a(100001,0);
    for(i = 0;i < n;++i){
        cin >> temp;
        ++a.at(temp);
    }
    int number = a.at(0)+a.at(1)+a.at(2),mode = 1;
    for(i = 1;i <= 99999;++i){
        temp = a.at(i-1)+a.at(i)+a.at(i+1);
        if(temp > number){
            number = temp;
        }
    }
    cout << number << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main() {
	int w, h, n;
	cin >> w >> h >> n;
	int xmax = w, xmin = 0, ymax = h, ymin = 0;
	int x, y, a;
	for (int i = 0; i < n; i++) {
		cin >> x >> y >> a;
		if (a == 1) {
			if (xmin <= x) {
				xmin = x;
			}
		}
		if (a == 2) {
			if (x <= xmax) {
				xmax = x;
			}
		}
		if (a == 3) {
			if (ymin <= y) {
				ymin = y;
			}
		}
		if (a == 4) {
			if (y <= ymax) {
				ymax = y;
			}
		}
	}
	if (xmax - xmin <= 0 || ymax - ymin <= 0)cout << 0 << endl;
	else cout << (xmax - xmin)*(ymax - ymin) << endl;
	return 0;
}

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

x, y = 0, sum(a)
m = 1e14

for i in range(n-1):
    x += a[i] 
    y -= a[i]
    if abs(x-y) < m:
        m = abs(x-y)

print(m)

Measured memory_bytes: 24932
import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val a = scanner.nextLong()
    val b = scanner.nextLong()
    println(calc(a, b))
}

fun calc(a: Long, b: Long): Long {
    if (a > b) {
        return a - 1
    }
    return a
}

Measured memory_bytes: 29600
N,K,S = map(int, input().split())

ans = [0] * N

if K != 0:
    for i in range(K):
        ans[i] = S

tmp = 0
if S % 2 == 1:
    tmp = 2
else:
    tmp = 10**9 - 1
for i in range(K, N):
    ans[i] = tmp
    
print(*ans)

Measured memory_bytes: 6644
n=int(input())
s=input()

sumW=s[1:].count("W")
sumE=s[1:].count("E")

p=[]
e=sumE
w=0
p.append(e)
for i in range(n-1):
    
    if s[i]=="W":
        w+=1
    if s[i+1]=="E":
        e-=1
    p.append(w+e)
    
print(min(p))
        
        

Measured memory_bytes: 15564
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    int n, k;
    cin >> n >> k;
    int ans = 0;
    rep(i, n) {
        int a;
        cin >> a;
        if(a >= k) ++ ans;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256