akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Extentions;

class IO
{
    int idx;
    string[] input = In.ReadToEnd().Split(new[] { " ", "\n", "\r" },
        StringSplitOptions.RemoveEmptyEntries);

    T Get<T>(Func<string, T> parser) => parser(input[idx++]);

    public string S => Get(s => s);
    public char C => Get(char.Parse);
    public int I => Get(int.Parse);
    public long L => Get(long.Parse);
    public double F => Get(double.Parse);
    public decimal D => Get(decimal.Parse);
    public BigInteger B => Get(BigInteger.Parse);

    T[] Gets<T>(int n, Func<string, T> parser)
        => input.Skip((idx += n) - n).Take(n).Select(parser).ToArray();

    public string[] Ss(int n) => Gets(n, s => s);
    public char[] Cs(int n) => Gets(n, char.Parse);
    public int[] Is(int n) => Gets(n, int.Parse);
    public long[] Ls(int n) => Gets(n, long.Parse);
    public double[] Fs(int n) => Gets(n, double.Parse);
    public decimal[] Ds(int n) => Gets(n, decimal.Parse);
    public BigInteger[] Bs(int n) => Gets(n, BigInteger.Parse);

    public void Write<T>(params T[] xs) => WriteLine(string.Join(" ", xs));
    public void Write(params object[] xs) => WriteLine(string.Join(" ", xs));
}

#region Library

static class Extentions
{
}

#endregion

static class Program
{
    public static void Main()
    {
        var sw = new StreamWriter(OpenStandardOutput()) { NewLine = "\n" };
#if DEBUG
        sw.AutoFlush = true;
#else
        sw.AutoFlush = false;
#endif
        SetOut(sw);
        Solve(new IO());
        Out.Flush();
    }

    static void Solve(IO io)
    {
        var n = io.I;
        var ans = 0;

        for (var i = 0; i < n; i++)
        {
            var l = io.I;
            var r = io.I;
            ans += r - l + 1;
        }

        io.Write(ans);
    }
}

Measured memory_bytes: 13336
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;
using ll = long long;
using v1 = vector<int>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;

int main(){
	string s, t;
	cin >> s >> t;
	int c = 0;
	rep(i, s.size()){
		if(s.at(i) != t.at(i)) c++;
	}
	cout << c << endl;
}


Measured memory_bytes: 3844
import static java.lang.Math.abs;
import static java.lang.System.exit;
import java.math.BigInteger;
import java.util.*;
import java.util.LinkedList;

public class Main {


    
    static Long result;
    static Long[][] posibilities;
    public static  Long NS (int[] w,int[] v,int max, int n){
        //System.out.println("n"+ n);
        // System.out.println("max"+ max);
        if(n>0){
        if (posibilities[n][max] != null){
            return posibilities[n][max];
        }
        }
        if (n< 0 || max==0){
            return Long.valueOf(0);
        }
        
        if (w[n] > max){
            result= Long.valueOf( NS(w,v,max,n-1));
        }
        
        else{
           
           Long yes= Long.valueOf( v[n]+ NS(w,v,max-w[n],n-1));
           Long no= Long.valueOf( NS(w,v,max,n-1));
           
           result= Math.max(yes,no);
           posibilities[n][max]= result;
        }
        
        return result;
    }
    
   
    
    
   
    public static void main(String args[]) {
         
        Scanner scan = new Scanner(System.in);
        int n= scan.nextInt();
        int max= scan.nextInt();
        
        int [] weigths = new int[n];
        
        int [] values = new int[n];
        
        for (int i=0; i<n; i++){
           weigths[i]= scan.nextInt();
           values[i]= scan.nextInt();
           
        }
        
        posibilities= new Long[n][max+1];
        NS(weigths,values,max,n-1);
        System.out.print(result);
        
      
         
                  
        
        
    
    }

}


Measured memory_bytes: 369760
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int x,y,a,b;
	scanf("%d %d",&x,&y);
	if(x<y)	swap(x,y);
	while(1)	{
		b=x%y;
		if(b==0)	break;
		else {
			x=y;
			y=b;
		}
	}
	printf("%d\n",y);
	return 0;
}


Measured memory_bytes: 2740
n, k = map(int, input().split())
k = min(k, n - 1)

MOD = 1000000007

fact = [1] * (n + 1)
ifact = [0] * (n + 1)
for i in range(1, n + 1):
    fact[i] = fact[i - 1] * i % MOD
ifact[n] = pow(fact[n], MOD - 2, MOD)
for i in range(n, 0, -1):
    ifact[i - 1] = ifact[i] * i % MOD

def comb(n, k):
    if k < 0 or k > n:
        return 0
    return fact[n] * ifact[k] * ifact[n - k] % MOD

ans = 0
for i in range(k + 1):
    ans += comb(n, i) * comb(n - 1, i)
    ans %= MOD
print(ans)


Measured memory_bytes: 18932
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;
namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var a = 6;
            var N = int.Parse(Console.ReadLine());
            var N1 = int.Parse(Console.ReadLine());
            Console.WriteLine(a - N - N1);
        }
        
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
            using namespace std;
            typedef long long ll;
            ll INF =1e9+7;
            typedef pair<ll,ll> ii;
            #define f(i,a,b) for(long long i = a;i < b;i++)
            #define rf(i,a,b) for(long long i=a;i>=b;i--)
            #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
            #define w(t) while(t--)
            #define c(n); cin>>n;
            #define p(n) cout<<n;
            #define pl(n) cout<<n<<endl;
            #define ps(n); cout<<n<<" ";
            #define F first
            #define S second
            #define pb(a) push_back(a)
            int main(void){
                fastio;
                ll n;
                string s;
                c(n);
                c(s);
                f(i,0,s.size()){
                    char c = s[i]+n;
                    if(c <= 'Z'){
                        p(c);
                    }
                    else{
                        c-=26;
                        p(c);
                    }
                }
            }


Measured memory_bytes: 256
#include <iostream>
#define inf 1000000005

using namespace std;

int N;
int F[105][10];
int P[105][11];

int main(void)
{
	cin >> N;
	for(int i = 0; i < N; i++){
		for(int j = 0; j < 10; j++){
			cin >> F[i][j];
		}
	}
	for(int i = 0; i < N; i++){
		for(int j = 0; j <= 10; j++){
			cin >> P[i][j];
		}
	}
	
	int ans = -inf, sum, cnt[105];
	for(int s = 1; s < (1<<10); s++){
		for(int i = 0; i < N; i++) cnt[i] = 0;
		for(int i = 0; i < 10; i++){
			if((s & (1<<i)) == 0) continue;
			for(int j = 0; j < N; j++){
				if(F[j][i]) cnt[j]++;
			}
		}
		sum = 0;
		for(int i = 0; i < N; i++){
			sum += P[i][cnt[i]];
		}
		ans = max(ans, sum);
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
signed main(){
    bool f = true;
    string s , t;
    
    cin >> s >> t; 
    
    for(int i=0 ;i<s.size() ;i++ ){
        if(s[i] != t[i]){
            f = false;
        }
    }
    
    if(f){
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    return(0);
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n + 1);
    rep(i, n)
    {
        int tmp;
        cin >> tmp;
        a[tmp]++;
    }

    sort(all(a));
    reverse(all(a));
    
    int ans = 0;
    rep(i, k)
    {
        ans += a[i];
    }
    cout << n - ans << endl;
    return 0;
}

// int main()
// {
//     int n, k;
//     cin >> n >> k;
//     vector<int> a(n);
//     rep(i, n) cin >> a[i];

//     set<int> s;
//     rep(i, n) s.insert(a[i]);

//     int ans = 0;
//     vector<int> ck(200000, 0);
//     rep(i, n) ck[a[i]]++;
//     sort(all(ck));

//     if (s.size() > k)
//     {
//         int num = s.size() - k;
//         int i = 0;
//         while (num)
//         {
//             if (ck[i] > 0)
//             {
//                 num--;
//                 ans += ck[i];
//             }
//             i++;
//         }
//     }
//     cout << ans << endl;
//     return 0;
// }


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

int main(){
    using namespace std;
    unsigned long N, M;
    cin >> N >> M;
    for(unsigned long i{0}, j{1}, k{N}; i < M; ++i){
        cout << j << " " << k << endl;
        if((~N & 1) && (j == N / 4))++j;
        ++j;
        --k;
    }
    return 0;
}

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


void solve(long long X, long long Y){
  string ret;
  if (abs(X-Y) <= 1) {ret = "Brown"; }
  else { ret = "Alice"; }
  cout << ret << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    solve(X, Y);
    return 0;
}


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

#define ll long long
#define fast_io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main()
{
    fast_io;
    string s;
    cin >> s;
    if(s[0] == 'S' && s[1] == 'S' && s[2] == 'S' )
    {
        cout << "0\n";
    }
    else if(s[0] == 'R' && s[1] == 'R' && s[2] == 'R' )
    {
        cout << "3\n";
    }
    else if((s[0] == 'R' && s[1] == 'R' && s[2] == 'S' ) || (s[0] == 'S' && s[1] == 'R' && s[2] == 'R' ))
    {
        cout << "2\n";
    }
    else if((s[0] == 'R' && s[1] == 'S' && s[2] == 'S' ) || (s[0] == 'R' && s[1] == 'S' && s[2] == 'R' ) || (s[0] == 'S' && s[1] == 'S' && s[2] == 'R' ) || (s[0] == 'S' && s[1] == 'R' && s[2] == 'S' ))
    {
        cout << "1\n";
    }



}


Measured memory_bytes: 3608
use std::io;


fn main() {
    let (x, a, b) = {
        let i = read::<isize>();
        (i[0], i[1], i[2])
    };

    if (b - a) <= 0 { println!("delicious"); }
    else if b - a <= x { println!("safe"); }
    else { println!("dangerous"); }
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , "; logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 500005;

/* ...o(^-^)o... */

vector<int> bitize(lint x){
    vector<int> res(50);
    rep(i, 50){
        res[i] = x % 2;
        x /= 2;
    }
    return res;
}

int main(){
    int n; cin >> n;
    vector<lint> a(n);
    rep(i, n) cin >> a[i];

    lint g = 0, s = a[0]+a[1];
    rep(i, n-2) g ^= a[i+2];

    if(s - g < 0){
        out(-1); return 0;
    }
    vector<int> v = bitize(s-g), w = bitize(g);

    lint tmp = 0;
    rep(i, 50){
        if(i == 0 && v[i]){
            out(-1); return 0;
        }
        if(v[i] && w[i-1]){
            out(-1); return 0;
        }
        if(v[i]) tmp += 1LL << (i-1);
    }

    if(tmp > a[0]){
        out(-1); return 0;
    }

    repr(i, 50){
        if(!w[i]) continue;
        if(tmp + (1LL << i) <= a[0]) tmp += 1LL << i;
    }
    if(tmp == 0){
        out(-1); return 0;
    }

    out(a[0]-tmp);
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main() {
  INIT;
  VAR(string, s);
  REP(i,s.size()){
    if(s[i]==',') cout<<" ";
    else cout<<s[i];
  }
  BR;
  
  return 0;
}


Measured memory_bytes: 256
/*****************************************************
 				*	Logged in : HABIBUR RAHMAN						 *
				*	Dept	  : COMPUTER SCIENCE AND ENGINEERING	 *
				*													 *
				*	KHULNA UNIVERSITY OF ENGINEERING AND TECHNOLOGY  *
				******************************************************/


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<string> vs;
typedef pair<ll,ll> pll;
#define fast_io 			ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(v) 				v.begin(),v.end()
#define allr(v) 			v.rbegin(),v.rend()
#define rep(i,a,b) 			for(ll i=a;i<=b;i++)
#define rep0(i,n)			for(ll i=0;i<n;i++)
#define rrep0(i, n) 		for(ll i=(ll)(n);i>0;--i)
#define rrep(i, a, b) 		for(ll i=(ll)(a);i>=(ll)(b);--i)
#define pb(z) 				push_back(z)
#define ff					/first
#define ss 					second
#define caset 				int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define sz(X) 				((ll)(X).size())
#define scan(X) 			scanf("%s", (X))
#define ms(v,val)			memset((v),(val),sizeof((v)))
#define ms0(X) 				memset((X), 0, sizeof((X)))
#define ms1(X) 				memset((X), -1, sizeof((X)))
#define m_p(a,b)            make_pair(a,b)
#define get_pos(c,x) 		(lower_bound(c.begin(),c.end(),x)-c.begin())
#define lcm(a,b)            (a*b)/__gcd(a,b)
#define INF9                1000000010
#define INF18               4000000000000000010
#define bpll(a)             __builtin_popcountll(a)
#define sqr(a)              ((a)*(a))
#define nl					"\n"
//#define mod					1e9+7;
#define mx_el(v)			*max_element(all(v));
#define mn_el(v)			*min_element(all(v));
#define pcase(z,x)    		cout<<"Case "<<z<<": "<<x<<"\n"
const double pi = 2*acos(0) ;
#define display(v)			vi :: iterator it;for(it=(v).begin();it!=(v).end();it++){cout << *it << " " ;}cout << endl;
#define taking(n,v) 		for(ll i=0;i<(n);i++){ll inp;cin>>inp;(v).push_back(inp);}

void start(){
      #ifndef ONLINE_JUDGE 
      freopen("input.txt" , "r" , stdin) ;
      freopen("output.txt" , "w" , stdout) ;
      #endif
}

void solve()
{
 	 ll n,k;cin>>n>>k;
 	 ll a[n+3];
 	 rep0(i,n)cin>>a[i];
 	 sort(a,a+n);
 	 ll s=0;
 	 rep0(i,k)s+=a[i];
 	 cout << s << nl;
}

int main(){
	fast_io
	//start();
    //caset{
    	//cout << "Case " << tt << ": ";

		  solve();
	//}
	
	return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <iomanip>


using namespace std;

int n, x;
double score;
int tab[5];
double ex[305][305][305];
double p[305][305][305];
//ex[a][b][c] = expected number of operations to get to state a, b, c
//p[a][b][c] = propability of getting to this state
int main(){

    cin.tie(0);
    ios_base::sync_with_stdio(0);
    
    cin >> n;
    //dp[a][b][c] = expected value of operations to get to state a, b, c
    for(int i = 0; i < n; i++){
        cin >> x;
        tab[x]++;
    }
    //p[tab[1]][tab[2]][tab[3]]
    
    p[tab[1]][tab[2]][tab[3]] = 1;
    for(int c = n; c >= 0; c--){
        for(int b = n; b >= 0; b--){
            for(int a = n; a >= 0; a--){
                if(a == 0 & b == 0 & c == 0){
                    continue;
                }
                if(a + b + c > n){
                    continue;
                }
                
                double pWaste = (double)  (n - (a + b + c)) / n;
                double exWaste = pWaste / (1 - pWaste) + 1;
                
                ex[a][b][c] += exWaste * p[a][b][c];
                
                if(a != 0){
                    double pGo = (double) a / (a + b + c);
                    p[a - 1][b][c] += p[a][b][c] * pGo;
                    ex[a - 1][b][c] += ex[a][b][c] * pGo;
                }
                
                
                if(b != 0){
                    double pGo = (double) b / (a + b + c);
                    p[a + 1][b - 1][c] += p[a][b][c] * pGo;
                    ex[a + 1][b - 1][c] += ex[a][b][c] * pGo;
                }
                
                if(c != 0){
                    double pGo = (double) c / (a + b + c);
                    p[a][b + 1][c - 1] += p[a][b][c] * pGo;
                    ex[a][b + 1][c - 1] += ex[a][b][c] * pGo;
                }
                
            }
        }
    }
    
    
    
    cout << setprecision(10) << ex[0][0][0];
}



Measured memory_bytes: 438528
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

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

    int oddNum = 0;
    vector<int> a(m);
    for(int i=0; i<m; ++i){
        cin >> a[i];
        if(a[i] % 2 != 0){
            swap(a[i], a[oddNum]);
            ++ oddNum;
        }
    }
    if(oddNum > 2){
        cout << "Impossible" << endl;
        return 0;
    }
    else if(oddNum == 2){
        swap(a[1], a[m-1]);
    }

    vector<int> b = a;
    if(b.size() == 1)
        b.push_back(1);
    else
        ++ b[m-1];
    -- b[0];
    if(b[0] == 0)
        b.erase(b.begin());

    cout << a[0];
    for(unsigned i=1; i<a.size(); ++i)
        cout << ' ' << a[i];
    cout << endl << b.size() << endl << b[0];
    for(unsigned i=1; i<b.size(); ++i)
        cout << ' ' << b[i];
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n,p;
  cin >> n >> p;
  int odd = 0,even = 0;
  vi A(n);
  rep(i,n){
    int a;
    cin >> a;
    A[i] = a;
    if(a%2)odd++;
    else even++;
  }
  ll ans = 0;
  if(even == n){
    if(p == 0)ans =  powl(2,n);
  }
  else{
    ans= powl(2,(n-1));
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#N:人数、K:必要な身長、h:仲間の身長のリスト、count:ジェットコースターに乗れる人数

N,K=map(int,input().split())
h=list(map(int,input().split()))
count=0
for i in range(N):
    if h[i]>=K:
        count+=1
    else:
        pass
print(count)


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

int main()
{
  ll n, k; cin >> n >> k;
  vector<ll> a(n);
  vector<ll> f(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> f[i];

  sort(a.rbegin(),a.rend());
  sort(f.begin(),f.end());

  ll l = -1;
  ll r = 1000000000001;
  while (l+1 < r) {
    ll m = (l+r)/2;
    ll sum = 0;
    for (int i=0; i<n; i++) {
      ll tmp = a[i]*f[i] - m;
      if (tmp <= 0) continue;
      sum += (tmp-1+f[i]) / f[i];
    }
    if (sum <= k) r = m;
    else l = m;
  }
  cout << l+1 << endl;

  return 0;
}


Measured memory_bytes: 3328
/* Don't try to hack it :|
 
            _/﹋\_
            (҂`_´)
            <,︻╦╤─҉- - - - - - - - - - - - - - -
            _/﹋\_
*/

#include <bits/stdc++.h>
#define ll long long 
#define all(v) v.begin() , v.end()
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define tr(con) for(auto it = con.begin(); it!= con.end() ; it++)
#define INF 1e9+7   
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define fo(i,n) for(ll i=0;i<n;i++)
using namespace std;
ll gcd(ll a, ll b){
	if(b==0) return a;
	return gcd(b ,a%b);
}
int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n ; cin >>n  ;
	ll a[n];
	fo(i,n) cin >> a[i];
	ll count = 0, curr = 1,one =0;
	fo(i,n){
		if(a[i] == curr){
			curr ++;
			count ++ ;
			one++;
		}
	}
	if(one) cout<< n - count;
	else cout << "-1";
	return 0;
}



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

using namespace std;

int main(){
    string s;
    cin>>s;
    if(s[0]=='7'||s[1]=='7'||s[2]=='7'){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
    return 0;
}

Measured memory_bytes: 3624
sx, sy, tx, ty = map(int, input().split())

dx = tx - sx
dy = ty - sy

S = "U" * dy + "R" * dx 
S += "D" * dy + "L" * dx
S += "L" + "U" * (dy + 1) + "R" * (dx + 1) + "D" 
S += "R" + "D" * (dy + 1) + "L" * (dx + 1) + "U"
print(S) 

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int, int> pi;
typedef vector<int> vi;
void print_pair(pi a){
  cerr<<"("<<a.first<<", "<<a.second<<") ";
}
template<int T1, int T2>
void print_2d(int a[T1][T2], int x, int y){
  For(i, x){
    For(j, y){
      cerr<<a[i][j]<<" ";
    }
    cerr<<endl;
  }
}
template<class T>
void print_array(T a[],size_t n){
  cerr<<"array:";
  REP(n-1)cerr<<a[i]<<",";
  cerr<<a[n-1]<<endl;
}

ll N,M;
string S,T;
ll l;

ll gcd(ll a,ll b){
  if(a%b==0)return b;
  return gcd(b,a%b);
}


int main(){
  cin>>N>>M>>S>>T;
  ll n=N/gcd(N,M),m=M/gcd(N,M);
  ll i,j;
  i=j=0;
  while(i<N&&j<M){
    if(S[i]!=T[j]){
      cout<<-1<<endl;
      return 0;
    }
    i+=n;
    j+=m;
  }
  cout<<n*M<<endl;
  return 0;
}



Measured memory_bytes: 512
def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end  
def copy(a) Marshal.load(Marshal.dump(a)) end
def factorial(n)(n < 2)? 1 : (2..n).inject{|m,i|(m*i)%998244353} end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n,d=0) Array.new(n,d)end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
n,x = inp
a = inp.sort
ans = 0
sum = 0
if(a.inject(:+) == x)
  p n 
  exit
end
a[0..(a.size-2)].each do |d|
  sum += d
  if(sum > x)
    break
  end
  ans += 1
end
p ans

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

int main() {
  int n;
  cin >> n;
  vector<int> c(n - 1), s(n - 1), f(n - 1);
  rep(i, n - 1) cin >> c[i] >> s[i] >> f[i];

  vector<int> t(n);
  rep(i, n - 1) {
    for (int j = i; j < n - 1; j++) {
      if (t[i] - s[j] <= 0) {
        t[i] = s[j] + c[j];
      } else {
        t[i] = ceil((t[i] - s[j]) / (double)f[j]) * f[j] + s[j] + c[j];
      }
    }
  }

  rep(i, n) cout << t[i] << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;

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

    ll a, b, c, d, e,f;
    a = N / K;

    int min;

    if(N < K){
        b = abs(N-K);
        N = b;
        c = abs(N-K);

        if(b <= c){
            cout << b << endl;
            return 0;
        }
        else{
            cout << c << endl;
            return 0;
        }
    }

    d = abs(N - K);
    N = d - (K*(a-1));

    e = abs(N - K);

    if(N <= e){
        cout << N << endl;
        return 0;
    }
    else{
        cout << e << endl;
        return 0;
    }



}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define ms_valtype pair

typedef struct {
	int w;
	int b;
}pair;

//比較関数
int compare_ms(ms_valtype a, ms_valtype b){
	return (b.b + b.w) - (a.b + a.w);
}

//昇順
void sort_sub(ms_valtype *origin, int left, int right, ms_valtype *tmp){
	if(right - left > 1){
		int i, j, k, half = (left + right) / 2;
		sort_sub(origin, left, half, tmp);
		sort_sub(origin, half, right, tmp);
		for(i = left; i < right; i++){
			tmp[i] = origin[i];
		}
		for(i = left, j = left, k = half; i < right; i++){
			if(k == right){
				origin[i] = tmp[j];
				j++;
			}
			else if(compare_ms(tmp[j], tmp[k]) <= 0 && j < half){
				origin[i] = tmp[j];
				j++;
			}
			else{
				origin[i] = tmp[k];
				k++;
			}
		}
	}
}

void sort(ms_valtype *origin, int N){
	ms_valtype *tmp = (ms_valtype *)malloc(sizeof(ms_valtype) * N);
	sort_sub(origin, 0, N, tmp);
	free(tmp);
}

signed main(){
	int N, P, i, sum = 0;
	scanf("%lld%lld", &N, &P);
	pair *ps = (pair *)malloc(sizeof(pair) * N);
	for(i = 0; i < N; i++){
		scanf("%lld%lld", &ps[i].w, &ps[i].b);
		ps[i].w *= (100 - P);
		ps[i].b *= P;
		sum -= ps[i].b;
	}
	sort(ps, N);
	for(i = 0; i < N; i++){
		sum += ps[i].w + ps[i].b;
		if(sum >= 0){
			printf("%lld\n", i + 1);
			return 0;
		}
	}
}

Measured memory_bytes: 3328
m,d=map(int,input().split())
ans=0
for i in range(1,m+1):
    for j in range(1,d+1):
        j=str(j)
        if len(j)==2 and i==int(j[0])*int(j[1]) and int(j[0])>=2 and int(j[1])>=2:
            ans+=1
            #print(i,j)
print(ans)

Measured memory_bytes: 3060
import math
#import copy

class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv


def paint(N,M,K):
    return 

def main():
    N, M, K = map(int, input().split())
    ans = 0
    mod = 998244353
    cmb = Combination(N, mod)

    pow_list = [0] * (N)
    pow_list[0] = 1
    for i in range(1, N):
        pow_list[i] = pow_list[i-1]*(M-1) % mod
    for i in range(0,K+1):
        ans = ans + M*cmb(N-1, i)*pow_list[N-1-i]
    print(ans%mod)

if __name__ == '__main__':
    main()

Measured memory_bytes: 98624
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		HashMap<String, String> map = new HashMap<>();
		map.put("A", "T");
		map.put("T", "A");
		map.put("C", "G");
		map.put("G", "C");
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		System.out.println(map.get(S));
	}
}

Measured memory_bytes: 21460
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }

int main(){
    int n,t,a,b;
    in(n);
    vector2d(int,vec,n,n,-1);
    rep(i,n){
        in(t);
        while(t--){
            in(a,b);
            vec[i][a-1]=b;
        }
    }
    int maxv=0,flag=1;
    for(int i=0;i<(1<<n);i++){
        bitset<15> table(i);
        flag=1;
        rep(k,n){
            if(table.test(k)){
                for(int j=0;j<n;j++){
                    if(vec[k][j]==-1)continue;
                    if(vec[k][j]!=table.test(j)){
                        flag=0;
                        goto skip;
                    }
                }
            }
        }
        skip:
        if(flag)maxv=max(maxv,(int)table.count());
    }
    out(maxv);
}


Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    char s1[n],s2[n];
    int len;
    len=n+n;
    char s3[len];
    scanf("%s",s1);
    scanf("%s",s2);
    int i,k,j;
    i=j=k=0;
    while(i<=n&&j<=n&&k<=len)
    {
        if(k%2==0)
        {
            s3[k]=s1[i];
            i++;
            k++;
        }
        else
        {
            s3[k]=s2[j];
            j++;
            k++;
        }
    }
    printf("%s",s3);
    printf("\n");
    return 0;
}


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

int main() {
	int H, W, h, w;
	cin >> H >> W >> h >> w;
	if (H%h == 0 && W%w == 0) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	int base, rect;
	rect = (H / h)*(W / w);
	base = rect / (H*W - rect * h*w) + 1;
	for (int j = 1; j <= H; j++) {
		if (w == 1 && j % h == 0) {
			cout << -base * (w*h - 1) - 1;
		}
		else {
			cout << base;
		}
		for (int i = 2; i <= W; i++) {
			if (i%w == 0 && j%h == 0) {
				cout << " " << -base * (w*h - 1) - 1;
			}
			else {
				cout << " " << base;
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
inline int read(){
    int x=0; char c=getchar();
    while(c<'0'||c>'9')c=getchar();
    while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
    return x;
}
int n;
struct node{
	long long a,b;
}x[N];
bool cmp(node x,node y){
	return x.b<y.b;
}
int main(){
	n=read();
	long long o,p;
	for(int i=1;i<=n;i++){
		scanf("%lld%lld",&o,&p);
		x[i]=(node){o,p};	
	}
	sort(x+1,x+n+1,cmp);
	long long lst=0;
	for(int i=1;i<=n;i++){
		if((x[i].a+lst)<=x[i].b)lst=x[i].a+lst;
		else{puts("No");return 0;}
	}
	puts("Yes");
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int K, A, B;
  cin >> K >> A >> B;
  bool isok = false;
  for (int i = A; i <= B; i++) isok |= i % K == 0;
  cout << (isok ? "OK" : "NG") << endl;
  return 0;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}

// V dx = {1, 0};
// V dy = {0, 1};
V dx = {1, 0, -1, 0};
V dy = {0, 1, 0, -1};

int main() {
  int h, w, k; cin >> h >> w >> k;
  int sh, sw, th, tw; cin >> sh >> sw >> th >> tw;
  --sh, --sw, --th, --tw;  
  vector<string> field(h);
  rep(i, h) cin >> field[i];

  VV dist(h, V(w, INF));
  queue<P> que;
  dist[sh][sw] = 0;
  que.emplace(sh, sw);
  while (!que.empty()) {
    auto [i, j] = que.front(); que.pop();
    rep(dir, dx.size()) rep2(l, 1, k+1) {
      int ii = i + dx[dir] * l;
      int jj = j + dy[dir] * l;
      if (ii < 0 || ii >= h || jj < 0 || jj >= w) continue;
      if (field[ii][jj] == '@') break;
      if (dist[ii][jj] <= dist[i][j]) break;
      if (chmin(dist[ii][jj], dist[i][j] + 1))
        que.emplace(ii, jj);
    }
  }

  int ans = dist[th][tw];
  if (ans == INF) ans = -1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 12092
N, M = map(int,input().split())

to = [[] for i in range(N)]
for i in range(M):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)
cnt = 0
def search(i,visited):
    global cnt
    if len(visited) == N:
        cnt += 1
    for v in to[i]:
        if v not in visited:
            search(v,visited+[v])
search(0,[0])
print(cnt)

Measured memory_bytes: 3064
#include<iostream>
#include<queue>
#include <math.h>
#include<vector>
using namespace std;

typedef long long ll;
const ll M = 1000000007;

vector<ll> fac(1000001); //n!(mod M)
vector<ll> ifac(1000001); //k!^{M-2} (mod M)

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}
ll comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x,y;
    cin >> x >> y;
    ll a=0, b=0;
    bool flag=true;
    if(x%2==0 && y==x/2){
        a = 0;
        b = y;
        flag = false;
    }
    while(flag){
        x -= 1;
        y -= 2;
        a++;
        if(x%2==0 && y==x/2){
            b = y;
            flag = false;
        }
        if((x*y<=0)&& !(x==0 && y==0)){
            a=0;
            b=0;
            flag = false;
        }

    }
    ll n=a+b, k=a;

    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<1000001; i++){
        fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
    }

    ll ans=0;
    ans = comb(n, k)%M;
    if(n==0) cout << 0 << endl;
    else    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

typedef pair<int,int> pii;
int const INF = 1<<30;
int main() {
  int n;
  cin >> n;
  vector<int> v1(n),v2(n);
  REP(i,n) {
    cin >> v1[i] >> v2[i];
  }
  long long dp[n][n];
  REP(i,n) REP(j,n) dp[i][j] = INF;
  REP(i,n) dp[i][i] = 0;

  for (int i=1; i<n; ++i)
    for (int j=0; j<n-i; ++j)
      for (int k=j; k<j+i; ++k)
        dp[j][j+i] = min(dp[j][j+i], dp[j][k] + dp[k+1][j+i] + v1[j]*v2[k]*v1[k+1]*v2[j+i]);
  cout << dp[0][n-1] << endl;
}

Measured memory_bytes: 0
#include <stdio.h>
int main(void){
    int n,a[10000],cnt=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    for(int i=0;i<n;i++){
        while(a[i]%2==0){
            a[i]/=2;
            cnt++;
        }
    }
    printf("%d\n",cnt);
}

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

int main(){
    int N, C, K;
    cin >> N >> C >> K;
    long T[1000000];
    for (int i = 0; i < N; i++){
        cin >> T[i];
    }
    for (int i = N; i < N + C; i++){
        T[i] = 1000000000 + K + 100;
    }
    sort(T, T + N);

    /*for (int i = 0; i < N + C; i++){
        cout << T[i] << endl;
    }*/

    int count = 0;
    int buscount = 0;
    for (int i = 0; i < N; i++){
        count = 0;
        for (int j = 1; j < C; j++){
            if ((T[i] + K) >= T[i + j] && T[i] + K <= T[i + j] + K){
                count++;
            }
        }
        //cout <<"i" <<  i << endl;
        //cout << "count" << count << endl;
        i += count;
        buscount++;
    }
    cout << buscount << endl;

}

Measured memory_bytes: 3456
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <vector>
//#define ivorysi
#define MAXN 20005
#define eps 1e-8
#define mo 974711
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
const int64 MOD = 998244353;
int N;
int c = 0,ans[MAXN],S;

int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    scanf("%d",&N);
    if(N == 3) puts("2 5 63");
    else if(N == 4) puts("2 5 20 63");
    else if(N == 5) puts("2 5 20 30 63");
    else {
	for(int i = 0 ; i <= 4999 ; ++i) {
	    ans[++c] = 6 * i + 2,ans[++c] = 6 * i + 3,ans[++c] = 6 * i + 4,ans[++c] = 6 * i + 6;
	}
	for(int i = 1 ; i <= N ; ++i) S = (S + ans[i]) % 6;
	if(S == 5) {
	    ans[6] = 6 * 4999 + 4;
	}
	else if(S == 3) {
	    ans[6] = 6 * 5000;
	}
	else if(S == 2){
	    ans[5] = 6 * 5000;
	}
	for(int i = 1 ; i <= N ; ++i) printf("%d%c",ans[i]," \n"[i == N]);
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	int a[105];
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	int res=0;
	for(int i=0;i<n;i++)
		for(int j=n-1;j>i;j--)
			if(a[j]<a[j-1])swap(a[j],a[j-1]),res++;
	for(int i=0;i<n-1;i++)cout<<a[i]<<' ';cout<<a[n-1]<<endl;
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 3104
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
// #define int ll
using namespace std;
const int INF (1 << 30);
const ll LLINF (1LL << 55LL);
const int MOD = 1000000007;
const int MAX = 510000;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,k,a[100010],ans=0;
    cin>>n>>k;
    rep(i,n){
        cin>>a[i];
        if(a[i]>=k) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
    int a,b,S;
    cin >> a >> b;
    if(b>=100)  S = a*1000+b;
    else if(b>=10)  S = a*100+b;
    else    S = a*10+b;
    for(int i=0;i<317;i++){
        if(i*i==S){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}

Measured memory_bytes: 256
#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() {
    char s[5];
    int count = 0,max = 3;
    for(int i=0;i<3;i++){
        cin >> s[i];
        if(s[i] == 'R'){
            count++;
        }
    }
    if(s[1] == 'S'){
        max = 1;
    }
    cout << min(count,max) << endl;
    return 0;
}

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

int main()
{
    int x,y;
    cin >> x >> y;
    if(x==y){
        cout << 2*x <<endl;
        return 0;
    }
    if(x>y){
        cout << 2*x-1;
        return 0;
    }
        cout << 2*y-1;
        return 0;
}

Measured memory_bytes: 256
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import Counter

n,c = li()
diff = [list(li()) for _ in range(c)]
init = [list(li_()) for _ in range(n)]

group = [Counter() for _ in range(3)]

for row in range(n):
    for col in range(n):
        group[(row+col)%3][init[row][col]] += 1
        
ans = 10**18

for c0 in range(c):
    cost = [0,0,0]
    for k,v in group[0].items():
        cost[0] += v*diff[k][c0]

        
    for c1 in range(c):
        if c0 == c1:
            continue
        
        cost[1] = 0
        
        for k,v in group[1].items():
            cost[1] += v*diff[k][c1]
            
        for c2 in range(c):
            if c2 == c0 or c2 == c1:
                continue
            
            cost[2] = 0
            
            for k,v in group[2].items():
                cost[2] += v*diff[k][c2]
                
            ans = min(ans, sum(cost))
            
print(ans)

Measured memory_bytes: 5876
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

ll N, A, B;
vector<ll> h;

bool f(ll K) {
    ll tmp = 0;
    rep(i, N) {
        ll rem = h[i] - B*K;
        if (rem > 0) tmp += (rem + (A-B-1)) / (A-B);
    }
    return (tmp <= K);
}

ll binary_search(ll ok, ll ng) {
    while (abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        if (f(mid)) ok = mid;
        else ng = mid;
    }
    return ok;
}

int main() {
	cin >> N >> A >> B;
    h = vector<ll>(N);   // サイズNを確保
    rep(i, N) cin >> h[i];
	cout << binary_search(INF, 0) << endl;
	return 0;
}


Measured memory_bytes: 1024
a,b,c,d=list(input())
#print(a,b,c,d)

if a==b and c==d and a!=c:
    print('Yes')
elif a==c and b==d and a!=b:
    print('Yes')
elif a==d and b==c and a!=b:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38256
n = input()
s = input()

res = [0 for i in range(1000)]

for i in range(1000):
  tgt = str(i).zfill(3)
  tmpa = s.find(tgt[0])
  if tmpa < 0:
    pass
  else:
    sa = s[(tmpa+1):]
    tmpb = sa.find(tgt[1])
    if tmpb < 0:
      pass
    else:
      sb = sa[(tmpb+1):]
      tmpc = sb.find(tgt[2])
      if tmpc < 0:
        pass
      else:
        res[int(tgt)] = 1

print(sum(res))

Measured memory_bytes: 3188
a=input()
a=str(a)
b=a[len(a)-1]
if b=='2' or b=='4' or b=='5' or b=='7' or b=='9':
    print('hon')
elif b=='0' or b=='1' or b=='6' or b=='8':
    print('pon')
else:
    print('bon')

Measured memory_bytes: 9056