akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Sep 20 21:52:34 JST 2020
 **/

template <class T> bool chmin(T& a, const T& b) { return a > b ? a = b, true : false; }
template <class T> bool chmax(T& a, const T& b) { return a < b ? a = b, true : false; }

inline long long mod(long long a, long long m) { return (a % m + m) % m; }

using namespace std;
// 拡張 Euclid の互除法
// ap + bq = gcd(a, b) となる (p, q) を求め、d = gcd(a, b) をリターンします
long long extGcd(long long a, long long b, long long& p, long long& q) {
    if (b == 0) {
        p = 1;
        q = 0;
        return a;
    }
    long long d = extGcd(b, a % b, q, p);
    q -= a / b * p;
    return d;
}

// 中国剰余定理
// リターン値を (r, m) とすると解は x ≡ r (mod. m)
// 解なしの場合は (0, -1) をリターン
pair<long long, long long> ChineseRem(long long b1, long long m1, long long b2, long long m2) {
    long long p, q;
    long long d = extGcd(m1, m2, p, q);  // p is inv of m1/d (mod. m2/d)
    if ((b2 - b1) % d != 0) return make_pair(0, -1);
    long long m = m1 * (m2 / d);  // lcm of (m1, m2)
    long long tmp = (b2 - b1) / d * p % (m2 / d);
    long long r = mod(b1 + m1 * tmp, m);
    return make_pair(r, m);
}

Int solve(Int n) {
    Int m = 2 * n;
    Int ans = 2 * n - 1;
    std::vector<Int> ps;
    for (Int x = 2; x * x <= m; x++) {
        if (m % x) continue;
        ps.push_back(x);
        m /= x;
        while (m % x == 0) {
            ps.back() *= x;
            m /= x;
        }
    }
    if (m != 1) ps.push_back(m);
    dump(ps);
    REP(S, 1 << ps.size()) {
        Int a = 1, b = 1;
        REP(i, ps.size()) {
            ((S >> i & 1) ? a : b) *= ps[i];
        }
        assert(std::gcd(a, b) == 1);
        Int p, q;
        extGcd(a, -b, p, q);
        dump(a, b, p, q);
        Int l = std::lcm(a, b);
        while (a * p <= 1) p += l;
        // if (p == 0) p += l;
        // if (q == 0) q += l;
        chmin(ans, p * a);
        // dump(a, b, p, q, p * a, q * b);
        // assert(p * a == q * b + 1);
    }
    return ans;
}

signed main() {
    Int n;
    std::cin >> n;
    std::cout << solve(n) << std::endl;

    // REP(n, 1, 100) {
    //     REP(i, 1, 2 * n) {
    //         Int sum = i * (i + 1) / 2;
    //         if (sum % n == 0) {
    //             dump(n, i);
    //             assert(solve(n) == i);
    //             break;
    //         }
    //     }
    // }
}


Measured memory_bytes: 3652
def main():
    N = int(input())
    A = [0] * N
    B = [0] * N
    for n in range(N):
        A[n], B[n] = map(int, input().split())

    C = sorted(zip(A, B), key=lambda x: x[1])

    cumsum = 0
    for n in range(N):
        cumsum += C[n][0]
        if cumsum > C[n][1]:
            print('No')
            return
    print('Yes')


main()


Measured memory_bytes: 34992
#include<stdio.h>
using namespace std;

int main()
{
	int N;
	long long int T, t[200010], wa = 0, sa = 0;
	scanf("%d%lld", &N,&T);
	for (int i = 0; i < N; i++) {
		scanf("%lld", &t[i]);
	}
	wa = N * T;
	for (int i = 0; i < N-1; i++) {
		if (t[i] + T > t[i + 1]) {
			sa += t[i] + T - t[i + 1];
		}
	}
	printf("%lld", wa-sa);
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

int main() {
    int N;
    cin >> N;
    int cnt = 0;
    int ans = 0;
    for(int i = 1;i <= N;i+=2){
        cnt = 0;
        for(int j = 1;j <= i;++j){
            if(i%j==0){
                cnt++;
            }
        }
        if(cnt == 8){
            ans++;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
bool dp[81][81][80*160+200];
int a[80][80];
int b[80][80];
int main(){
    int h,w;
    cin >> h >>w;
    rep(i,h){
        rep(j,w){
            cin >> a[i][j];
        }
    }
    rep(i,h){
        rep(j,w){
            cin >> b[i][j];
        }
    }
    dp[0][0][abs(a[0][0]-b[0][0])]=true;
    rep(i,h){
        rep(j,w){
            rep(k,80*160+1){
                if(dp[i][j][k]==false){
                    continue;
                }
                if(j==w-1 && i==h-1){
                    continue;
                }
                else if(j==w-1){
                    dp[i+1][j][k+abs(a[i+1][j]-b[i+1][j])] = true;
                    dp[i+1][j][abs(k-abs(a[i+1][j]-b[i+1][j]))] = true;
                }
                else if(i==h-1){
                    dp[i][j+1][k+abs(a[i][j+1]-b[i][j+1])] = true;
                    dp[i][j+1][abs(k-abs(a[i][j+1]-b[i][j+1]))] = true;
                }
                else{
                    dp[i+1][j][k+abs(a[i+1][j]-b[i+1][j])] = true;
                    dp[i+1][j][abs(k-abs(a[i+1][j]-b[i+1][j]))] = true;
                    dp[i][j+1][k+abs(a[i][j+1]-b[i][j+1])] = true;
                    dp[i][j+1][abs(k-abs(a[i][j+1]-b[i][j+1]))] = true;
                }
            }
        }
    }
    for(int i = 0;i<80*160+200;i++){
        if(dp[h-1][w-1][i]){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 81664
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] num = new int[9];
		boolean key = false;
		for (int i = 0; i < 9; i++) num[i] = sc.nextInt();
		for (int a1 = 0; a1 <= 100 ; a1++) {
			int b1 = num[0] - a1;
			int b2 = num[1] - a1;
			int b3 = num[2] - a1;
			int a2 = num[3] - b1;
			int a3 = num[6] - b1;
			if (a2 + b2 == num[4] 
					&& a2 + b3 == num[5] 
					&& a3 + b2 == num[7] 
					&& a3 + b3 == num[8]) {
				key = true;
				break;
			}
		}
		System.out.println(key?"Yes":"No");
	}
}

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

#define f for( int i=0; i<n; i++)
#define e '\n'
#define ll long long int

#define ii InputInteger()
#define il InputLong()
#define is InputString()

using namespace std;

void Ia(int arr[], int n)
{
    f
    {
        cin >> arr[i];
    }
}
void Pa(int arr[], int n)
{
    f
    {
        cout << arr[i] << e;
    }
}
int InputInteger()
{
    int n;
    cin >> n;
    return n;
}
ll InputLong()
{
	ll n;
	cin >> n;
	return n;
}
string InputString()
{
	string s;
	cin >> s;
	return s;
}
void Ca(int arr[], int n)
{
    for(int i=0; i<n; i++)
    {
        arr[ i ] = 0;
    }
}
int main()
{
    ios_base::sync_with_stdio( false );
    ll a = il, b = il;
    if ((a+b) % 2) cout << "IMPOSSIBLE";
    else cout << (a+b) / 2;
    return 0;
}




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

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

    if(N[0] == N[1] && N[1] == N[2] && N[0] == N[2]) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
/*---> 11 May 2020 <--- > 01:35:48 <---*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
//template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename   enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
const int N=1e5+5;

int32_t main(){__
	string s,t;
	cin>>s>>t;
	t.pop_back();
	if(s==t)
		cout<<"Yes\n";
	else
		cout<<"No\n";
return 0;
}

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

int main(){
  int N;
  cin >> N;
  int d[N],i,j,sum=0;
  for(i=0;i<N;i++) cin >> d[i];
  
  for(i=0;i<N;i++){
    for(j=0;j<i;j++){
      sum += d[i]*d[j];
    }
  }
  
  cout << sum << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Map<Integer, Integer> m = new HashMap<Integer, Integer>();
        for (int i = 1 ; i <= n ; i++) {
            int y = i;
            for (int j = 2 ; j <= i ; j++) {
                while (y % j == 0 ) {
                    if (m.containsKey(j)) {
                        m.put(j, m.get(j) + 1);
                    } else {
                        m.put(j, 2);
                    }
                    y /= j;
                }
            }
        }
        long ans = 1;
        for (Integer c : m.values()) {
            ans *= (long) c;
            ans %= 1000000007;
        }
        System.out.println(ans);
    }

}

Measured memory_bytes: 22740
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int N = sc.nextInt();
        int M = sc.nextInt();
        Map<Integer, List<Integer>> map = new HashMap<>();
        for (int i = 0; i < N; ++i) {
            map.put(i, new ArrayList<>());
        }
        for (int i = 0; i < M; ++i) {
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            map.get(a).add(b);
        }

        List<Integer> firstList = map.get(0);
        for (int first : firstList) {
            List<Integer> secondList = map.get(first);
            if (secondList.contains(N - 1)) {
                _out.println("POSSIBLE");
                return;
            }
        }
        _out.println("IMPOSSIBLE");
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

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

int main() {
	// your code goes here
	int w,h,x,y,r;
	cin>>w>>h>>x>>y>>r;
	bool flag=true;
	if(x<r||x>w-r) flag=false;
	if(y<r||y>h-r) flag=false;
	cout<<((flag)? "Yes":"No")<<endl;
	return 0;
}


Measured memory_bytes: 3104
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{   int p,q,r;
 cin>>p>>q>>r;
 if(min(p,q)==p){
 cout<<p+min(q,r)<<endl;
 }else if(min(p,q)==q){
 cout<<q+min(p,r);
 }
   
 }
 
    
    

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   https://www.boost.org/doc/



Measured memory_bytes: 256
' (N * (L + (L + N - 1))) / 2
' (N * (2 * L + N - 1)) / 2
' Imports System.Collections.Generic
' Imports System.Globalization
' Imports System.IO
' Imports System.Linq
' Imports System.Text
' Imports System.Text.RegularExpressions

Class Main
    Public Shared Sub Main()
        Dim N, L As Integer
        Dim arr() As String
        arr = Split(Console.ReadLine())
        N = arr(0) : L = arr(1)
        Dim ans As Integer = (N * (2 * L + N - 1)) / 2
        If 0 < L
            ans -= L
        ElseIf L + N - 1 < 0
            ans -= L + N - 1
        End If
        Console.WriteLine(ans)
        Return
    End Sub
End Class

Measured memory_bytes: 28400
x,y=map(int,input().split())
l=[[4,6,9,11],[2],[1,3,5,7,8,10,12]]
for i in l:
  if x in i:xx=l.index(i)
  if y in i:yy=l.index(i)
print('YNeos'[xx!=yy::2])


Measured memory_bytes: 2940
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
ceil = math.ceil
a,b = ma()
wh= "."
bl = "#"
if a>b:
    a,b = b,a
    wh,bl=bl,wh
area = [[wh]*100 for i in range(100)]
def cycle(y,x,f=True):
    for i in range(y,y+3):
        for j in range(x,x+3):
            area[i][j]=bl
    if f:
        area[y+1][x+1] = wh
def solve():
    cnt=0
    iy = 0
    ix = 0
    while cnt<b:
        if cnt+1<a:
            cycle(iy,ix)
        else:
            cycle(iy,ix,f=False)
        ix+=4
        if ix>=95:
            ix = 0
            iy+=4
        cnt+=1

solve()
print(100,100)
for ar in area:
    print("".join(ar))


Measured memory_bytes: 9480
#include <bits/stdc++.h>
using namespace std;
int n, m, x[100009];
int main() {
	scanf("%d%d", &n, &m);
	for(int i = 0; i < n; i++) scanf("%d", &x[i]);
	set<int> s;
	for(int i = n - 1; i >= 0 && s.size() < m; i--) {
		if(!s.count(x[i])) {
			printf("%d\n", x[i]);
			s.insert(x[i]);
		}
	}
	return 0;
}

Measured memory_bytes: 6016
#include <iostream>

using namespace std;

#define abs(a) ((a) > 0? (a) : (-a))
#define N_MAX 100000
int N;
long long a[N_MAX];

int main(void){
	cin >> N;
	for (int i=0; i<N; i++){
		cin >> a[i];
	}
	if (a[N-1] != 2) {
		cout << "-1" << "\n";
		return 0;
	}
	long long max = 3;
	long long min = 2;
	for (int i=N-2; i>=0; i--){
		
		if (a[i] >= min){
			min = (a[i]/min) * a[i];
			if (min > max) {
				cout << "-1" << "\n";
				return 0;
			}
			max = (a[i]/min) * a[i] + a[i] - 1;
			//max = min + a[i] - 1;
		}
		else {
			min  = (((min-1) / a[i])+1)*a[i];
			if (min > max) {
				cout << "-1" << "\n";
				return 0;
			}
			max  = ((max/ a[i]))*a[i] +a[i] - 1;
			//max = min + a[i] - 1;
		}
	}
	cout << min << " " << max << " " << "\n";

	return 0;
}

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

int main(){
    int A, B; cin >> A >> B;

    if(A % 2 == 0 || B % 2 == 0){
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

}

Measured memory_bytes: 256
///              B I S M I L L A H I R  R A H M A N I R  R A H I M

#include<bits/stdc++.h>
using namespace std;
typedef bool                   boo;
typedef int                    li;
typedef long                   il;
typedef unsigned long          ul;
typedef long long int          ll;
typedef unsigned long long     ull;
typedef double                 dd;
typedef string                 str;
#define vli                    vector<li>
#define vll                    vector<ll>
#define sli                    set<li>
#define sll                    set<ll>
#define pli                    pair<li, li>
#define pll                    pair<ll, ll>
#define vpi                    vector<pair<li, li>>
#define vpl                    vector<pair<ll, ll>>
#define mpl                    map<ll, ll>
#define wt                     ll t; cin>>t; while(t--)
#define input(a,n)             for(int i=0;i<n;i++) cin>>a[i];
#define lp(a, i, b)            for(ll i=a; i<b; i++)
#define rlp(a, i, b)           for(ll i=a; i>=b; i--)
#define sz(x)                  x.size()
#define len(z)                 z.begin(), z.end()
#define ci(x)                  cin>>x;
#define co(x)                  cout<<x nl
#define mem(z, l)              memset(z, l, sizeof(z))
#define MP                     make_pair
#define pb                     push_back
#define F                      first
#define S                      second
#define nl                     <<endl
#define nll                    cout<<endl
#define sp                     <<" "<<
#define sl                     <<" "
#define cy                     cout<<"YES"<<nl
#define cn                     cout<<"NO"<<nl
#define rn                     return
#define good_bye               return 0
#define PI                     3.1415926536
#define gcd(a,b)               __gcd(a,b)
#define lcm(a,b)               (a*(b/gcd(a,b)))
#define faster                 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define input_txt()            freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
const double eps=              1e-9;
const int inf=                 2000000000;
const ll infLL=                9000000000000000000;
//ll Pow(ll P, ll Q)           { ll R=1; for(ll I=1; I<=Q; I++) R*=P; rn R; }
//void dfs(ll K)               { vis[K]=true; for(auto J: v[K]) { if(!vis[J]) dfs(J); } }
//void seive(ll MX)            { S.pb(2); for(ll I=3; i<=MX; i+=2) { if(!vis[I]) { S.pb(I); for(ll J=I*I; j<=MX; J+=(2*I)) vis[J]=false; } } }
//bool isPrime(ll n)           { if(n%2==0) rn false; for(ll i=3; i*i<=n; i+=2) { if(n%i==0) rn false; } rn true; }
//----------------------------------------LET'S BEGIN-----------------------------------------------------------------------
const int mX = 1e6+123;
str s, s1, s2;

void case_i()
{
    ci(s);
    s1+=s[5]; s1+=s[6];
    s2+=s[8]; s2+=s[9];
    if(stoi(s1)>4) cout<<"TBD" nl;
    else if(stoi(s1)<4) cout<<"Heisei" nl;
    else
    {
        if(stoi(s2)<=30) cout<<"Heisei" nl;
        else cout<<"TBD" nl;
    }
}

int main()
{
    faster;
//    input_txt();
//    wt
      case_i();
    good_bye;
}
///           _5_4_8_8_1_9_                ///


Measured memory_bytes: 3608
#include<map>
    #include<vector>
    #include<cstdio>
    #include<cstring>
    #include<iostream>
    using namespace std;
    map<int ,int> n1;
    vector<int > a;
    int main()
    {
    	int n,m;
    	cin>>n;
    	for(int i=0;i<n;i++)
    	{
    		int t;
    		cin>>t;
    		n1[t]++;
    	}
    	cin>>m;
    	for(int i=0;i<m;i++)
    	{
    		int t;
    		cin>>t;
    		a.push_back(t);
    	}
    	for(int i=0;i<a.size();i++)
    	{
    		if(n1[a[i]]<=0)
    		{puts("NO");	return 0;}	
    		n1[a[i]]--;
    	}
    	puts("YES");
    	return 0;	
    }

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

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;

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

    int ans = 0;

    while(N != 0){
        N /= K;
        ans++;
    }

    cout << ans << endl;
return 0;
}

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

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int>d( N );
	map<int, bool>MIB;
	for( size_t i = 0; i < N; i++ ) {
		cin >> d[i];
		MIB[d[i]] = i % 2;
	}
	sort( d.begin(), d.end() );
	int ans = 0;
	for( size_t i = 0; i < N; i++ ) {
		if( i % 2 == 0 && MIB[d[i]] == 1 ) {
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1005;
int main()
{
	int h[maxn];
	int n,t,a;
	double b[maxn];
	cin>>n;
	cin>>t>>a;
	for(int i=1;i<=n;i++)
	{
		cin>>h[i];
		b[i]=t*1.0-h[i]*0.006;
	}
	int ans=1;
	double minv;
	minv=abs(b[1]-a*1.0);
	for(int i=2;i<=n;i++)
	{
		if(minv>abs(b[i]-a*1.0)){
			ans=i;
			minv=abs(b[i]-a*1.0);
		}
	}	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int up(const void *a,const void *b){
  return *(int *)a - *(int *)b;
}


int main(void){
  int n;
  scanf("%d",&n);
  
  int d[n];
  for(int i = 0;i < n;i ++){
    scanf("%d",&d[i]);
  }
  
  qsort(d,n,sizeof(int),up);
  
  /*for(int i = 0;i < n;i ++){
    printf("%d\n",d[i]);
  }*/
  
  printf("%d\n",d[n/2] - d[n/2 - 1]);
  
  return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <vector>

int main()
{
	int N = 0;
	std::size_t ans = 0;
	std::cin >> N;
	
	std::string  S;
	std::cin >> S;

	for (int i = 1; i < S.size(); i++)
	{
		if (S[i] == S[i - 1])
		{
			S.erase(S.begin() + i -1);
			i = i -1;
		}
	}

	ans = S.size();
	
	std::cout << ans << std::endl;

	return 0;
}


Measured memory_bytes: 512
n = int(input())
R = [int(input()) for i in range(n)]

val_min  = R[0]
diff_max = -1e+9
for i in range(1,n):
    diff_max = max(diff_max, R[i]-val_min)
    val_min  = min(val_min, R[i])
    
print(diff_max)


Measured memory_bytes: 13628
import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

bool cross(real[] a, real[] b, int y)
{
    a=a[y..$];b=b[y..$];
    foreach(_;0..2)
    {
        foreach(i;0..2)
            if(a[0]<=b[i*2] && b[i*2]<=a[2])
                return true;
        swap(a,b);
    }
    return false;
}
bool overrap(real[] a, real[] b)
{
    return cross(a,b,0) && cross(a,b,1);
}

void main()
{
    foreach(s;stdin.byLine())
    {
        auto m = s.split().map!(to!real).array();
        writeln(overrap(m[0..4], m[4..$])?"YES":"NO");
    }
}

Measured memory_bytes: 1092
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int solve( int ,int ); // x ,y

int a ,b ,map[16][16]={} ,memo[16][16];

int main(){
  int n ,x ,y;
  for( ; ; ){
    cin >> a >> b; //w, h
    if( !a && !b ) break;
    
    memset( memo, 0, sizeof(memo) );
    memset( map, 0, sizeof(map) );
    
    cin >> n;
    for( int i=0 ; i<n ; i++ ){
      cin >> x >> y;
      map[--x][b-y] = 1;
    }
    
    cout << solve( 0,b-1 ) << endl; // x ,y
  }
}

int solve( int x ,int y ){

  if( y < 0 || x == a ) return 0;
  if( map[x][y] == 1) return 0;
  if( memo[x][y] > 0 ) return memo[x][y];
  if( y == 0 && x == a-1 ) return 1;
  
  return memo[x][y] = solve( x+1 ,y ) + solve( x ,y-1 );
}

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

#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define ffor(i,a,b) for(ll i=(a);i<(ll)(b);++i)
#define rep(i, n) ffor(i,0,n)
#define All(obj) (obj).begin(),(obj).end()
#define INF ((ll)1e9+7)
#define c(a) cout<<a<<"\n";
using namespace std;
const int N = 100005;

int main() {
	speed;
	int h, w;
	cin >> h >> w;
	vector<string>s(h);
	rep(i, h) {
		cin >> s[i];
		s[i] = '#' + s[i] + '#';
	}
	rep(i, w+2) {
		cout << '#';
	}
	ed;
	rep(i, h) {
		c(s[i]);
	}
	rep(i, w+2) {
		cout << '#';
	}
	ed;
	return 0; 
}



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

int main()
{
  int n, k, r, s, p;
  cin >> n >> k >> r >> s >> p;
  string t, u;
  cin >> t;

  for (int i = 0; i < n; i++) {
    switch (t[i]) {
    case 'r': u += 'p'; break;
    case 's': u += 'r'; break;
    case 'p': u += 's'; break;
    }
  }

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (i < k || u[i] != u[i - k]) {
      switch (u[i]) {
      case 'r': ans += r; break;
      case 's': ans += s; break;
      case 'p': ans += p; break;
      }
    } else if (i + k < n) u[i] = ' ';
  }
  cout << ans << endl;
}


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

using namespace std;

int main(void)
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int A, B ,C, N, sum;
  cin >> A >> B >> C >> N;
  if (N - A <= 0)
    cout << N << '\n';
  else{
    N -= A;
    if (N - B <= 0)
      cout << A << '\n';
    else{
      N -= B;
      cout << A - N << '\n';
    }
  }
  return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

int main(){
    int m,n,a;
    long long sum =0;
    cin >> n >> m;
    rep(i,m){
        cin >> a;
        sum += a;
        if(sum > n){
            cout << -1 <<endl;
            return 0;
        }
    }
    cout << n - sum << endl;
    return 0;

}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  int even = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a % 2 == 0) even++;
  }
  
  cout << pow(3, n) - pow(2, even) << '\n';
}

Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
using namespace std;
#define LOCAL  1
#define UPLOAD 2
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
template <class T = long long> T input(){T x;cin >> x;return x;}
template <class T> void output(T x){cout << x << endl;}
#define debug(x) cerr << #x<< ": " << x<< '\n';

//#define int long log

int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

  int N = input();
  int K = input();
  int Q = input();
  map<int, int> countMap;
  for(int i=0;i<Q;i++){
    int a = input();
    countMap[a] += 1;
  }

  

  for(int i=0;i<N;i++){
    if(countMap[i+1] > Q - K){
      output("Yes");
    }
    else{
      output("No");
    }
  }

  return 0;
}

Measured memory_bytes: 5376
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<string>
#include<stack>
#include<set>
#define int long long
using namespace std;
signed main() {
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a.begin(),a.end());
    int count=0;
    for(int i=0;i<n;i++) {
        for(int j=i+1;j<n;j++) {
            if(i==j) {
                continue;
            }
            if(a[j]==a[i]) continue;
            for(int k=j+1;k<n;k++) {
                if(k==j||k==i) {
                    continue;
                }
                if(a[k]==a[i]||a[k]==a[j]) continue;
                if(a[k]<a[j]+a[i]) {
                    count++;
                }
            }
        }
    }
    cout<<count<<endl;
    return 0;
}



Measured memory_bytes: 3624
#include <stdio.h>
main(){
  while(1){
  int n,i;
  scanf("%d",&n);
  if(n==0) break;
  int a[n],b[n],at=0,bt=0;
  for(i=0;i<n;i++){
    scanf("%d%d",&a[i],&b[i]);
  }

  for(i=0;i<n;i++){
    if(a[i]>b[i]) at+=a[i]+b[i];
    else if(a[i]<b[i]) bt+=a[i]+b[i];
    else {
      at+=a[i];
      bt+=b[i];
    }
  }
 
 printf("%d %d\n",at,bt); 

 }
return 0; 
}

Measured memory_bytes: 0
#include <stdio.h>

int main() {
	int temp[10];
	int input;

	int i = 0;
	
	while(scanf("%d", &input) != EOF) {
		if(input != 0) {
			temp[i] = input;
			i++;
		}

		else {
			i--;
			printf("%d\n", temp[i]);
		}
	}

	return 0;
}

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

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

  string s;
  cin >> s;

  vector<int> v(4);
  for (int i = 0; i < 4; i++)
  {
    v.at(i) = s.at(i) - '0';
  }
  
  for (int tmp = 0; tmp < (1 << 3); tmp++)
  {
    int sum = v.at(0);
    bitset<3> bs(tmp);
    for (int i = 0; i < 3; i++)
    {
      if(bs.test(i)) sum += v.at(i+1);
      else sum -= v.at(i+1);
    }
    if(sum == 7)
    {
      string s;
      s += to_string(v.at(0));
      for (int j = 0; j < 3; j++)
      {
        if(bs.test(j)) s += '+';
        else s += '-';
        s += to_string(v.at(j+1));
      }
      cout << s << "=7" << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
A = list(map(lambda x:list((int(x),1)), input().split()))
#print(A)
for i in range(m):
    b,c = map(int, input().split())
    A.append([c,b])
A.sort(reverse = True)
sum = 0
rem = n
for i in range(len(A)):
    sum += A[i][0] * min(A[i][1],rem)
    rem -= min(A[i][1],rem)
    if rem == 0: break
print(sum)

Measured memory_bytes: 35320
#include <bits/stdc++.h>
#define MAXN 330
#define pii pair<int, int>
#define pll pair<long long, pair<long long, long long>>
#define ff first
#define ss second
#define ll long long
#define in_range(x, y, n) (x >= 0 and x < n and y >= 0 and y < n)
using namespace std;
const int mod = 1e9 + 7;
const ll oo = 1e17 + 7;


int main()
{
    ios_base::sync_with_stdio(false);
    string s;
    ll n, ans;
    cin >> n;

    if (n <= 6) ans = 1;
    else if(n <= 11) ans = 2;
    else {
        ans = ((n)/11)*2;
        n%11 <= 6? ans++: ans+=2;
        if (n%11 == 0) ans--;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(void)
{
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    int dx = tx - sx;
    int dy = ty - sy;

    REP(i,dx){
        cout << "R";
    }
    REP(i,dy){
        cout << "U";
    }
    REP(i,dx){
        cout << "L";
    }
    REP(i,dy){
        cout << "D";
    }
    cout << "D";
    REP(i, dx + 1){
        cout << "R";
    }
    REP(i,dy+1){
        cout << "U";
    }
    cout << "L";
    cout << "U";
    REP(i,dx+1){
        cout << "L";
    }
    REP(i,dy+1){
        cout << "D";
    }
    cout << "R" << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
import math
sys.setrecursionlimit(int(1e6))

N, M = map(int, input().split())
s = [0]*M
c = [0]*M
for i in range(M):
    s[i], c[i] = map(int, input().split())

digits = [-1]*N
fault = False
for i in range(M):
    d = s[i]-1
    if digits[d] >= 0 and (digits[d] != c[i]):
        fault = True
        break
    digits[d] = c[i]

if fault:
    print(-1)
    sys.exit()

if (N>1) and (digits[0] == 0):
    print(-1)
    sys.exit()

ans = 0
for i in range(N):
    b = 10 ** (N - i - 1)
    n = digits[i] if digits[i] >= 0 else 0
    ans = ans + n * b

min_ans = 10 ** (N - 1) if N > 1 else 0
if ans < min_ans:
    ans = ans + min_ans

print(ans)


Measured memory_bytes: 3064
def rot(s):
    if s=="E":
        return [4,2,1,6,5,3]
    elif s=="W":
        return [3,2,6,1,5,4]
    elif s=="S":
        return [5,1,3,4,6,2]
    elif s=="N":
        return [2,6,3,4,1,5]
    
label = tuple(map(int,input().split()))
surf = [0,1,2,3,4,5]
l = [0,0,0,0,0,0]
com = list(input())
for c in com:
    l = rot(c)
    surf[0],surf[1],surf[2],surf[3],surf[4],surf[5]=surf[l[0]-1],surf[l[1]-1],surf[l[2]-1],surf[l[3]-1],surf[l[4]-1],surf[l[5]-1]
print(label[surf[0]])


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

#define ll long long 
#define d  double 
#define endl "\n"

const ll int MOD=1e9+7;

void solve()
{
	int k,n,max=INT_MIN,i,x;
	cin >> k >> n;
	vector<int> v(n);
	for(i=0;i<n;i++)
		cin >> v[i];
	sort(v.begin(),v.end());
	v.push_back(k+v[0]); // size n+1
	for(i=0;i<n;i++)
	{
		x = abs(v[i]-v[i+1]);
		if(x>max)
			max = x;
	}
	cout << k-max << endl;
}

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

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

const long long INF = 1e18;
long long dp[102][100002] = {};

int main(){
    int N;
    long W;
    long w[102];
    int v[102];

    cin >> N >> W;
    for(int n=1;n<=N;n++) cin >> w[n] >> v[n];

    for(int n=0;n<=N;n++){
        for(long vi=1;vi<=N*1000;vi++){
            dp[n][vi] = INF;
        }
    }

    for(int n=1;n<=N;n++){
        for(long vi=0;vi<=N*1000;vi++){
            if(v[n] <= vi){
                dp[n][vi] = min(dp[n-1][vi - v[n]]+w[n], dp[n-1][vi]);
            }
            else{
                dp[n][vi] = dp[n-1][vi];
            }
        }
    }

    for(long vi=N*1000;vi>=0;vi--){
        if(dp[N][vi] <= W){
            cout << vi << "\n";
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 79104
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
typedef long long int lli;
using namespace std;

/*
int main(){
	int n,k;
	while(cin>>n>>k&&n!=0&&k!=0){
		vector<int> card(n+1);
		vector<int> flag(n+1);
		flag[0]=-1;
		card[0]=-1;
		for(int i=0;i<k; ++i){
			int tmp;
			cin >> tmp;
			card[tmp]=tmp;
			flag[tmp]=1;
		}
		int ans=0;
		if(flag[0]!=0){
			int cnt=0;
			int s;
			int n;
			for(int i=1;i<=n; ++i){
				if()
			}
		}
	}
	return 0;
}*/


int main(){
	string A,B;
	while(cin>>A>>B){
		int ans=0;
		for(int i=0;i<A.size(); ++i){
			string A_dash=A.substr(i);
			vector<int> flag(A_dash.size()>B.size()?B.size():A_dash.size());
			for(int j=0; j<flag.size(); ++j){
				if(A_dash[j]==B[j])flag[j]=1;
			}
			int cnt=0;
			for(int j=0; j<flag.size();++j){
				if(flag[j]==1) {
					++cnt;
					ans=max(ans,cnt);
				}else if(flag[j]==0) cnt=0;
			}
		}
		for(int i=0;i<B.size(); ++i){
			string B_dash=B.substr(i);
			vector<int> flag(B_dash.size()>A.size()?A.size():B_dash.size());
			for(int j=0; j<flag.size(); ++j){
				if(B_dash[j]==A[j])flag[j]=1;
			}
			int cnt=0;
			for(int j=0; j<flag.size();++j){
				if(flag[j]==1) {
					++cnt;
					ans=max(ans,cnt);
				}else if(flag[j]==0) cnt=0;
			}
		}
		cout << ans << "\n";
	}
	return 0;
}


/*
int main(){
	string A;
	while(cin>>A){
		int ans=0;
		int cnt=0;
		int tmp;
		for(int j=0; j<A.size();++j){
			//cout << cnt << "\n";
			if(A[j]=='1') {
				++cnt;
				ans=max(ans,cnt);
			}else if(A[j]=='0') cnt=0;
				tmp=A[j];
		}
		cout << ans << "\n";
	}
	return 0;
}*/

Measured memory_bytes: 1228
#include <iostream>
int main(){
    int a, b, x, i, n;
    long long int s = 0;
    a=-1000000;//MAX
    b=1000000;//min
    std::cin >> n;
    for(i=0;i<n;i++){
        std::cin >> x;
        s += x;
        if(x > a) a = x;
        if(x < b) b = x;      
    }
    std::cout << b << " " << a << " " << s << std::endl;
    return 0;
}


Measured memory_bytes: 3100
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

template <typename T>
struct swag {
    struct node {
        T val, sum;
        node(const T &val, const T &sum) : val(val), sum(sum) {}
    };
    using F = function<T(T, T)>;
    F op;
    stack<node> front_stack, back_stack;
    swag(const F &op) : op(op) {}
    bool empty() const { return front_stack.empty() && back_stack.empty();}
    size_t size() const { return front_stack.size() + back_stack.size();}
    T fold() const {
        assert(!empty());
        if (front_stack.empty()) {
            return back_stack.top().sum;
        } else if (back_stack.empty()) {
            return front_stack.top().sum;
        } else {
            return op(front_stack.top().sum, back_stack.top().sum);
        }
    }
    void push(const T &x) {
        if (back_stack.empty()) {
            back_stack.emplace(x, x);
        } else {
            T s{op(back_stack.top().sum, x)};
            back_stack.emplace(x, s);
        }
    }
    void pop() {
        assert(!empty());
        if (front_stack.empty()) {
            front_stack.emplace(back_stack.top().val, back_stack.top().val);
            back_stack.pop();
            while (!back_stack.empty()) {
                T s{op(back_stack.top().val, front_stack.top().sum)};
                front_stack.emplace(back_stack.top().val, s);
                back_stack.pop();
            }
        }
        front_stack.pop();
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    auto f = [](int a, int b) { return min(a, b);};
    swag<int> s(f);
    int n, l;
    cin >> n >> l;
    vector<int> res;
    rep(i, n) {
        int a;
        cin >> a;
        s.push(a);
        if (sz(s) == l) {
            res.push_back(s.fold());
            s.pop();
        }
    }
    rep(i, n-l+1) cout << res[i] << (i == n-l ? '\n' : ' ');
}



Measured memory_bytes: 7860
#include <stdio.h>

int main() {
	char s[5], n = 0, i;

	scanf("%s", s);

	for (i = 0; i < 4; i++) {
		if (s[i] == '+') {
			n++;
		}
		else {
			n--;
		}
	}
	printf("%d\n", n);

	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int start = sc.nextInt();
    int end = sc.nextInt();
    int target = sc.nextInt();
    int divisors = 0;

    for (int i = start; i <= end; i++) {
      if (target % i == 0) {
        divisors++;
      }
    }
    System.out.println(divisors);
  }
}

Measured memory_bytes: 26268
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <climits>
#include <queue>
#include <stack>
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define eps 1e-8
#define inf INT_MAX
#define mod 1000000009
using namespace std;

inline int FastI() {
	char c = ' '; int a = 0;
	while (!isdigit(c)) c = getchar();
	while (isdigit(c)) {
		a *= 10;
		a += c - '0';
		c = getchar();
	}
	return a;
}

int main() {
	speed;
	int h, w, h1, w1;
	cin >> h >> w >> h1 >> w1;
	int ar[20][20] = {};
	for (int i = 0; i < h1; ++i)
		for (int j = 0; j < w; ++j)
			ar[i][j] = 1;
	for (int i = 0; i < w1; ++i)
		for (int j = 0; j < h; ++j)
			ar[j][i] = 1;
	int ans = 0;
	for (int i = 0; i < h; ++i)
		for (int j = 0; j < w; ++j)
			ans += bool(!ar[i][j]);
	cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using LL = int64_t;
const int maxn=1e5+5;
LL ans[100];

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    memset(ans,0,sizeof(ans));
    ans[0]=2,ans[1]=1;
    for(int i=2;i<=86;i++) ans[i]=ans[i-1]+ans[i-2];
    int n;
    cin>>n;
    cout<<ans[n]<<endl;
    return 0;
}


Measured memory_bytes: 256
import heapq

N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)

place=[[-A[0],1]]
ans=0
for i in range(1,N):
    ans-=place[0][0]
    if place[0][1]==1:
        heapq.heappop(place)
    else:
        place[0][1]-=1
    heapq.heappush(place,[-A[i],2])
print(ans)

Measured memory_bytes: 31724
var N = 0
var A = 0

fun main(args: Array<String>) {
    readLine()?.split(" ")?.map {
        it.toInt()
    }?.let {
        N = it[0]
        A = it[1]
    }


    val x = Array(N + 1) { 0 }
    readLine()?.split(" ")?.map {
        it.toInt()
    }?.forEachIndexed { i, n ->
        x[i + 1] = n
    }

    val dp = Array(N + 1) {
        Array(N + 1) {
            Array(N * A + 1) { 0L }
        }
    }
    for (i in 0..N) {
        dp[i][0][0] = 1
    }

    for (i in 1..N) {
        for (j in 1..i) {
            for (k in 1..(N * A)) {
                dp[i][j][k] = if (k < x[i]) {
                    dp[i - 1][j][k]
                } else {
                    dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i]]
                }
            }
        }
    }

    var ans = 0L
    for (j in 1..N) {
        ans += dp[N][j][j * A]
    }

    println(ans)
}



Measured memory_bytes: 63820
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        String s = sc.nextLine();
        
        int res = Integer.MAX_VALUE;
        
        for(int i = 0; i < s.length() - 2; i++){
            int j = Integer.parseInt(s.substring(i,i+3));
            int k = Math.abs(753 - j);
            
            if(res >= k){
                res=k;
            }
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 21204
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

AccA = [0 for i in range(N+1)]
AccB = [0 for i in range(M+1)]

for i in range(1,N+1):
    AccA[i] = AccA[i-1] + A[i-1]
for j in range(1,M+1):
    AccB[j] = AccB[j-1] + B[j-1]

import bisect

Max = 0
#print(AccA)
#print(AccB)
for n in range(N+1):
    if(AccA[n] > K): break
    books = n
    time_left = K - AccA[n]
    books += bisect.bisect_right(AccB,time_left) - 1
    Max = max(Max,books)
    #print(n,bisect.bisect_right(AccB,time_left)-1)

print(Max)

Measured memory_bytes: 47304
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define IO std::ios::sync_with_stdio(false)
#define ll long long
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, l, r) for (int i = l; i >= r; i--)
#define mset(s, _) memset(s, _, sizeof(s))
#define pb push_back
#define pii pair <int, int>
#define mp(a, b) make_pair(a, b)
#define INF 0x3f3f3f3f

inline int read() {
  int x = 0, neg = 1; char op = getchar();
  while (!isdigit(op)) { if (op == '-') neg = -1; op = getchar(); }
  while (isdigit(op)) { x = 10 * x + op - '0'; op = getchar(); }
  return neg * x;
}
inline void print(int x) {
  if (x < 0) { putchar('-'); x = -x; }
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}

string s,t;
bool check(){
  int n = s.size();
  for(int i = 0 ; i < n ; i++){
    if(s[i] != t[i]) return false;
  }
  return true;
}
signed main() {
  IO;
  cin >> s >> t;
  if(check()) puts("Yes");
  else puts("No");
  return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    long h;
    cin >> h;
    long a = 1;
    long cnt = 1;
    while(a < h){
        a *= 2;
        cnt += a;
        if(a != h){
            if(a * 2 > h)break;
        }
    }
    cout << cnt << endl;
    return 0;
}

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


using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    long int n;
    cin>>n;
    long int a[n];
    for(long int i=0;i<n;i++)
    {
        cin>>a[i];
    } 
    sort(a,a+n);
    cout<<a[n/2]-a[(n/2)-1]<<endl;


}


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

int N, M;
vector<vector<int>> S;
vector<int> P;

bool judge(int bit) {
  for (int i = 0; i < M; i++) {
    int sum = 0;
    for (int X : S.at(i)) {
      if (bit & (1 << X)) sum++;
    }
    if (sum % 2 != P.at(i)) return false;
  }
  return true;
}

int main() {
  cin >> N >> M;
  S.resize(M);
  for (int i = 0; i < M; i++) {
    int K;
    cin >> K;
    S.at(i).resize(K);
    for (int j = 0; j < K; j++) {
      cin >> S.at(i).at(j);
      S.at(i).at(j)--;
    }
  }
  P.resize(M);
  for (int i = 0; i < M; i++) {
    cin >> P.at(i);
  }
  
  int ans = 0;
  
  for (int bit = 0; bit < (1 << N); bit++) {
    if (judge(bit)) ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
typedef struct{int I,S;}T;M(const T*x, const T*y){return x->S-y->S;}n,I,i,r,q;main() {T t[99];for(n=0;scanf("%d,%d",&t[n].I,&t[n].S),t[n].I;n++);qsort(t,n,8,M);for(;~scanf("%d",&I);)for(r=q=0,i=n;i--;t[i].I-I||printf("%d\n",r))r+=t[i].S!=q,q=t[i].S;exit(0);}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    string s, t; cin >> s >> t;
    int ans = 0;
    REP(i, 0, s.size()) {
        if (s[i] != t[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int main(void) {
	int N, x; cin >> N >> x;
	int a[N], i, sum = 0;
	
	for (i = 0; i < N; i++) {
		cin >> a[i];
	}

	sort(a, a + N);

	for (i = 0; i < N; i++) {
		if (x >= a[i]) {
			x -= a[i];
			sum += 1;
		}
	}
	if (sum == N && x > 0) { sum -= 1; }

	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
	int X, A, B;
	cin >> X >> A >> B;

	cout << X - A - B * ((X - A) / B);
	return 0;
}

Measured memory_bytes: 256
/*
  mail: mleautomaton@foxmail.com
  author: MLEAutoMaton
  This Code is made by MLEAutoMaton
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define ll long long
#define re register
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
inline int gi(){
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
const int N=4110,Mod=1e9+7;
int Random(){
	return 1ll*rand()*rand()%Mod;
}
int main(){
	int A=gi(),B=gi(),C=gi();
	printf("%d\n",max(0,C-(A-B)));
	return 0;
}


Measured memory_bytes: 256