akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列配列の入力
            string[] inputStrArray = Console.ReadLine().Split(' ');

            var str = "";

            foreach (var inp in inputStrArray) {
                str += inp;
            }

            var num = int.Parse(str);

            string result = "";

            if (num % 4 == 0) {
                result = "YES";
            } else {
                result = "NO";
            }

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


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

using namespace std;

int main()
{
    int n,m,x;
    cin >> n >> m >>x;
    vector<vector<int>> a(n,vector<int>(m));
    vector<int> c(n);

    for(int i=0; i<n; i++){
        cin >> c.at(i);
        for(int j=0; j<m; j++) cin >> a.at(i).at(j);
    }

    int ans = 1000000000;
    int all = 1<<n;

    for(int mask =0; mask < all; mask++){
        vector<int> level(m);
        int cost =0;
        for(int i=0; i<n; i++){
            if((mask>>i)&1){
                cost += c.at(i);
                for(int j=0; j<m; j++){
                    level.at(j) += a.at(i).at(j);
                }
            }
        }
        bool ok = true;
        for(int j=0; j<m; j++){
            if(level.at(j) < x) ok = false;
        }
        if(ok) ans = min(ans,cost);
    }
    if(ans == 1000000000) cout << -1 << endl;
    else cout << ans << endl;
    
}

Measured memory_bytes: 3588
#include <iostream>
#include <list>
#include <algorithm>

using namespace std;

int main(int, char**)
{
	unsigned int a, b, n;
	std::cin >> n >> a >> b;
	unsigned int x, y, z;
	x = y = z = 0;

	for (unsigned int i = 0; i < n; ++i ) {
		unsigned int t;
		cin >> t;
		if (t <= a) ++x;
		else if (t <= b) ++y;
		else ++z;
	}

	unsigned int p = min (x, y);
	x = min(p, z);
	cout << x << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  long int a,b,c;
  scanf("%ld%ld",&a,&b);
  if(a==1 || b==1)
    c=1;
  else if(a%2!=0 && b%2!=0)
    c=a*b/2+1;
  else
    c=a*b/2;
  printf("%ld\n",c);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define fastio() ios_base::sync_with_stdio(false);
using namespace std;
typedef long long ll;

const int maxn = 1e3+5;
const ll MOD = 1e9+7;
bool mat[maxn][maxn];
ll dp[maxn][maxn];

int main(){
	int n, m; scanf("%d %d\n", &n, &m);
	for(int i = 1; i<=n; i++){
		for(int j = 1; j<=m; j++) mat[i][j] = (getchar() == '.');
		getchar();
	}
	for(int i = 1; i<=n; i++) if (!mat[i][1]) break; else dp[i][1] = 1;
	for(int i = 1; i<=m; i++) if (!mat[1][i]) break; else dp[1][i] = 1;
	for(int i = 2; i<=n; i++){
		for(int j = 2; j<=m; j++)
			if (mat[i][j]) (dp[i][j] = dp[i-1][j] + dp[i][j-1])%=MOD;
	}
	printf("%lld\n", dp[n][m]);
	return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;


const ll MAX = 510000;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
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()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    REP(i,n){
        cin >> a[i];
    }
    vector<ll> max(n);
    max[0]=0;
    ll m=0;
    REP(i,n){
        if(i==n-1)continue;
        if(a[i]>m){
            m=a[i];
        }
        max[i+1]=m;
    }
    ll ans=0;
    REP(i,n){
        if(a[i]<max[i]){
            ans+=max[i]-a[i];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 6424
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
 
ll mod=1000000007;
 
vector<ll>tree[100005];
ll dp[100005][2];
 
ll mul(ll x,ll y){
	ll ans=0;
	ll p=x;
	while(y!=0){
		if((y&1)){
			ans=(ans+p)%mod;
		}
		p=(p+p)%mod;
		y/=2;
		
	}
	return ans;
}
 
ll recur(ll node,ll par,ll color){
	ll cnt=1;
	if(dp[node][color]!=-1){
		return dp[node][color];
	}
	for(ll i=0;i<tree[node].size();i++){
		if(tree[node][i]!=par){
		if(color==0){
			ll x=recur(tree[node][i],node,1);
			//cnt=(cnt*x)%mod;
			cnt=mul(x,cnt);
		}
		else if(color==1){
			ll x=recur(tree[node][i],node,0);
			ll y=recur(tree[node][i],node,1);
			x=(x+y)%mod;
			
			cnt=mul(x,cnt);
		}
		}
		
	}
	dp[node][color]=cnt;
	return cnt;
	
}
 
int main(){
	ll n;
	cin>>n;
	memset(dp,-1,sizeof(dp));
	for(ll i=0;i<n-1;i++){
		ll a,b;
		cin>>a>>b;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}
	
	ll ans=0;
	
	ans=(recur(1,0,0)+recur(1,0,1))%mod;
	cout<<ans;
	
}

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

int main(){
    int N;
    cin >> N;
    string x="Three";
    for(int i=0; i<N ; i++){
        string s;
        cin >>s;
        if(s=="Y"){
            x="Four";
            break;
        }
    }
      
    cout << x << endl;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define INF 1e10
#define MOD 1e9+7
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; }
signed main(){
vector<int> a(3);
  rep(i,3)
  cin>>a[i];
  sort(all(a));
  cout<<a[0]*a[1]/2;
}

Measured memory_bytes: 256
import math
def int_ceil(src, range):
    return int(math.ceil(src/float(range)) * range)

def main():
    week = int(input())
    debt = 100000
    for _ in range(week):
        risi = debt * 0.05
        debt = int_ceil(debt + risi, 1000)
    print(debt)

if __name__ == "__main__":
    main()


Measured memory_bytes: 4728
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <list>
#include <cstring>
#include <stack>
   
using namespace std;

#define mod 1000000007

int main()
{
    int n;
    while(1){
        cin >> n;
        if(n == 0) break;
        vector<pair<string, string> > rule;
        for(int i = 0; i < n; i++){
            string a, b;
            cin >> a >> b;
            rule.push_back(make_pair(a, b));
        }
        string s, e;
        cin >> s >> e;
        set<string> madestr;
        madestr.insert(s);
        queue<pair<string, int> > qu;
        qu.push(make_pair(s, 0));
        int ans = -1;
        while(!qu.empty()){
            string nows = (qu.front()).first;
            int nowt = (qu.front()).second;
            qu.pop();
            if(nows == e){
                ans = nowt;
                break;
            }
            if(nows.length() >= e.length()) continue;
            for(int i = 0; i < n; i++){
                string nexts = nows;
                string searchstr = rule[i].first;
                string replacestr = rule[i].second;
                int searchsize = searchstr.length();
                int replacesize = replacestr.length();
                int index = 0;
                while(nexts.find(searchstr, index) != string::npos){
                    index = (int)nexts.find(searchstr, index);
                    nexts.replace(index, searchsize, replacestr);
                    index += replacesize;
                }
                // cout << nexts << endl;
                if(madestr.find(nexts) == madestr.end()){
                    madestr.insert(nexts);
                    qu.push(make_pair(nexts, nowt + 1));
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;

string S, ans;

void resolve()
{
    cin >> S;

    int len = S.length();
    ans = string(len, 'x');

    cout << ans << endl;
}

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


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n,i;
    scanf("%d",&n);
    int ara[n];
    for(i=0;i<n;i++){
        scanf("%d",&ara[i]);
    }
    double sum=0;
    for(i=0;i<n;i++){
        sum+=(1/(double)ara[i]);
    }
    printf("%lf\n",1/(double)sum);
    return 0;
}


Measured memory_bytes: 128
n=0
S={}
while True:
    L1=input().split( )
    L=[int(s) for s in L1]
    if L==[-1,-1,-1]:
        break
    S[n]=L
    n+=1
l=len(S)
for i in range(l):
    m=S[i][0]
    f=S[i][1]
    r=S[i][2]
    S[i].append("")
    if m==-1 or f==-1:
        S[i][3]=S[i][3]+"F"
    elif m+f>=80:
        S[i][3]=S[i][3]+"A"
    elif 80>m+f>=65:
        S[i][3]=S[i][3]+"B"
    elif 65>m+f>=50:
        S[i][3]=S[i][3]+"C"
    elif 50>m+f>=30 and r>=50:
        S[i][3]=S[i][3]+"C"
    elif 50>m+f>=30 and r<50:
        S[i][3]=S[i][3]+"D"
    else:
        S[i][3]=S[i][3]+"F"
for i in range(l):
    print(S[i][3])



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

int main() {
  int a,b;
  char op;
  
  cin >> a >> op >> b;
  
  if (op == '+'){
    cout << a + b << endl;
  }
  else if (op == '-'){
    cout << a - b << endl;
  }
}


Measured memory_bytes: 3620
# coding: utf-8
# Your code here!

# ITP1_7_B


# 小中大の順に
# a<b<cとする

import math

def compare(num,duplicate_num):
    a_b=list()
    # 1234
    for i in range(1,num):
        j = num - i
        if j <= i:
            break
        if j == duplicate_num:
            continue
        if j > 0:
            # print("i:"+str(i)+"j:"+str(j))
            a_b.append([i,j,duplicate_num])
    return a_b

while(True):
    c,sum=map(int,input().split())
    
    if c==0 and sum==0:
        break
    
    a_b_c=list()
    count = 0
    
    for i in reversed(range(c+1)):
        # if i <= math.ceil(c/3):
        #     break
        a_b_c.append(compare(sum-i,i))
    
    
    for result in a_b_c:
        for r in result:
            if r==sorted(r):
                # print(" ".join(list(map(str,r))))
                count+=1;
    
    print(count)
    



        
    # print(sorted(result))
    











Measured memory_bytes: 6756
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << #x << ':' << x << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

template<class T> class segtree {
	int n;
	vector<T> data;
	T id = 0;
	T operation(T a, T b) { return a + b; };
public:
	segtree(int _n) {
		n = 1;
		while (n < _n + 2) n <<= 1;
		data = vector<T>(2 * n, id);
	}
	void change(int i, T x) {
		i += n;
		data[i] = x;
		while (i > 1) {
			i >>= 1;
			data[i] = operation(data[i << 1], data[i << 1 | 1]);
		}
	}
	void add(int i, T x) { change(i, data[i + n] + x); }
	T get(int a, int b) {
		T left = id; T right = id;
		a += n; b += n;
		while (a < b) {
			if (a & 1) left = operation(left, data[a++]);
			if (b & 1) right = operation(data[--b], right);
			a >>= 1; b >>= 1;
		}
		return operation(left, right);
	}
	T get_all() { return data[1]; }
	T operator[](int i) { return data[i + n]; }
};

bool comp(pair<P, int> a, pair<P, int> b) {
	return a.first.second < b.first.second;
}

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

	int n, q;
	cin >> n >> q;
	vector<int> a(n);
	rep(i, n) {
		cin >> a[i];
		a[i]--;
	}
	vector<pair<P, int>> p(q);
	rep(i, q) {
		cin >> p[i].first.first >> p[i].first.second;
		p[i].first.first--; p[i].first.second--;
		p[i].second = i;
	}
	sort(all(p), comp);
	vector<int> lst(n, -1);
	segtree<int> seg(n);
	vector<P> ans(q);
	int prev = -1;
	rep(i, q) {
		int pf = p[i].first.first; int ps = p[i].first.second;
		for (int j = prev + 1; j <= ps; j++) {
			if (lst[a[j]] != -1) seg.add(lst[a[j]], -1);
			seg.add(j, 1);
			lst[a[j]] = j;
		}
		ans[i].second = seg.get(pf, ps + 1);
		prev = ps;
	}
	rep(i, q) ans[i].first = p[i].second;
	sort(all(ans));
	for (auto i : ans) cout << i.second << '\n';
}

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

struct edge { int to, cost; };
typedef pair<int, int> P;
typedef pair<string, int> SP;
#define rep(i, n) for(int i = 0; i < n; ++i)

const int INF = 1e9 + 7;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

ll gcd(ll x, ll y) {
    if (x == 0) {
        return y;
    }
    if (y == 0) {
        return x;
    }
    ll mod = x % y;
    if (mod == 0) {
        return y;
    }
    return gcd(y, mod);
}

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

    cout << min(N%K, K - (N%K)) << endl;

    return 0;
}


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

const static int MAX = 200000;
const static int SENTINEL = 2000000000;

int S[MAX], L[MAX/2+1], R[MAX/2+1], flag = 1;

void merge(int left, int mid, int right){
    int n1 = mid - left;
    int n2 = right - mid;
    for(int i = 0; i < n1; i++){
        L[i] = S[left + i];
    }
    L[n1] = SENTINEL;
    for(int i = 0; i < n2; i++){
        R[i] = S[mid + i];
    }
    R[n2] = SENTINEL;

    int i = 0, j = 0;
    while(L[i] != SENTINEL || R[j] != SENTINEL){
        if(L[i] == R[j]){
            flag = 0;
            return;
        }
        else if(L[i] < R[j]){
            S[left + i + j] = L[i];
            i++;
        }
        else{
            S[left + i + j] = R[j];
            j++;
        }
    }
}

void mergeSort(int left, int right){
    if(flag == 0)return;
    if(left + 1 < right){
        int mid = (left + right) / 2;
        mergeSort(left, mid);
        mergeSort(mid, right);
        merge(left, mid, right);
    }
}


int main(){
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> S[i];
    }
    mergeSort(0, n);
    if(flag == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    

    return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
using namespace std;
const int mx = 1e5+5;
int a[mx];
int main(int argc, char** argv) 
{
	int n;
	scanf("%d",&n);
	for(int i=1,v; i<=n; ++i)
		scanf("%d",&v),a[v-1]++,a[v+1]++,a[v]++;
	int ans = 0;
	for(int i=0; i<=mx; ++i)
		ans = (ans>a[i]?ans:a[i]);
	printf("%d\n",ans);
	return 0;
}






















Measured memory_bytes: 512
//#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;


// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T>
constexpr int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F>
constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T>
void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C>
void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U>
constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U>
constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C>
constexpr void reverse(C& c) { reverse(ALL(c)); }
template<typename C>
constexpr void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred>
constexpr void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9+7)
#pragma endregion


int main()
{
    map<string, int> d;
    string s;
    while(cin>>s) d[s]++;
    string ans1 = "";
    int mx_count1 = 0;
    string ans2 = "";
    int mx_count2 = 0;
    for (auto el : d) {
        if(el.second>=mx_count1) {
            ans1 = el.first;
            mx_count1 = el.second;
        }
        if(el.first.size()>=mx_count2) {
            ans2 = el.first;
            mx_count2 = el.first.size();
        }
    }
    cout << ans1 << " " << ans2 << endl;
    return 0;
}

Measured memory_bytes: 3188
import java.util.*

object MainKt {
	@JvmStatic
	fun main(args: Array<String>) {
		val mod: Long = Math.pow(10.0,9.0).toLong() +7L

		val scanner = Scanner(System.`in`)
		val n = scanner.nextInt()

		if (n==3) {
			println(61)
			System.exit(0)
		}
		var map = mutableMapOf<String, Long>()
		for(i in 0..63) if(i!=11 && i!=14 && i!=50) map.put(to3s(i), 1L)

		for(l in 4..n) {
			val newMap = mutableMapOf<String, Long>()
			map.forEach {
				for (i in 0..3) {
					val next4 = it.key + toChar(i)
					if (!next4.endsWith("AGC") && !next4.endsWith("ACG") && !next4.endsWith("GAC")) {
						if (!next4.startsWith('A') || !next4.endsWith('C') || !next4.contains('G')) {
							val next3 = next4.substring(1)
							val bef: Long = newMap.get(next3) ?: 0L
							newMap.put(next3, (bef+it.value)%mod)
						}
					}
				}
			}
			map = newMap
		}

		var ans = 0L
		map.forEach { ans = (ans+it.value)%mod }

		println(ans)

	}

	@JvmStatic
	fun toChar(num: Int): Char{
		return when(num){
			0->'A'
			1->'T'
			2->'C'
			3->'G'
			else->'?'
		}
	}

	@JvmStatic
	fun to3s(num: Int): String{
		return toChar(num/16).toString() + toChar((num/4)%4) + toChar(num%4)
	}
}

Measured memory_bytes: 37540
while 2>1:
	try:
		a,b,c,d,e,f = map(float, raw_input().split(" "))
		x=(c*e-b*f)/(e*a-b*d)
		y=(c*d-a*f)/(b*d-e*a)
		print "%.3f %.3f" % (x+0,y+0)
		
	except EOFError:
		break
	except ValueError:
		break

Measured memory_bytes: 4228
def main():
    s = input()

    sl = list(s)

    ss = set(sl)

    if len(ss) != 2:
        print('No')
        exit()

    if sl.count(list(ss)[0]) != 2:
        print('No')
        exit()

    print('Yes')

 
if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();

		if(a <= b) {
			System.out.println(a);
		}else {
			System.out.println(a-1);
		}

	}

}


Measured memory_bytes: 21716
#include <iostream>

using namespace std;

int main()
{
    char n[4];
    cin>>n[0]>>n[1]>>n[2]>>n[3];
    if(n[0]==n[1])
    {
        cout << "Bad" ;
    }
    else if(n[1]==n[2])
    {
        cout << "Bad" ;
    }
    else if(n[2]==n[3])
    {
        cout << "Bad" ;
    }
    else
    {
        cout << "Good" ;
    }
    return 0;
}


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

void main()
{
    auto s = readln.chomp.to!(dchar[]);
    auto xy = readln.split.to!(int[]);
    auto x = xy[0];
    auto y = xy[1];

    int buf;
    int[] os;
    foreach (c; s) {
        if (c == 'F') {
            ++buf;
        } else {
            os ~= buf;
            buf = 0;
        }
    }
    os ~= buf;

    int[] hs;
    int[] vs;
    foreach (i, o; os) {
        if (i&1)
            vs ~= o;
        else
            hs ~= o;
    }

    int hp, vp;
    if (hs.length > 0) {
        hp = hs[0];
        hs = hs[1..$];
    }

    hs.sort!"a > b";
    foreach (h; hs) {
        hp += hp > x ? -h : h;
    }
    if (hp != x) {
        writeln("No");
        return;
    }

    vs.sort!"a > b";
    foreach (v; vs) {
        vp += vp > y ? -v : v;
    }
    writeln(vp == y ? "Yes" : "No");
}

Measured memory_bytes: 2428
#include <bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define MAXN 200005
#define REP(temp, init_val, end_val) for (int temp = init_val; temp <= end_val; ++temp)
#define REPR(temp, init_val, end_val) for (int temp = init_val; temp >= end_val; --temp)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> intpair;
int read(){
    int f = 1, x = 0;
    char c = getchar();
    while (c < '0' || c > '9'){if(c == '-') f = -f; c = getchar();}
    while (c >= '0' && c <= '9')x = x * 10 + c - '0', c = getchar();
    return f * x; 
}
inline int lowbit(int x){
    return x & (-x);
}
inline int modadd(int x, int y){
    return (x + y >= MOD ? x + y - MOD: x + y);
}
inline int sgn(int x){
    return (x < 0 ? -1: (x > 0 ? 1: 0));
}
template<typename T>
T gcd(T a, T b){
    return (!b) ? a: gcd(b, a % b);
}
int poww(int a, int b){
    int res = 1;
    while (b > 0){
        if (b & 1) res = 1ll * res * a % MOD;
        a = 1ll * a * a % MOD, b >>= 1;
    }
    return res;
}
const int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
const int ddx[] = {-1, -1, -1, 0, 0, 1, 1, 1}, ddy[] = {-1, 0, 1, -1, 1, -1, 0, 1};

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


void init(){

}
void solve(){
    int n = read();
    cout << (n ^ 1) << endl;    
}
int main(){
    int T = 1;
    while (T--){
        init();
        solve();
    }
    return 0;
}

Measured memory_bytes: 3592
#include<stdio.h>
#include<math.h>
#define pi 3.141592

typedef struct {
	double x;
	double y;
}point;

void kock(int n, point p1, point p2);

int main(void){
	
	int n;
	scanf("%d", &n);
	
	point p1, p2;
	
	p1.x=0.00000000, p1.y=0.00000000;
	p2.x=100.00000000, p2.y=0.00000000;
    
    printf("0.00000000 0.00000000\n");
	kock(n, p1, p2);
	printf("100.00000000 0.00000000\n");
	
	return 0;
}

void kock(int n, point p1, point p2){
	
	if(n==0) return;
	
	/*p1, p2 から s, t, u を計算*/
	point s, t, u;
	double rad=60*pi/180;
	
	s.x=(2*p1.x+1*p2.x)/3;
	s.y=(2*p1.y+1*p2.y)/3;
	t.x=(1*p1.x+2*p2.x)/3;
	t.y=(1*p1.y+2*p2.y)/3;
	
	u.x=(t.x-s.x)*cos(rad)-(t.y-s.y)*sin(rad)+s.x;
	u.y=(t.x-s.x)*sin(rad)+(t.y-s.y)*cos(rad)+s.y;
	
	kock(n-1, p1, s);
	printf("%lf %lf\n", s.x, s.y);
    kock(n-1, s, u);
    printf("%lf %lf\n", u.x, u.y);
    kock(n-1, u, t);
    printf("%lf %lf\n", t.x, t.y);
    kock(n-1, t, p2);
	
}


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1010;

ll pw(ll x, ll y) {
    ll res=1;
    while (y) {
	if (y%2) {
	    res=res*x;
	    res%=mod;
	}
	x=x*x;
	x%=mod;
	y=y/2;
    }
    
    res%=mod;
    res+=mod;
    return res%mod;
}

ll add(ll x, ll y) {
    x %= mod;
    y %= mod;
    x += y;
    x %= mod;
    return x;
}


ll C[maxn][maxn];
ll fac[maxn*maxn], ifac[maxn*maxn], inv[maxn*maxn];

int n,a,b,c,d;


ll nck(int n, int k) {
    if (n<k) return 0;
    return C[n][k];
}

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

    //idk why my code doesn't work

    for (int i=0; i<=1000; i++) {
	C[i][0] = C[i][i] = 1;
	for (int j=1; j<i; j++) {
	    C[i][j] = (C[i-1][j] + C[i-1][j-1])%mod;
	}
    }
    assert(C[4][2]==6);

    fac[0]=ifac[0]=1;
    for (int i=1; i<=1000000; i++) {
	fac[i]=fac[i-1]*i%mod;
    }
    
    inv[1]=1;
    for (int i=2; i<=1000000; i++) {
	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;
    }

    for (int i=1; i<=1000000; i++) {
	ifac[i] = ifac[i-1]*inv[i]%mod;
    }
    assert(ifac[1] == 1);
    assert(inv[6] == ifac[3]);
    assert(inv[47] == pw(47, mod-2));



    cin>>n>>a>>b>>c>>d;

    vector<ll> dp(n+1, 0);//num ways to use j ppl at the current iteration
    dp[0] = 1;

    //iterate over group size
    for (int i=a; i<=b; i++) {
	vector<ll> nxt(n+1, 0);

	for (int j=0; j<=n; j++) {
	    if (dp[j] == 0) continue;
	    ll ways = 1;
	    for (int k=0; k<=n-j; k+=i) {
		if (k==0 || (c<=k/i && k/i<=d)) {
		    nxt[j+k] = add(nxt[j+k], dp[j]*ways);
		}

		//out of the remaining ppl, pick i ppl for the next group
		//now there are (k/i)+1 groups, and order that we picked them doesn't matter.
		ways = ways*nck(n-j-k, i)%mod*inv[k/i+1]%mod;
			
	    }
	}

	swap(nxt, dp);
    }


    cout<<dp[n]<<endl;    

    return 0;
}


Measured memory_bytes: 32128
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left
MOD = int(1e9)+7
INF = float('inf')


def solve():
    # n, m = [int(x) for x in input().split()]
    n = int(input())
    for i in range(1, n+1):
        x = i * (i - 1) // 2
        if x + i >= n:
            while n:
                y = min(n, i)
                n -= y
                print(y)
                i = y - 1
            return

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

azyxwvutsrqponmlkjihgfedcb

"""


Measured memory_bytes: 9932
#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 A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;
	C *= 2;
	int	total;
	if (A + B > C)
	{
		while (X > 0 && Y > 0)
		{
			total += C;
			X--;
			Y--;
		}
	}
	if (A > C)
	{
		while (X > 0)
		{
			total += C;
			X--;
		}
	}
	if (B > C)
	{
		while (Y > 0)
		{
			total += C;
			Y--;
		}
	}
	while (X > 0)
	{
		total += A;
		X--;
	}
	while (Y > 0)
	{
		total += B;
		Y--;
	}
	cout << total << endl;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll N, M, K;
ll A, B, C;
ll T;
vector<ll> S;
map<ll,ll, greater<ll> > cnt;
ll ans;


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

	cin >> N >> M >> K;
	cin >> A >> B >> C;
	cin >> T;

	ans = 0;

	for (int i = 0;i < M;i++){
		ll tmp; cin >> tmp;
		S.push_back(tmp);
	}

	for (int i = 1;i < M;i++){
		ll time = (S[i-1]-1)*B;
		ll sta = (T-time)/A + 1 + S[i-1];
		if(sta >= S[i]) sta = S[i];
		if(T >= time )ans += sta-S[i-1];
		else break;
		ll tmp = 0;
	   while(sta < S[i] && tmp <= K-M){
			ll rem = T - time - (sta-S[i-1])*C;
	   		ll num = rem / A + 1;
			if(rem < 0) break;
			sta += num;
			if(sta-1 >= S[i]) cnt[num-(sta-S[i])]++;
			else cnt[num]++;
			tmp++;
	   }	
	}

	if((N-1)*B <= T) ans++;
	ans--;

	K -= M;

	for(auto& i: cnt){
		if(K-i.second <= 0){ 
			ans += i.first*K;
		   	break;
		} else {
			ans += i.second*i.first;
			K -= i.second;
		}
	}

	cout << ans << endl;

	return 0;

}



Measured memory_bytes: 3344
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<ll,ll> P;
const ll MOD=10000;
const ll INF=1000000010;
const int MAX=100001;
int dx[8]={0,1,0,-1,1,-1,1,-1};
int dy[8]={1,0,-1,0,1,-1,-1,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    ll r=a%b;
    while(r){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}
int main(){
    ll n,x;cin>>n>>x;
    cout<<3*(n-gcd(n,x))<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(n); ++i)
#define REPR(i,n,m) for (int i=(n); i>=(m); --i)
using namespace std;
using LL = long long;
using LD = long double;
using PLL = pair<long long, long long>;
using PLD = pair<long double, long double>;
using VLL = vector<long long>;
using VLD = vector<long double>;
using VPLL = vector<PLL>;
using VPLD = vector<PLD>;

int main() {

    int n;
    cin >> n;

    int ans = 0;

    for (int i=1; i<=n-1; i++) {
        ans += (n-1) / i;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3596
//be name khoda

#include <bits/stdc++.h>
using namespace std;

#define pii pair<int, int>
#define mp make_pair
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

typedef long long ll;

const int N = 1;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m1 = 0, m2;
	cin >> n;
	for(int i = 0; i < n; i++)
	{
		int a, b;
		cin >> a >> b;
		if(a > m1)
		{
			m1 = a;
			m2 = b;
		}
	}
	cout << m1 + m2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main(){
  ll x, k, d;
  cin >> x >> k >> d;
  x = abs(x);
  if((x+k-1)/k >= d) cout << x - k * d << endl;  //x-k*dがオーバーフローしないように
  else{
    k -= x/d;
    x = x % d;
    if(k % 2) cout << d-x << endl;
    else cout << x << endl;
  }
}
    



Measured memory_bytes: 3608
import heapq
n,m = map(int,input().split())
a = list(map(int,input().split()))

q = []
for i in a: heapq.heappush(q,-i)
for i in range(m):
  tmp = -heapq.heappop(q)
  heapq.heappush(q, -(tmp//2))
print(-sum(q))

Measured memory_bytes: 14180
function Main(input) {
	input = input.split("\n");
	tmp = input[0].split(" ");
	var b = parseInt(tmp[0], 10);
	var c = parseInt(tmp[1], 10);
  var anser = '';
	if(b*c%2 == 0){
		anser = 'Even'
       }else{
       	anser = 'Odd';
       }
	console.log(anser);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;
using ll = long long;

int main() {
    int N;
    string s, t;
    cin >> N >> s >> t;
    for(int i = 0; i < N + 1; i++) {
        if(s.substr(i, N - i) == t.substr(0, N - i)) {
            cout << N + i << endl;
            //cout << s << t.substr(N - i, i) << endl;
            return 0;
        }
    }

    return 0;
}

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

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	
	cout << min(A * N, B) << endl;
	return 0;
}

Measured memory_bytes: 256
/*
    AUTHOR:hruday pabbisetty
    NIT ROURKElA
*/
#include <bits/stdc++.h>
#include <tr1/unordered_map>
using namespace std;
using namespace std::tr1;
#define opt ios_base::sync_with_stdio(0)
#define lli long long int
#define ulli unsigned long long int
#define I int
#define S string
#define D double
#define rep(i,a,b) for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define in(n) scanf("%lld",&n)
#define in2(a,b) scanf("%lld %lld",&a,&b)
#define in3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define out(n) printf("%lld\n",n)
#define inu(a) scanf("%lld",&a)
#define outu(a) printf("%llu",a)
#define ins(s) scanf("%s",&s)
#define outs(s) printf("%s",s)
#define mod 1000000007
#define inf 100000000000000
typedef long long       ll;
typedef pair<lli,lli>  plli;
typedef vector<lli>     vlli;
typedef vector<ulli>    vulli;
typedef vector<ll>      vll;
typedef vector<string>  vs;
typedef vector<plli>     vplli;
#define MM(a,x)  memset(a,x,sizeof(a));
#define ALL(x)   (x).begin(), (x).end()
#define P(x)       cerr<<"{"#x<<" = "<<(x)<<"}"<<endl;
#define P2(x,y)       cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<"}"<<endl;
#define P3(x,y,z)  cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<"}"<<endl;
#define P4(x,y,z,w)cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<", "#w" = "<<(w)<<"}"<<endl;
#define PP(x,i)     cerr<<"{"#x"["<<i<<"] = "<<x[i]<<"}"<<endl;
#define TM(a,b)     cerr<<"{"#a" -> "#b": "<<1000*(b-a)/CLOCKS_PER_SEC<<"ms}\n";
#define UN(v)    sort(ALL(v)), v.resize(unique(ALL(v))-v.begin())
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define sz() size()
#define nl cout<<"\n"
#define MX1 100005
#define MX2 1000005
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
lli dx[]={0,0,-1,1,-1,-1,1,1};
lli dy[]={1,-1,0,0,1,-1,-1,1};
lli power(lli a,lli b)
    {
    lli value;
    if(b==0)
        {
        return 1;
    }
    else if(b%2==0)
        {
        value=power(a,b/2)%mod;
        return(value*value)%mod;
    }
    else
        {
        value=power(a,b/2)%mod;
        return ((a*value)%mod*(value))%mod;
    }
}
int main()
{
      /*  #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif*/
    opt;
    lli n,y;
    cin>>n>>y;
    y/=1000;
    lli a=-1,b=-1,c=-1;
    lli i,j;
    rep(i,0,1+n)
    {
        rep(j,0,1+n)
        {
            if(i*10+j*5+(n-i-j)==y and i+j<=n)
            {
                a=i;
                b=j;
                c=n-i-j;
            }
        }
    }
    cout<<a<<" "<<b<<" "<<c;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max/32*15+208;

int main(){
    int x, y;
    while(cin >> x >> y){
        if(x < 0) x = -x;
        if(y < 0) y = -y;
        if(x == 0 && y == 0) {
            cout << 0 << "\n";
            continue;
        }
        if(x+y <= 2 && x < 2 && y < 2){
            cout << 1 << "\n";
            continue;
        }
        if(y & 1) swap(x, y);
        if((x%2 == 0) && (y%2 == 0)) cout << x+y << "\n";
        else if((y%2 == 0)) cout << x+y+(y == 0) << "\n";
        else cout << x+y-1 << "\n";
    }
    return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
int main()
{ 
        int n,m;
        cin>>n>>m;
        vector<string>a(n);
        for(int i=0; i<n; i++)
        {
            cin>>a[i];
        }
        vector<vector<int> >c(n);
        for(int i=0; i<n; i++)
        {
            c[i].resize(m);
        }

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

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	//static Map<Long,Long>map=new TreeMap<>();
	static String ans="";
    public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
       String a=sc.next();
       String b=sc.next();
       for(int i=0;i<a.length();i++) {
    	   ans+=a.substring(i, i+1);
    	   if(i+1>b.length())break;
    	   ans+=b.substring(i, i+1);
       }
       System.out.println(ans);
    }
}

Measured memory_bytes: 21844
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		HashSet<String> left = new HashSet<>();
		HashSet<String> right = new HashSet<>();
		left.add("q");
		left.add("w");
		left.add("e");
		left.add("r");
		left.add("t");
		left.add("a");
		left.add("s");
		left.add("d");
		left.add("f");
		left.add("g");
		left.add("z");
		left.add("x");
		left.add("c");
		left.add("v");
		left.add("b");

		right.add("y");
		right.add("u");
		right.add("i");
		right.add("o");
		right.add("p");
		right.add("h");
		right.add("j");
		right.add("k");
		right.add("l");
		right.add("n");
		right.add("m");

		while (true) {
			String str[] = br.readLine().split("");

			if (str[0].equals("#"))
				break;

			boolean le = false;
			int ans = 0;

			if (left.contains(str[0])) {
				le = true;
			} else {
				le = false;
			}

			for (int i = 1; i < str.length; i++) {
				if (left.contains(str[i])) {
					if (!le) {
						ans++;
					}
					le = true;
				} else {
					if (le) {
						ans++;
					}
					le = false;
				}
			}
			System.out.println(ans);
		}
	}

}


Measured memory_bytes: 27196
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repf(i, j, n) for (int i = (j); i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)

signed main() {
  string s;
  cin >> s;
  int n = s.size();
  map<char, int> cnt;
  for (auto&& u : s) cnt[u]++;
  int ret = n * (n - 1) / 2 + 1;
  for (auto&& u : cnt) ret -= u.second * (u.second - 1) / 2;
  cout << ret << endl;
}

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

using namespace std;

int frogCost(int h[],int d[],int n){
  if(n == 0)
    return d[0];
  else if(n == 1)
    return d[1];
  else if(d[n] != INT_MAX)
    return d[n];
    int diff1 = abs(h[n-1] - h[n]);
    int diff2 = abs(h[n-2] - h[n]);
    d[n] = min(diff1 + frogCost(h,d,n-1),diff2 + frogCost(h,d,n-2));
    return d[n];
}
int main(){
  int N,K;

  cin>>N>>K;
  int heights[N];
  int cost[N];
  for(int i=0;i<N;i++){
    int h;
    cin>>h;
    heights[i] = h;
    cost[i] = INT_MAX;
  }
cost[0] = 0;
  for(int j=0;j<N;j++){
    for(int k=1;k<=K;k++){
      if(j+k<N){
        int diff = abs(heights[j] - heights[j+k]);
        cost[j+k] = min(cost[j+k],cost[j]+diff);
      }
    }
  }
  cout<<cost[N-1];
  return 0;
}


Measured memory_bytes: 4408
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
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; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(bool b = true) {if(b) {cout << -1 << '\n'; exit(0);}}
template<class T> inline void fin(bool b = true, T e = 0) {if(b) {cout << e << '\n'; exit(0);}}
template<class T> T Roundup_div(T x, T y) {return (x+(y-1))/y;}
const ll INF = 1e18;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s, t; cin >> s >> t;
    int res = 0;
    REP(i,SZ(s)){
        if(s[i] != t[i]) res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
 
#define ll          long long
#define ld          long double
#define pb          push_back
#define pii         pair<int,int> 
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F         first
#define S           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define mem(x)      memset(x,0,sizeof(x));
#define what_is(x)  cerr << #x << " is " << x << endl;
#define rep(i,a,b)  for(int i=a;i<b;i++)
 
using namespace std;
 
void solve(){
    
    int n;
    cin>>n;

    ll a[n+1];
    a[0]=0;

    ll x;

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

    ll dp[n+1][n+1];
    mem(dp);

    for(int len=2;len<=n;len++){
        for(int i=1;i+len-1<=n;i++){
            ll mn=LONG_MAX;
            for(int k=i;k<i+len-1;k++){
                mn=min(mn,dp[i][k]+dp[k+1][i+len-1]+a[i+len-1]-a[i-1]);
            }
            dp[i][i+len-1]=mn;
            
        }
    }
    cout<<dp[1][n];

    

}
 
 
 
int main(){
    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
   
 
    int t=1,i=1;
   // cin>>t;
    
 
    while(t--){
       // cout<<"Case #"<<i++<<": ";
        solve();
    
    }
 
    return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>
int main()
{
	long long int h, n;
	scanf("%lld %lld", &h, &n);
	long long int i;
	long long int arr[100001];
	long long int sum = 0;
	for (i = 0; i < n; i++)
	{
		scanf("%lld", &arr[i]);
		sum += arr[i];
	}
	if (h - sum > 0)
		printf("No\n");
	else
		printf("Yes\n");
	return 0;
}

Measured memory_bytes: 896
#include <stdio.h>
int partition(int, int);
int A[100000];
int main(){
  int v,n,p,j;
 
  scanf("%d",&n);
  for(j=0; j<n; j++){
    scanf("%d", &A[j]);
  }
  p=0;
  v=partition(p, n-1);
  for(j=0; j<n; j++){
    if(j!=0){
      printf(" ");}
    if(v==j){
      printf("[%d]", A[j]);}
    else printf("%d", A[j]);
    }
  
  printf("\n");
  return 0;
}
 
int partition(int p, int r)
{
  int a,c,i,j;
  i = p-1;
  a = A[r];
  for(j=p; j<r; j++){
    if (A[j] <= a){
      i = i+1;
      c = A[i];
      A[i] = A[j];
      A[j] = c;
    }
  }
  c = A[i+1];
  A[i+1] = A[r];
  A[r] = c;
  return i+1;
}

Measured memory_bytes: 992
#include<bits/stdc++.h>
#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 fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int A[5], K;
//---------------------------------------------------------------------------------------------------
void _main() {
	rep(i, 0, 5) cin >> A[i];
	cin >> K;

	if (K < A[4] - A[0]) printf(":(\n");
	else printf("Yay!\n");
}

Measured memory_bytes: 256
import Control.Applicative
    
type Point = (Double, Double)

type Problem = (Point, Point)

type Result = Double
        
solve :: Problem -> Result

solve ((x1, y1), (x2, y2))
    = sqrt $ dx ** 2 + dy ** 2 where
        dx = x1 - x2
        dy = y1 - y2

output :: Result -> String

output result
    = show result
    
input :: IO Problem

input
    = do
        [x1, y1, x2, y2] <- map read.words <$> getLine
        return ((x1, y1), (x2, y2))

main :: IO ()

main
    = putStrLn.output =<< solve <$> input

Measured memory_bytes: 4060
#include <stdio.h>

int main(void)
{
    int N, A[20], B[20], C[20], i, n[2]={-1,-1}, sum=0;

    scanf("%d", &N);

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

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

    for(i=0; i<N-1; i++){
        scanf("%d", &C[i]);
    }

    for(i=0; i<N; i++){
        n[1] = A[i];

        sum += B[n[1]-1];

        if(n[1] == n[0] + 1){
            sum += C[n[0]-1];
        }

        n[0] = n[1];
    }

    printf("%d\n", sum);

    return 0;
}

Measured memory_bytes: 128
#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 n;
  cin >> n;
  int ans = (double)n / 2 + 0.5;
  cout << ans << endl;
  return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector< pair<int, int> > v(m);
  int mx = 0, mn = n + 1;
  for (int i = 0; i < m; i++) {
    cin >> v[i].first >> v[i].second;
    mx = max(mx, v[i].first);
    mn = min(mn, v[i].second);
  }
  cout << max(0, mn - mx + 1) << '\n';
  return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
using namespace std;
const int MOD = (int)1e9 + 7;

map<long long, int> prime_factorize(long long n) {
    map<long long, int> res;
    for (long long p = 2; p * p <= n; ++p) {
        while (n % p == 0) { ++res[p]; n /= p; }
    }
    if (n != 1) res[n] = 1;
    return res;
}

int main() {
    int n; cin >> n;
    vector<int> cnt(n + 1);
    for (int i = 1; i <= n; i++) {
        for (auto &p: prime_factorize(i)) cnt[p.first] += p.second;
    }
    long long ans = 1;
    for (int i = 2; i <= n; i++) {
        ans *= (cnt[i] + 1);
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256