akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

using ll = long long int;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

#define pi 3.14159265358979

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




ll cnt_rep = 0;
ll powmod(ll N, ll P, ll M){
  cnt_rep++;
  if(P == 0) return 1;
  if(P%2 == 0){
    ll t = powmod(N, P/2, M);
    return t*t % M;
  }
  return (N * powmod(N, P-1, M)) % M;
}


ll gcd(ll a, ll b){
  ll resi, g, l;
  if(a > b){
    g = a; l = b;
  }else if(b > a){
    g = b; l = a;
  }else{
    return a;
  }
  resi = g % l;
  if(resi != 0){
    return gcd(l, resi);
  }else{
    return l;
  } 
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

int ans = 0;
int N, M, Q;

template<typename T>
void showall(vector<T> v){
  rep(i, 0, v.size()){
    cout << v[i] << " ";
  }
  cout << endl;
}


void dfs(vector<ll> ls, vector<vector<ll>> way, int ){
  ll cur = ls.back();
  ls.pop_back();

  rep(i, 0, N){
    if(way[cur][i] != 0){

    }
  }

}

 
int main() {
  ll N, M;
  cin >> N >> M;
  int ans = 0;

  vector<ll> H(N), v(N, 0);
  map<int, int> s;
  vector<map<int, int>> ls(N, s);

  rep(i, 0, N){
    cin >> H[i];
  }
  rep(i, 0, M){
    ll ai, bi;
    cin >> ai >> bi;

    ls[ai-1][bi-1] = 1; ls[bi-1][ai-1] = 1;
  }
  
  rep(i, 0, N){
    bool flag = true;
    for(auto& ne : ls[i]){
      if(H[ne.first] >= H[i]){
        flag = false;
        break;
      }
    }
    if(flag){
      ans++;
    }
  }

  cout << ans << endl;
  

}

Measured memory_bytes: 18780
#include <bits/stdc++.h>
using namespace std;
int dp[200005];
int main()
{
    int n,a[200005],i,j;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>a[i];
        
    
    }
    dp[0]=0;dp[1]=abs(a[1]-a[0]);
    for(i=2;i<n;i++){
        dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
        //cout<<dp[i]<<' ';
        
    }
    cout<<dp[n-1];
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,k; //kは割る回数
  int A[220];
  cin >> N;
  for(int i=0;i<N;i++)
    cin >> A[i];
        
  while(true){
    bool a = false ;
    for (int j=0 ;j<N ;j++){
      if(A[j]%2 != 0)
        a = true ;
    }
    if(a) break ;
    for(int k=0;k<N;k++)
      A[k] /= 2 ;
    k++ ;
  }
  cout << k <<endl ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
using ll = long long;

vector<long long> fact_inv, inv, Com;

/*  init_nCk :二項係数のための前処理
    計算量:O(n)
*/
void init_nCk(int n, int SIZE) {
    fact_inv.resize(SIZE + 5);
    inv.resize(SIZE + 5);
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < SIZE + 5; i++) {
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
    }
    Com.resize(SIZE + 5);
    Com[0] = 1;
    for (int i = 1; i < SIZE + 5; i++) {
        Com[i] = Com[i - 1] * ((n - i + 1) * inv[i] % MOD) % MOD;
    }
}

 ll modpow(ll x, ll n) {
     ll res = 1;
     while (n > 0) {
         if (n & 1) {  // nが奇数のとき
             res *= x;
             res %= MOD;
         }
         x *= x;
         x %= MOD;
         n >>= 1;
     }
     return res;
 }

/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(1)
*/
long long nCk(int k) {
    assert(!(k < 0));
    return Com[k];
}

int main(){
  long long n,a,b;
  cin >> n >> a >> b;

  ll all = modpow(2,n);
//   cout << all << endl;
  init_nCk(n,2e5+1);
  ll com_a,com_b;
  com_a = nCk(a);
//   cout << com_a << endl;
  com_b = nCk(b);
//   cout << com_b << endl;
  ll ans = all - com_a - com_b - 1;
  while(ans<0){
      ans+=MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 7940
s = input()
t = 0
number = 0
#m = [0 for i in range(2019)]
m = [0]*2019
m[0] = 1
a = 1
for i in range(len(s)):
    t = t  +  int(s[len(s) - 1 - i])* a 
    #print(t)
    m[t % 2019] += 1
    a = a * 10
    a = a % 2019
    #print(t%2019)

for j in range(2019):
    #if m[j]>= 2:
    number += (m[j]*(m[j] - 1))//2

print(number)

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

int main(){

 int n;
 
 cin >>n;
 int a[10000];
 for(int i=0;i<n;i++) cin>>a[i];
 
 int mn =a[0], mx =a[0];
 long long sum =0;
 for(int i=0;i<n;i++){
 mn=min(mn,a[i]);
 mx =max(mx,a[i]);
 sum += a[i];
}

 cout<<mn<<" "<<mx<<" "<<sum<<endl;
 

}


Measured memory_bytes: 3136
#include <iostream>
#include <cstring>

using namespace std;

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    int h[n];
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }

    bool dp[n][2];
    memset(dp, false, sizeof(dp));
    dp[0][0] = dp[0][1] = true;
    for (int i = 1; i < n; i++) {
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < 2; k++) {
                dp[i][k] |= dp[i-1][j] && h[i] - k >= h[i-1] - j;
            }
        }
    }

    cout << (dp[n-1][0] || dp[n-1][1] ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 896
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> P1;
typedef long long int ll;

//define
#define INF 1e9
#define NUM 1000000007
#define all(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

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

/*ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a * (b / g);
}*/

int main() {
	int n;
	cin >> n;
	VI a(n), b(n), c(n);
	vector<ll>fir(n),sec(n);
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	rep(i, n) cin >> c[i];
	sort(all(a));
	//sort(all(b));
	sort(all(c));

	//cout << "\n";
	ll ans = 0;
	rep(i, n) {
		auto it = upper_bound(all(c), b[i]);
		fir[i] = c.end() - it;
	}

	rep(i, n) {
		auto itr = lower_bound(all(a), b[i]);
		sec[i] =itr-a.begin();
	}
	rep(i, n) {
		//cout << fir[i] << " " << sec[i] << endl;
		ans += fir[i] * sec[i];
	}
	cout << ans << endl;
}



Measured memory_bytes: 2944
import numpy as np

A,B = map(int,input().split())
def f(x):
    rx = x%4
    bin_f = 0
    for i in range(rx+1): #add x, x-1, ..., x-rx (rx number in total)
        bin_f = bin_f ^ (x-i)
    return bin_f

print(f(A-1)^f(B))

Measured memory_bytes: 18480
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

require 'prime'

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 kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} 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 inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end


x,y = inp
ans = 0
if(x == 1 and y == 1)
  ans += 400000
end
ans +=[(4-x)*100000,0].max
ans +=[(4-y)*100000,0].max
p ans






























# make space for editer

Measured memory_bytes: 2044
import java.util.*;
public class Main {
	
	private static List<String> hateList = new ArrayList<String>();
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String in = sc.nextLine();
		int seito = Integer.parseInt(in);
		int count = 0;
		for (int i = 1;i <= seito; i++){
			count = count + i;
		}
		System.out.println(count);

	}
 
}

Measured memory_bytes: 8788
#include<iostream>
#include<string>
using namespace std;
using ll=long long;

int main(){
    string S,T;
    cin>>S>>T;
    ll sum=0;
    for(ll i=0;i<S.length();i++){
        if(S[i]!=T[i]){
            sum++;
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3912
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<iomanip>
#include<bitset>
using ll=long long;

int main(){
  string s,t;
  cin >> s >> t;
  cout << t << s;

}


Measured memory_bytes: 256
N, A, B = gets.split.map(&:to_i)
S = gets.chomp

sum = 0
b = 1

N.times do |i|
    if S[i] == 'a'
        if sum < A+B
            puts "Yes"
            sum += 1
        else
            puts "No"
        end
    elsif S[i] == 'b'
        if sum < A+B && b <= B
            puts "Yes"
            sum += 1
            b += 1
        else
            puts "No"
        end
    else
        puts "No"
    end
end

Measured memory_bytes: 2428
#include <bits/stdc++.h>
using namespace std; 
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long int
#define ld long double
#define endl "\n"
#define rep(i,a,b) for(int i=a;i<b;i++)
#define reprev(i,a,b) for(int i=b-1;i>=a;i--)
#define all(c) c.begin(),c.end()
#define sz(c) (int)c.size()
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define vin(a,n) vi a(n); rep(i,0,n) cin>>a[i];
#define vout(a) rep(i,0,sz(a)) cout<<a[i]<<" "; cout<<endl;
#define pb push_back
#define mp  make_pair
#define mod 1000000007
#define mod2 998244353
#define inf LLONG_MAX
#define pi 3.1415926535897932384626
#define tr(container, it) \
for(auto it = container.begin(); it != container.end(); it++)

int power(int x, unsigned int y, int p)  
{  
    int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}

int modInverse(int n, int p) 
{ 
    return power(n, p-2, p); 
} 
const int N=2000000;
int fac[N+1]; 
void precomp(int p)
{
    fac[0] = 1; 
    for (int i=1 ; i<=N; i++) 
        fac[i] = fac[i-1]*i%p;
}
// Returns nCr % p using Fermat's little 
// theorem. 
int nCrModPFermat(int n, int r, int p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
  
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r  
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
}
signed main()
{
    IOS
    precomp(mod);
    int k;
    cin>>k;
    string s;
    cin>>s;
    int n=s.length();
    int final_ans=0;
    rep(i,n,n+k+1)
    {
        int ans=1;
        int x1 = nCrModPFermat(i-1,n-1,mod);
        ans*=x1; ans%=mod;
        ans*=power(25,i-n,mod); ans%=mod;
        ans*=power(26,n+k-i,mod); ans%=mod;
        final_ans+=ans;
        final_ans%=mod;
    }
    cout<<final_ans;
    return 0;
}

Measured memory_bytes: 19880
#include "bits/stdc++.h"
using namespace std;
int main(){
    int n;
    cin >> n;
    int a, before;
    cin >> a;
    before = a;
    int cnt = 1, ans = 0;
    for(int i = 1 ; i < n ; i++){
        cin >> a;
        if(before == a) cnt++;
        else{
            before = a;
            ans += cnt / 2;
            cnt = 1;
        }
    }
    ans += cnt / 2;
    cout << ans;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
const int mod=1e9+7;
const int p=2000;
int n,ans;
int a[200010],b[200010],dp[4010][4010];
int fac[8010],inv[8010];
int C(int x,int y) {
    if (x<y) return 0;
    return 1LL*fac[x]*inv[y]%mod*inv[x-y]%mod;
}
int power(int x,int y) {
    int s=1;
    for ( ; y; y>>=1) {
        if (y&1) s=1LL*s*x%mod;
        x=1LL*x*x%mod;
    }
    return s;
} 
int main() {
    fac[0]=1;
    for (int i=1,ii=4*p; i<=ii; i++) fac[i]=1LL*fac[i-1]*i%mod;
    inv[4*p]=power(fac[4*p],mod-2);
    for (int i=4*p-1; i>=0; i--) inv[i]=1LL*inv[i+1]*(i+1)%mod;
    scanf("%d",&n);
    for (int i=1; i<=n; i++) {
        scanf("%d%d",&a[i],&b[i]);
        dp[-a[i]+p][-b[i]+p]++;
    }
    for (int i=0,ii=2*p; i<=ii; i++)
        for (int j=0,jj=2*p; j<=jj; j++) {
            if (i>0) dp[i][j]=(dp[i][j]+dp[i-1][j])%mod;
            if (j>0) dp[i][j]=(dp[i][j]+dp[i][j-1])%mod;
        }
    ans=0;
    for (int i=1; i<=n; i++) {
        ans=(ans+dp[a[i]+p][b[i]+p])%mod; 
        ans=((ans-C(a[i]*2+b[i]*2,a[i]*2))%mod+mod)%mod;
    }
    printf("%d\n",1LL*ans*power(2,mod-2)%mod);
    return 0;
}

Measured memory_bytes: 66028
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll MOD = 1e9+7;

int main(){
  int n, i;
  cin >> n;
  //vector<string> S(n);
  vector<int> A(n);
  rep(i, n) cin >> A[i];
  //int m = A[0]; 
  /*sort(A.begin(), A.end());
  int q = A[0];
  for(i=1; i<n; i++){
    A[i] %= q;
  }
  while(A[1]!=0){
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
    
  }*/
  int q;
  sort(A.begin(), A.end());
  while(A[1]!=1000000001){
    q = A[0];
    //reverse(A.begin(), A.end());
    for(i=1; i<n; i++){
    if(A[i]%q==0) A[i] = 1000000001;
    else if(A[i]==1000000001) A[i] = 1000000001;  
    else A[i] %= q;
  }
  sort(A.begin(), A.end());
  }
  cout << A[0] << endl;
}

Measured memory_bytes: 640
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, [ $t:tt ]) => { { let len = read_value!($next, usize); (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() } }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        A: i64,
        B: i64,
        C: i64,
    }
    let ans = if A==B && B==C{"Yes"}else{"No"};
    println!("{}",ans);
}

Measured memory_bytes: 4352
#include <stdio.h>

int main()
{
    int A, B;
    int C[5] = {0};
    for(int i = 0; i < 3; ++i)
    {
        scanf("%d%d", &A, &B);
        C[A]++;
        C[B]++;
    }
    for(int i = 1; i <= 4; ++i)
    {
        if(C[i] >= 3)
        {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    return 0;
}

Measured memory_bytes: 888
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <utility>

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

ll MOD = 924844033;

bool func()
{
    int n;
    cin >> n;
    
    vi a(n);
    rep(i, n) cin >> a[i];
    
    sort(a.begin(), a.end());
    
    int mi = a[0];
    int ma = a[n-1];
    
    vi hist(n);
    rep(i, n) hist[a[i]]++;
    
    if(mi != (ma+1)/2) return false;
    if(hist[mi] != 1+ma%2) return false;
    
    reps(i, mi+1, ma){
        if(hist[i] <= 1) return false;
    }
    
    return true;
}


signed main()
{
    int n, k;
    cin >> n >> k;
    
    vector<bool> edge;
    vector<vector<bool>> done(n+1, vector<bool>(n+1));
    
    reps(i, 1, n+1) reps(j, 1, n+1){
        if(abs(i-j) != k) continue;
        if(done[i][j]) continue;
        
        edge.push_back(false);
        
        int ii = i, jj = j;
        for(;;){
            done[ii][jj] = true;
            if(ii<jj) ii += 2*k;
            else jj += 2*k;
            if(ii>n || jj>n) break;
            edge.push_back(true);
        }
    }
    
    int L = edge.size();
    vvi dp(L+1, vi(n+1, 0));
    
    dp[0][0] = 1;
    dp[1][0] = dp[1][1] = 1;
    
    reps(i, 2, L+1){
        dp[i][0] = 1;
        reps(j, 1, n+1){
            if(edge[i-1]){
                dp[i][j] = (dp[i-1][j] + dp[i-2][j-1]) % MOD;
            }
            else{
                dp[i][j] = (dp[i-1][j] + dp[i-1][j-1]) % MOD;
            }
        }
    }
    
    /*
    rep(i, edge.size()) cout << edge[i] <<' '; cout << endl;
    rep(i, dp.size()){
        rep(j, dp[i].size()) cout << dp[i][j] << ' ';
        cout << endl;
    }
    */
    
    vi fact(n+1);
    fact[0] = 1;
    reps(k, 1, n+1){
        fact[k] = (ll(fact[k-1]) * k) % MOD;
    }
    
    int ans = 0;
    rep(k, n+1){
        int add = ((ll)dp[L][k] * fact[n-k]) % MOD;
        ans = (ans + MOD + (k%2 ? -1 : 1) * add) % MOD;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 32256
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<limits.h>

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int

int main(){
    int h, w, n;
    scanf("%d %d %d", &h, &w, &n);
    int a = h<w ? w: h;
    int b = h<w ? h : w;
    int ans = n / a;
    if(n%a != 0){
        ans++;
    }
    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;

// 各ノードの座標と深さを保持するための構造体
//struct Node{
//    int y;
//    int x;
//    int depth;
//};

int main() {
    int X;
    cin>>X;
    string ans;
    
    if (X%100>0 && X%100<13 && X/100>0 && X/100<13) {
        ans="AMBIGUOUS";
    }
    else if (X%100>0 && X%100<13){
        ans="YYMM";
    }
    else if (X/100>0 && X/100<13){
        ans="MMYY";
    }
    else{
        ans="NA";
    }
    
    cout<<ans<<endl;
}


Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');

const parse = (s, sep) => {
  return s.split(sep).map(v => parseInt(v));
}
const split = (s, sep, result, keys) => {
  var arr = parse(s, sep);
  for (var i = 0; i < arr.length; i++) {
    result[keys[i]] = arr[i];
  }
}

var inp = {};
split(lines[0], ' ', inp, ['x', 'y', 'a', 'b', 'c']);
var p = parse(lines[1], ' ').sort((a, b) => b - a);
var q = parse(lines[2], ' ').sort((a, b) => b - a);
var r = parse(lines[3], ' ').sort((a, b) => b - a);
p = p.slice(0, inp.x);
q = q.slice(0, inp.y);

console.log(p.concat(q, r).sort((a, b) => b - a).slice(0, inp.x + inp.y).reduce((a, b) => a + b, 0));


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

int main() {
	int N; cin >> N;
	int A[100010];
	for(int i=0; i<N; ++i) cin >> A[i];
	map<int, int> mp;
	for(int i=0; i<N; ++i) ++mp[A[i]];
	int count=0;
	for(auto itr=mp.begin(); itr!=mp.end(); ++itr) if(itr->second%2) ++count;
	cout << count << endl;
	return 0;
}


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

def c(x):
    cnt=0
    for i in a:
        cnt += (i - 1) // x
    return cnt <= k
    
l, r = 0, max(a)
while l + 1 < r:
    mid = (l + r) // 2
    if c(mid):
        r = mid
    else:
        l = mid

print(r)

Measured memory_bytes: 93828
#include <cmath>
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int64_t N;
  cin >> N;
  int64_t res = 0;
  for (int64_t n = 2, end = sqrt(N); n <= end; ++n) {
    if (N < n) break;
    if (N % n) continue;
    int64_t d = 0;
    while (N % n == 0) {
      ++d;
      N /= n;
    }
    for (int64_t i = 1, end = d; i <= d; ++i) {
      if (d - i >= 0) {
        ++res;
        d -= i;
      } else {
        break;
      }
    }
  }
  if (N > 1) ++res;
  cout << res << endl;
  
  return 0;
}


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

int main() {
	int n;
	cin >> n;
	set<int> st;
	rep(i, n) {
		int a; cin >> a;
		if (st.find(a) == st.end()) st.insert(a);
		else st.erase(a);
	}
	cout << st.size() << endl;
	return 0;
}


Measured memory_bytes: 4864
import java.util.Scanner;

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

    char[] s = scanner.next().toCharArray();
    char[] t = scanner.next().toCharArray();

    for (int i = s.length - t.length; i >= 0; i--) {
      boolean found = true;
      for (int j = 0; j < t.length; j++) {
        if (s[i + j] != '?' && s[i + j] != t[j]) {
          found = false;
          break;
        }
      }
      if (found) {
        System.arraycopy(t, 0, s, i, t.length);
        for (int j = 0; j < s.length; j++) {
          if (s[j] == '?') s[j] = 'a';
        }
        System.out.println(new String(s));
        return;
      }
    }
    System.out.println("UNRESTORABLE");
  }
}


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

int main() {
	int n, k;
	scanf("%d%d", &k, &n);
	if (k == 1) {
		for (int i = 0; i < (n + 1) / 2; i++)
			printf("1 ");
	} else if (k % 2) {
		int64_t num = 0, cur = 1;
		int i = 0;
		for (; i < n && num < 1000000LL; i++)
			num += cur *= k;
		if (i == n) {
			int64_t t = (num - 1) / 2;
			std::vector<int> res;
			for (int i = 0; i < n; i++) {
				if (i) {
					if (!t) break;
					t--, num--;
				}
			  num /= k;
				res.push_back(t / num);
				t %= num;
			}
			for (auto j : res) printf("%d ", j + 1);
		} else {
			int shift = 0;
			std::vector<int> res;
			for (int j = 0; j < n - i; j++) {
        if (j && (n - j) % 2) shift++;
				res.push_back((k + 1) / 2);
			}
			num++;
			int64_t t = (num - 1) / 2 - shift;
			assert(t >= 0);
      for (int j = n - i; j < n && t; j++) {
				t--, num--;
				num /= k;
				res.push_back(t / num + 1);
				t %= num;
			}
      for (auto j : res) printf("%d ", j);

		}
	} else {
		printf("%d", (k + 1) / 2);
		for (int i = 0; i + 1 < n; i++)
			printf(" %d", k);
	}
  return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
int n;
const int N = 200000;
#define LL long long
LL ans;
vector <int> bi[N], ci[N];
int siz[N];
void dfs(int t, int f)
{
    siz[t] = 1; int mx = 0, mn = 1e9;
    for (int i = 0; i < bi[t].size(); ++ i)
        if (bi[t][i] != f)
        {
            dfs(bi[t][i], t);
            mx = max(mx, siz[bi[t][i]]);
            mn = min(mn, ci[t][i]);
            if (siz[bi[t][i]] * 2 == n)
                ans -= ci[t][i];
            ans += 2ll * ci[t][i] * min(siz[bi[t][i]], n - siz[bi[t][i]]);
            siz[t] += siz[bi[t][i]];
        }
        else mn = min(mn, ci[t][i]);
    mx = max(mx, n - siz[t]);
    if (mx * 2 < n) ans -= mn;
}
int main()
{
    cin >> n;
    for (int i = 1; i < n; ++ i)
    {
        int a, b, c;
        cin >> a >> b >> c;
        bi[a].push_back(b); ci[a].push_back(c);
        bi[b].push_back(a); ci[b].push_back(c);
    }
    dfs(1, 0);
    cout << ans;
}


Measured memory_bytes: 24320
object Main extends App {
	override def main(args : Array[String]){
		val sc = new java.util.Scanner(System.in)
		
		var count = new Array[Int](26)
		io.Source.stdin.getLines().foreach( s =>
			s.collect{	
				case ch if 'a' <= ch && ch <= 'z' => ch
				case ch if 'A' <= ch && ch <= 'Z' => (ch - 'A' + 'a').asInstanceOf[Char]
			}.foreach{ ch =>
				count(ChMap.apply(ch)) = count(ChMap.apply(ch)) + 1
			}
		)

		for(ch <- ('a' to 'z')){
			println(ch + " : "+count(ChMap.apply(ch)))
		}
	}
	
	object ChMap{
		def apply : PartialFunction[Char,Int] = { 
			case ch if 'a' <= ch && ch <= 'z' => ch - 'a'
			case ch if 'A' <= ch && ch <= 'Z' => ch - 'A'
		}
	}
}

Measured memory_bytes: 45724
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
using namespace std;
#define ll long long
#define INF 1000000007
using P=pair<int,int>;
int main(){
    
    int n;
    cin>>n;
    int d[114514];
    for(int i=0;i<n;i++)cin>>d[i];
    sort(d,d+n);
    cout<<d[n/2]-d[n/2-1]<<endl;
    return 0;
}


Measured memory_bytes: 640
n, a, b = map(int, input().split())
s = input()
cnt = 0
b_cnt = 1
for i in range(n):
    if s[i] == 'c':
        print('No')
    elif cnt >= (a + b):
        print('No')
    elif s[i] == 'a':
        print('Yes')
        cnt += 1
    elif s[i] == 'b':
        if b_cnt <= b:
            print('Yes')
            cnt += 1
            b_cnt += 1
        else:
            print('No')

Measured memory_bytes: 4016
#include <stdio.h>
int main(void){
    int n,m;
    int a[200000]={0};
    int b[200000]={0};
    int c[200000]={0};
    int d[200000]={0};
    int i,j;
    int flag = 0;
    int cnt = 0;
    int cnt_b = 0;
    scanf("%d %d",&n,&m);
    for(i=0;i<m;i++){
        scanf("%d %d",&a[i],&b[i]);
    }
    for(i=0;i<m;i++){
        if(a[i] == 1){
            c[b[i]]++;
        }
    }
    for(i=0;i<m;i++){
      if(b[i] == n){
        c[a[i]]++;
      }
    }
    for(i=0;i<200000;i++){
      if(c[i] >= 2){
        printf("POSSIBLE");
        return 0;
      }
    }
    printf("IMPOSSIBLE");
    return 0;
}

Measured memory_bytes: 2560
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		int d = sc.nextInt();

        int cnt = 0;
        int sum = 0;
        while(true) {
          cnt++;
          
          sum += d + 1 + d;
          
          if(sum >= n) {
            break;
          }
        }
      
      
      	System.out.println(cnt);
    
    }
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;

int translate(char ch){
	if(ch >= '0' && ch <= '9')return ch - '0';
	else{
		return 10 + ch - 'a';
	}
}

int main(){

	char buf[10];
	int red,green,blue,diff[8],min,min_index;

	while(true){
		scanf("%s",buf);
		if(buf[0] == '0')break;

		red = 16*translate(buf[1])+translate(buf[2]);
		green = 16*translate(buf[3])+translate(buf[4]);
		blue = 16*translate(buf[5])+translate(buf[6]);

		diff[0] = red*red + green*green + blue*blue; //black
		diff[1] = red*red + green*green + (blue-255)*(blue-255); //blue
		diff[2] = red*red + (green-255)*(green-255) + blue*blue; //lime
		diff[3] = red*red + (green-255)*(green-255) + (blue-255)*(blue-255); //aqua
		diff[4] = (red-255)*(red-255) + green*green + blue*blue; //red
		diff[5] = (red-255)*(red-255) + green*green +(blue-255)*(blue-255); //fuchsia
		diff[6] = (red-255)*(red-255) + (green-255)*(green-255) + blue*blue; //fuchsia
		diff[7] = (red-255)*(red-255) + (green-255)*(green-255) +(blue-255)*(blue-255); //white

		min = 2147483647;

		for(int i=7; i >= 0; i--){
			if(diff[i] <= min){
				min = diff[i];
				min_index = i;
			}
		}

		switch(min_index){
		case 0:printf("black\n");
				break;
		case 1:printf("blue\n");
				break;
		case 2:printf("lime\n");
				break;
		case 3:printf("aqua\n");
				break;
		case 4:printf("red\n");
				break;
		case 5:printf("fuchsia\n");
				break;
		case 6:printf("yellow\n");
				break;
		case 7:printf("white\n");
				break;
		}

	}
    return 0;
}

Measured memory_bytes: 2564
#include<bits/stdc++.h>
using namespace std;
 
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define fi first
#define se second
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define pow10(n) stoll("1"+string(n,'0'))
//fill(all(arr),1)
//if(map.count(key)){}
//bitset<20>(n);
//int mini=min({a,b,c,d,e});
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;

int main(){
    FIO
    int n;
    cin>>n;
    long double h=n/3.0;
    long double p=h*h*h;
    cout<<setprecision(18)<<p;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {

	int h, w;
	while (cin >> h >> w && h || w) {
		for (int i = 0; i < h; i++) {
			for (int k = 0; k < w; k++) {
				cout << '#';
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3092
N, M = map(int, input().split())
Hs = list(map(int, input().split()))
roads = [[] for _ in range(N)]

for i in range(M):
    a,b = map(int, input().split())
    roads[a-1].append(b-1)
    roads[b-1].append(a-1)

res = 0
for i in range(N):
    if roads[i] == [] or Hs[i] > max([Hs[x] for x in roads[i]]):
        res += 1

print(res)

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

int P[510];
int cost1[100100],src1[100100],dst1[100100],judge[100100],mark[100100];

void init(int N)
{
	for (int i=0; i<=N; ++i) 
	    P[i] = i;
} 

int root(int a)
{
	if(P[a]==a)   
	   return a;
	else  return(P[a]=root(P[a]));
}
 
bool is_same_set(int a,int b)
{
	return(root(a)==root(b));
}

void unite(int a,int b)
{
	P[root(a)]=root(b);
}

int Kruskal(int cost[101000],int src[101000],int dst[101000],int n,int M,int h) 
{
	pair<int,int> edges[101000];
	for(int i=0;i<M;i++)
	{
		edges[i].first=cost[i];
		edges[i].second=i;
	}
	sort(edges,edges+M);
	int sum=0;
	int k=0;
	for(int i=0;i<M;i++)
	{
		if(is_same_set(src[edges[i].second],dst[edges[i].second])||edges[i].first>10000)
		  continue;
		unite(src[edges[i].second],dst[edges[i].second]);
		if(h)
		{
			src1[k]=src[edges[i].second];
		    dst1[k]=dst[edges[i].second];
		    cost1[k]=edges[i].first;
		    mark[k]=edges[i].second;
		    k++;
		}
		sum+=edges[i].first;
	}
	int flag=1;
	for(int i=2;i<=n;i++)
	{
		if(!is_same_set(1,i))
		{
			flag=0;
			break;
		}
	}
	if(!flag)
	   sum=-1; 
	return sum;
}

int main()
{
	int n,m;
    cin >> n >> m;
    if(!n && !m)
      return 0;
        init(n);
	    int cost[101000],src[101000],dst[101000];
	    for(int i=0;i<m;i++)
	    {
            cin >> src[i] >> dst[i] >> cost[i];
            src1[i]=0;
            dst1[i]=0;
            cost1[i]=0;
            judge[i]=0;
            mark[i]=0;
		}
 	    int sum=Kruskal(cost,src,dst,n,m,1);
 	    /*cout << sum << endl; */
 	    for(int i=0;i<n-1;i++)
 	    {
 	    	int k=mark[i];
 	    	cost[k]=10001;
 	    	init(n);
 	    	/*for(int j=k;j<m;j++)
 	    	{
 	    		cost[j]=cost[j+1];
 	    		src[j]=src[j+1];
 	    		dst[j]=dst[j+1];
			}*/
			int sum1;
 	    	sum1=Kruskal(cost,src,dst,n,m,0);
 	    	/*cout << sum1 << endl;  */
 	    	if(sum!=sum1)
 	    	  judge[i]=1;
 	    	cost[k]= cost1[i];
 	    	/*for(int j=k+1;j<m;j++)
 	    	{
 	    		cost[j]=cost[j-1];
 	    		src[j]=src[j-1];
 	    		dst[j]=dst[j-1];
			}
			cost[k]=cost1[i];
			src[k]=src1[i];
			dst[k]=dst1[i];*/
		}
		int count=0,money=0;
		for(int i=0;i<n-1;i++)
		{
			if(judge[i])
			{
				count++;
				money+=cost1[i];
			}
		}
		cout << count << ' ' << money << endl;
}


Measured memory_bytes: 5504
// Problem : A - Multiplication 1
// Contest : AtCoder - AtCoder Beginner Contest 169
// URL : https://atcoder.jp/contests/abc169/tasks/abc169_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// Muallif: Azimjon Mehmonali o'g'li

#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define sc scanf
#define pr printf

#define ALL(a) a.begin(), a.end()
#define rALL(a) a.rbegin(), a.rend()
#define SORT(a) sort(ALL(a))
#define sqr(x) ((x) * (x))

#define sci(n) sc("%d", &n);
#define sci2(n, m) sc("%d%d", &n, &m);
#define scl(n) sc("%I64d", &n);
#define scl2(n, m) sc("%I64d%I64d", &n, &m);

#define xatop(a) cerr << #a << " = " << a << endl;
#define jsatr xatop(__LINE__)

#define TEZ                  \
	ios::sync_with_stdio(0); \
	cin.tie(0);

const double PI = 3.1415926535897932384626433832795;
const int mod = 1000000007;
const int INF = 1000000000;

int main() {
	int a, b;
	cin >> a >> b;
	cout << a * b << endl;

	return 0;
}


Measured memory_bytes: 3636
import sys
s=input()
t=input()
s_dict={}
t_dict={}
for i in range(len(s)):
    if not s[i] in s_dict:
        s_dict[s[i]]=t[i]
    else:
        if s_dict[s[i]]==t[i]:
            pass
        else:
            print('No')
            sys.exit()
    if not t[i] in t_dict:
        t_dict[t[i]]=s[i]
    else:
        if t_dict[t[i]]==s[i]:
            pass
        else:
            print('No')
            sys.exit()
print('Yes')


Measured memory_bytes: 41932
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<int, int> p;
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    int N, M;
    cin >> N >> M;

    vector<int> a(M);
    vector<int> b(M);
    vector<int> c(M);

    for(int i = 0; i < M; i++) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--;
        b[i]--;
    }

    vector<vector<int> > v(N, vector<int>(N, 10000000));

    for(int i = 0; i < M; i++) {
        v[a[i]][b[i]] = c[i];
        v[b[i]][a[i]] = c[i];
    }

    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            for(int k = 0; k < N; k++) {
                v[j][k] = min(v[j][k], v[j][i] + v[i][k]);
            }
        }
    }

    int ans = 0;

    for(int i = 0; i < M; i++) {
        if(v[a[i]][b[i]] != c[i]) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007

ll a, b, c;
string s;
int main() {
	cin >> a >> b;
	cout << (b % a == 0 ? a + b : b - a )<< endl;
}



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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;

const int dx[]={0,-1,1,0},dy[]={-1,0,0,1};

int main(){

  ll n;cin>>n;

  ll k=0;
  rep(i,1,n+1){
    if(i*(1+i)/2>=n){k=i;break;}
  }

  rep(i,1,k+1){
    if(k*(1+k)/2-n!=i)out(i);
  }

  return 0;
}


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

class Main {
    public static void main(String [] args) {
        Solver s = new Solver();
        s.solve();
    }
}

class Solver {
    Reader in = new Reader ();
    Writer out = new Writer ();

    void solve () {
        int n = in.nextInt();
        int k = in.nextInt();
        Integer [] a = new Integer [n];
        long sum = 0;
        for(int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            sum += a[i];
        }
        Arrays.sort(a, (p, q) -> { return Integer.compare(q, p); });
        for(int i = 0; i < k && i < n; i++) {
            sum -= a[i];
        }
        System.out.println(sum);
    }
}

class Reader {
    private StringTokenizer a;
    private BufferedReader b;
    Reader () {
        a = null;
        try {
            b = new BufferedReader (new InputStreamReader (System.in)); // for file IO, replace this with new FileReader ("in.txt")
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public String next () {
        while(a == null || !a.hasMoreTokens()) {
            try {
                a = new StringTokenizer (b.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return a.nextToken();
    }
    public int nextInt() {
        return Integer.parseInt(this.next());
    }
    public long nextLong () {
        return Long.parseLong(this.next());
    }
    public double nextDouble () {
        return Double.parseDouble(this.next());
    }
    public String nextLine() {
        try {
            return b.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "";
    }
}
class Writer {
    private PrintWriter a;
    private StringBuffer b;
    Writer () {
        try {
            a = new PrintWriter (System.out); // for file IO, replace this with new FileWriter ("out.txt")
        } catch (Exception e) {
            e.printStackTrace();
        }
        b = new StringBuffer ("");
    }
    public void write (Object s) {
        b.append(s);
    }
    public void writeln(Object s) {
        b.append(s).append('\n');
    }
    public void flush () {
        a.print(b);
        a.flush();
        a.close();
    }
}


Measured memory_bytes: 59348
#include <bits/stdc++.h>
using namespace std;
int main()
{
	char a[12];
	scanf("%s",&a);
	int N=strlen(a);
	long long s=0;
	for(int i=0;i<(1<<(N-1));i++)
	{
		long long m=0;
		m=a[0]-'0';
		for(int j=0;j<N-1;j++)
		{
			if(i&(1<<j))
			{
				s+=m;
				m=0;
			}
			m=m*10+a[j+1]-'0';
		}
		s+=m;
	}
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  int a,b,c;
  cin >> a>>b>>c;

  if(a+b==c||b+c==a||c+a==b) cout << "Yes" << endl;
  else cout << "No" << endl;

}

Measured memory_bytes: 256
def resolve():

    d, g = map(int, input().split())

    p = [0] * d
    c = [0] * d
    for i in range(d):
        p[i], c[i] = map(int, input().split())

    ans = 1010

    for i in range(2 ** d):

        sum = 0
        cnt = 0

        for j in range(d):

            if (i >> (d-1-j)) & 1:
                sum += p[j] * (j+1) * 100
                sum += c[j]
                cnt += p[j]

        if sum >= g:
            ans = min(ans, cnt)

        else:

            for j in range(d)[::-1]:

                if not (i >> (d-1-j)) & 1:
                    additional = -(-(g-sum) // ((j+1)*100))

                    if additional >= p[j]:
                        continue

                    cnt += additional
                    sum += additional * (j+1) * 100
                    break

            if sum >= g:
                ans = min(ans, cnt)

    print(ans)
    
resolve()

Measured memory_bytes: 41072
<?php
// Your code here!
    // $input_line = trim(fgets(STDIN));
    
    // $num = explode(" ",$input_line);
    
    // $W = intval($num[0]);
    // $H = intval($num[1]);
    // $x = intval($num[2]);
    // $y = intval($num[3]);
    // $r = intval($num[4]);
    
    $i=0;
    while($input_line = intval(trim(fgets(STDIN)))){
        $i++;
        if($input_line == 0){
            break;
        }
        echo "Case $i: $input_line";
        echo "\n";
    }
    

?>


Measured memory_bytes: 9200
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::{BufWriter, Write};

// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    input!(
        a: i32,
        b: i32,
    );

    let ans = max(0, a - 2 * b);

    println!("{}", ans);
}

fn main() {
    let stack_size = 1 << 28;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

#define i64 long long int

int main() {
	i64 a, b, k;
	cin>>a>>b>>k;
	
	i64 det = min(a, k);
	a-=det; k-=det;
	det = min(b, k);
	b-=det; k-=det;
	
	cout<<a<<' '<<b<<endl;
	
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
	int N;
	cin >> N;
	vector<string> W(N);
	bool flag = true;
	for (int i = 0; i < N; i++)
	{
		cin >> W[i];
		for (int j = 0; j < i; j++)
		{
			if (W[i]==W[j])
			{
				flag = false;
			}

		}
	}
	for (int i = 0; i < N-1; i++)
	{
		if (W[i][W[i].size()-1] != W[i + 1][0])
			flag = false;
	}
	if (flag)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

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

#define INF 1e9
using namespace std;
using ll = long long;

int main() {

    ll N, M, X; cin >> N >> M >> X;

    vector<ll> A(N+1, 0);
    for (int i = 0; i < M; ++i) {
        ll p;
        cin >> p;
        ++A[p];
    }

    ll l = 0;
    ll r = 0;

    for (int i = X; i >= 0 ; --i) {
        l += A[i];
    }

    for (int i = X; i <= N; ++i) {
        r += A[i];
    }

    cout << min(l, r) << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long N = Long.parseLong(sc.next());
    long M = (int)Math.sqrt(N);
    long Re = N+1;
    for(int i = 0;i<M;i++){
      if(N%(M-i)==0&&Re>M-i+N/(M-i)){
        Re = M-i+N/(M-i);
      }
    }
    System.out.println(Re-2);
  }
}

Measured memory_bytes: 27084
N,M,Q = [int(x) for x in input().split()]
A,B,C,D =[],[],[],[]
for _ in range(Q):
    a,b,c,d = [int(x) for x in input().split()]
    A.append(a)
    B.append(b)
    C.append(c)
    D.append(d)

def calc(T):
    score = 0
    for i in range(Q):
        if T[B[i]-1] - T[A[i]-1] == C[i]:
            score += D[i]
    return score

MA = 0
def dfs(T):
    global MA
    if len(T) == N:
        # print(T, calc(T))
        MA = max(MA, calc(T))
        return
    
    mi = 1 if len(T) == 0 else T[-1]
    for i in range(mi, M+1):
        T.append(i)
        dfs(T)
        T.pop()

dfs([])
print(MA)

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

typedef long long ll;
ll ans;
string a, b;
vector<ll> c[150];
int main()
{
	ll i, j, k;
	cin >> a >> b;
	for (i = 0; i < a.size(); i++) c[a[i]].push_back(i);
	for (i = 0, j = -1; i < b.size(); i++) {
		if (c[b[i]].size() == 0) {puts("-1"); return 0;}
		k = upper_bound(c[b[i]].begin(), c[b[i]].end(), j) - c[b[i]].begin();
		if (k == c[b[i]].size()) {
			ans += a.size() - j + c[b[i]][0];
			j = c[b[i]][0];
		} else {
			ans += c[b[i]][k] - j;
			j = c[b[i]][k];
		}
	}
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1724