akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
/*	#include <boost/math/common_factor.hpp>  boost::math::lcm(10,20) ---> use it to find lcm. fill_n(&an[0][0],n*m,0); typedef long long ll;*/
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long 
#define PI pair<int , int >
#define mpr make_pair
#define ff first
#define ss second
#define endl "\n"
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define FO(i,a,b) for(int i = (int)a;i < (int)b;++i)
#define FE(i,a,b) for(int i = (int)a;i <= (int)b;++i)
const int MOD = 1e9+7;
const int MAXN = 1e5+3;
const int inf = 2e9;
int max(int a,int b){	if(a > b)return a; else return b; }
int min(int a, int b){	if(a < b)return a; else return b; }
int dx[] = {1,-1,0,0};
int dy[] = {0,0,-1,1};
bool cmp(PI p1,PI p2){
	if(p1.ff < p2.ff)return true;	// You should not be writing p1.ss <= p2.ss !!!
	else if(p1.ff == p2.ff){ if(p1.ss < p2.ss)return true; return false; }
	return false;
}

void solve(){
	int n;
	cin >> n;
	int ans = 0;
	int j = 1;
	int i = n;
	while(i > 0){
		ans += j;
		i /= 2;
		j *= 2;
	}
	cout << ans << endl;
}

int32_t main(){
	IO;
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	#endif // ONLINE_JUDGE
	// std::cout << std::setprecision(15); std::cout << std::fixed;
	int t; t = 1;
	// cin >> t;
	FE(i,1,t)
		solve();
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int a = sc.nextInt();
        int b = sc.nextInt();
        pw.println(a%b == 0 ? 0 : 1);
        pw.flush();
    }

    static class GeekInteger {
        public static void save_sort(int[] array) {
            shuffle(array);
            Arrays.sort(array);
        }
 
        public static int[] shuffle(int[] array) {
            int n = array.length;
            Random random = new Random();
            for (int i = 0, j; i < n; i++) {
                j = i + random.nextInt(n - i);
                int randomElement = array[j];
                array[j] = array[i];
                array[i] = randomElement;
            }
            return array;
        }
 
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }
    
    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 33048
#include <stdio.h>

int a[200010];int f[200010];
struct oo{
    int m1,m2;
}tree[800080];
int minn(int aa,int bb){return aa<bb?aa:bb;}
int maxx(int aa,int bb){return aa>bb?aa:bb;}
int build(int i,int l,int r)
{
    if (l==r)
    {
        tree[i].m1=tree[i].m2=a[l];
        return 0;
    }
    build(i*2,l,(l+r)/2);build(i*2+1,(l+r)/2+1,r);
    tree[i].m1=minn(tree[i*2].m1,tree[i*2+1].m1);
    tree[i].m2=maxx(tree[i*2].m2,tree[i*2+1].m2);
}

int gai(int i,int l,int r,int wei,int tmp)
{
    if (l==r)
    {
        tree[i].m1=tree[i].m2=tmp;
        return 0;
    }
    if (wei<=(l+r)/2) gai(i*2,l,(l+r)/2,wei,tmp);
    else gai(i*2+1,(l+r)/2+1,r,wei,tmp);
    tree[i].m1=minn(tree[i*2].m1,tree[i*2+1].m1);
    tree[i].m2=maxx(tree[i*2].m2,tree[i*2+1].m2);
}


int main()
{
    int n,k;scanf("%d%d",&n,&k);
    for (int i=1;i<=n;i++)
        scanf("%d",&a[i]);

    f[0]=0;a[0]=-1;int tot=0;
    for (int i=1;i<=n;i++)
    {
        if (a[i]>a[i-1]) f[i]=f[i-1]+1;
        else f[i]=1;
        if (f[i]>=k) tot++;
    }
    build(1,1,k);
    int ans=1;
    if (f[k]==k) ans=0;
    int tmp=0;
    for (int i=k+1;i<=n;i++)
    {
        int lastmin=tree[1].m1;int lastmax=tree[1].m2;
        tmp++;if (tmp>k) tmp-=k;
        gai(1,1,k,tmp,a[i]);
        if (f[i]>=k || (tree[1].m1!=lastmin && tree[1].m2!=lastmax && a[i]==tree[1].m2 && a[i-k]==lastmin)) ;
        else ans++;

        //printf("%d %d %d %d  %d\n",lastmin,lastmax,tree[1].m1,tree[1].m2,a[i]);
    }

    //for (int i=1;i<=n;i++) printf("%d  ",f[i]);
    if (tot>0) ans= ans+1;
    printf("%d\n",ans);

}


Measured memory_bytes: 7808
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define ull unsigned long long
#define N 100005
#define mod 1000000007
#define boost ios_base::sync_with_stdio(false);cin.tie(0)
#define prec(n) fixed<<setprecision(n)

#define mii unordered_map<int,int>
#define mll unordered_map<ll,ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi  first

#define se second
#define pb push_back
#define mp make_pair
#define pp pop_back
#define vii vector<int>
#define vll vector<ll>
#define vpp vector<pii>
#define all(c) c.begin(),c.end()
#define tr(it,c) for(it = c.begin() ; it!=c.end() ; it++)
int inf = INT_MAX ;
ll modulo(ll num,ll MOD=mod){ return ((num%MOD)+MOD)%MOD;} // for negative integer
ll power(ll b,ll e,ll MOD=mod){ll ans=1; while(e){if(e%2) ans=(ans*b)%MOD; b=(b*b)%MOD; e/=2;} return ans;}
ll inv(ll num,ll MOD=mod){ return power(modulo(num),MOD-2,MOD); }
ll gcd(ll a,ll b){ return ((b==0) ? a:gcd(b,a%b));}

int main(){
	boost;
	int n;
	cin>>n;
	int arr[n];
	for(int i = 0;i<n;i++){
		cin>>arr[i];
	}
	
	int ans[n];
	for(int i = n-1;i>=0;i--){
		if(i==n-1){
			ans[i] = 0;
		}else if(i==n-2){
			ans[i] = abs(arr[i]-arr[i+1]);
		}else{
			ans[i] = min(abs(arr[i+1]-arr[i])+ans[i+1],abs(arr[i+2]-arr[i])+ans[i+2]);
		}
	}
	
	cout<<ans[0];
}

//Total solved problems:- 13



Measured memory_bytes: 1024
n = int(input())
L = sorted(input() for _ in range(n))
s = sorted(set(L))
c = [0] * len(s)
prev = L[0]
cnt = 1
l = 0
for i in range(1, len(L)):
    if L[i] == prev:
        cnt += 1
    else:
        c[l] = cnt
        l += 1
        cnt = 1
        prev = L[i]
c[-1] = cnt
m = max(c)
for j in range(len(c)):
    if c[j] == m:
        print(s[j])


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

int main() {
   int N,K;
   cin >> N >> K;
   int A[N];
   for (int i=0; i<N; i++) {
       cin >> A[i];
   }
   for (int i=K; i<N; i++) {
       if (A[i-K]<A[i]) cout << "Yes" << endl;
       else cout << "No" << endl;
   }
}

Measured memory_bytes: 4400
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <string.h>
#include <set>
#include <unordered_set>
#define mod 1000000007
#define maxn 100050
using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    map<int, int> num_count;
    for(int i=0; i<n; i++){
        int num;
        scanf("%d", &num);
        num_count[num]++;
        num_count[num-1]++;
        num_count[num+1]++;
    }
    int mx = 0;
    for(map<int, int>::iterator itr = num_count.begin(); itr!=num_count.end(); itr++){
        mx = max(mx, itr->second);
    }
    printf("%d\n", mx);
    return 0;
}



Measured memory_bytes: 4736
#pragma GCC optimize(2)
#include<iostream>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <cstring>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <sstream>
#include <map>
#include <unordered_map>
#include <vector> 
#include <bitset>
#include <cctype>
#include <set>
#include <stack>
#include <queue>
#include <fstream>
#include <numeric>
#include <random>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int MAXN = 1000005;
const int MAXM = 20500;
const ll MOD = 1e9+7;

#define MP make_pair
#define INF 0x3f3f3f3f
#define closeSync ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template <typename T> inline T min(T a, T b, T c,T d) { return min(min(a, b), min(c,d)); }
template <typename T, typename T1> inline T qpower(T x, T p, T1 mod) { T re = 1; x %= mod; while (p) { if (p & 1)re = (re * x) % mod; x = (x * x) % mod; p >>= 1; }return re; }
#define mst(X,Y) memset(X,Y,sizeof(X)) 
#define rep(i, a, n) for (int i=(a); i<=(n); i++)
#define per(i, a, n) for (int i=(a); i>=(n); i--)
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>void debug_out(Head H, Tail... T) { cerr << " " << to_string(H);    debug_out(T...);}

int a[MAXN];
int fac[MAXN];
bool pfc(int n)
{
	for (int i = 2; i * i <= n;i++)
	{
		if (n%i == 0)
		{
			if (fac[i])
				return false;
			else 
				fac[i] = 1;
			while (n%i == 0)
				n/=i;
		}
	}
	if (n != 1)
	{
		if (fac[n])
			return false;
		else 
			fac[n] = 1;
	}
	return true;
}


int main()
{closeSync;
#ifdef DEBUG
	//freopen("C:/Users/86159/Desktop/input.txt", "r", stdin);
	//freopen("C:/Users/86159/Desktop/output.txt", "w", stdout);
#endif
	//clock_t c1 = clock();
	int n;
	cin>>n;
	rep (i,1,n)
		cin>>a[i];
	bool pc = true;
	rep (i,1,n)
	{
		if (!pfc(a[i]))
		{
			pc = false;
			break;
		}
	}
	if (pc)
		cout<<"pairwise coprime\n";
	else
	{
		int cd = a[1];
		rep (i,2,n)
			cd = __gcd(cd,a[i]);
		if (cd == 1)
			cout<<"setwise coprime\n";
		else 
			cout<<"not coprime\n";
	} 


	//cerr << "Time:" << clock() - c1 << "ms" <<endl;
    return 0;
}

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

int main(){
    int n;cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    sort(a.begin(),a.end());
    ll base=a[n-1]%2? (a[n-1]+2)/2:(a[n-1]+1)/2;
    auto itr=lower_bound(a.begin(),a.end(),base);
    int k=itr-a.begin();
    ll r=a[k]-base,l=a[k-1]-base;
    if(r<0)r*=-1;
    if(l<0)l*=-1;
    if(r<=l&&k!=n-1){
        cout<<a[n-1]<<" "<<a[k];
    }else{
        cout<<a[n-1]<<" "<<a[k-1]<<endl;
    }
}



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

int64_t mod_fact(int64_t n)
{
  int64_t fact(1);
  for (int64_t i = 1; i <= n; i++) {
    fact *= i;
    fact %= 1'000'000'007;
  }
  return fact;
}

int main()
{
  int64_t n, m;
  cin >> n >> m;
  int64_t ans(0);
  if ((n > m ? n : m) - (n <= m ? n : m) > 1) ans = 0;
  else ans = (mod_fact(n) * mod_fact(m) * (n == m ? 2 : 1)) % 1'000'000'007;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

int N,M,a[200009],b[200009];
map<pair<int,int>,int> MM;

int main(){
    cin >> N >> M;
    for(int i = 1; i <= M; i++){
        cin >> a[i] >> b[i];
        MM[make_pair(a[i],b[i])] = 1;
        MM[make_pair(b[i],a[i])] = 1;
    }
    int G = 0;
    for(int i = 2; i <= N; i++){
        if(MM[make_pair(1,i)] == 1 && MM[make_pair(i,N)] == 1) G = 1;
    }
    if(G == 0) cout << "IMPOSSIBLE" << endl;
    else cout << "POSSIBLE" << endl;
    return 0;
}
  


Measured memory_bytes: 39296
r, g, b, n = gets.chomp.split.map(&:to_i)
# 小さい順に並ぶ
boxes = [r, g, b].sort
answer = 0
for i in 0..n/boxes[2] do
  tmp2 = n - boxes[2] * i
  for j in 0..tmp2/boxes[1] do
    tmp1 = tmp2 - boxes[1] * j
    answer += 1 if tmp1 % boxes[0] == 0
  end
end

print("#{answer}\n")

Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<string>
#include<functional>
using namespace std;
typedef	long long int ll;

int main(){
    ll n, k;
    cin >> n >> k;
    if(k%2==0){
        ll a = n/k;
        ll b = (n/(k/2)+1)/2;
        cout << a*a*a+b*b*b << endl;
    }
    else{
        ll a = n/k;
        cout << a*a*a << endl;
    }
    return 0;
}

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

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

	long long a;
	for(int i=0; i<N; i++){
		cin >> a;

		if(a%2 == 1){
			cout << "first" << endl;
			return 0;
		}
	}

	cout << "second" << endl;

	return 0;
}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX;
const ll MINF = LONG_LONG_MIN;
const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;

int main() {
    ll x;
    cin >> x;
    ll a = x / 11;
    ll b = x % 11;
    if (b == 0) {
        cout << a * 2  << endl;
    } else if (b <= 6) {
        cout << a * 2 + 1 << endl;
    } else {
        cout << a * 2 + 2 << endl;
    }

}


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

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

vector<vector<int>> g;
vector<int> cnt;

void operation(int idx, int val){
    cnt[idx] += val;
    rep(i, g[idx].size()){
        operation(g[idx][i], val);
    }
}

void forward(int idx){
    int val = cnt[idx];
    rep(i, g[idx].size()){
        cnt[g[idx][i]] += val;
        forward(g[idx][i]);
    } 
}

int main() {
    int n, q; cin >> n >> q;
    g.resize(n);
    cnt.resize(n);
    int a, b;
    rep(i, n-1){
        cin >> a >> b;
        g[a-1].push_back(b-1);
    }
    int p, x;
    rep(i, q){
        cin >> p >> x;
        // operation(p-1, x);
        cnt[p-1] += x;
    }
    forward(0);
    rep(i, n) cout << cnt[i] << " ";
    cout << endl;
    return 0;
}


Measured memory_bytes: 20352
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        String[] array = s.split("");
        int count = 0;
        for(int i=0;i<n-2;i++){
            if(array[i].equals("A")){
                if(array[i+1].equals("B")){
                    if(array[i+2].equals("C")){
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int ans = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] == a[i-1]) {
      a[i] = 0;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
    string s;
    cin >> s;
    if(s.front()!='A') {cout << "WA" << endl; return 0;}
    bool ok = true;
    int cnt = 0;
    if(s[1] >= 'A' && s[1] <= 'Z') ok = false;
    for(int i = 2; i <= s.size()-2; ++i) {
        if(s[i]=='C') {cnt++; continue;}
        if(s[i] >= 'A' && s[i] <= 'Z') ok = false; 
    }
    if(s[s.size()-1] >= 'A' && s[s.size()-1] <= 'Z') ok = false;
    if(cnt!=1 || !ok) {cout << "WA" << endl; return 0;}
    cout << "AC" << endl;
    return 0;
}

Measured memory_bytes: 3536
#include <bits/stdc++.h>
typedef long long i64;
using std::cout;
using std::endl;
using std::cin;

struct UnionFind {
	std::vector<int> data;
	
	UnionFind(int n) {
		data.assign(n, -1);
	}
	
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if(x == y) return;
		if(data[x] > data[y]) std::swap(x, y);
		data[x] += data[y];
		data[y] = x;
	}
	
	int find(int k) {
		if(data[k] < 0) return k;
		return data[k] = find(data[k]);
	}
	
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};

int main(){
	int n; cin >> n;
	std::vector<int> x(n), y(n);
	std::vector<std::pair<int, int>> X, Y;
	std::vector<std::pair<int, std::pair<int, int>>> latte;
	for(int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
		
		X.push_back({x[i], i});
		Y.push_back({y[i], i});
	}
	sort(begin(X), end(X)); sort(begin(Y), end(Y));
	
	for(int i = 0; i < n - 1; i++) {
		latte.push_back({X[i + 1].first - X[i].first, {X[i + 1].second, X[i].second}});
		latte.push_back({Y[i + 1].first - Y[i].first, {Y[i + 1].second, Y[i].second}});
	}
	sort(begin(latte), end(latte));
	
	i64 ans = 0;
	UnionFind uf(n);
	for(int i = 0; i < latte.size(); i++) {
		if(uf.same(latte[i].second.first, latte[i].second.second)) continue;
		uf.unite(latte[i].second.first, latte[i].second.second);
		ans += latte[i].first;
	}
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 7784
// -*- coding:utf-8-unix -*-

// use proconio::derive_readable;
use proconio::fastout;
use proconio::input;
// use std::convert::TryInto;
use libm::*;
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
use superslice::*;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//abc152-D
#[fastout]
fn main() {
    input![n: u64];

    let mut comb = vec![0; 100];

    for i in 1..(n + 1) {
        if i % 10 == 0 {
            continue;
        }

        let d1 = i % 10;
        let mut d10 = i;
        while d10 > 9 {
            d10 /= 10;
        }

        let key = (d1 + d10 * 10) as usize;
        // eprintln!("i:{}, key; {}", i, key);
        comb[key] += 1;
    }

    let mut ans = 0;

    // let mut idx = 1;
    let mut is_visits = vec![false; 100];
    for (idx, c) in comb.iter().enumerate() {
        if is_visits[idx as usize] {
            continue;
        }

        if *c > 0 {
            // eprintln!(
            //     "idx + 1: {}, comb: {}, +{}",
            //     idx + 1,
            //     c,
            //     max(0, (c * (c - 1) / 2) + c as u64)
            // );

            let d1 = (idx) % 10;
            let mut d10 = idx;
            while d10 > 9 {
                d10 /= 10;
            }
            let inv_idx = (d1 * 10 + d10 * 1) as usize;

            ans += comb[inv_idx as usize] * c;
            // eprintln!(
            //     "idx: {}, inv_idx: {}, c: {}, c_inv: {}",
            //     idx, inv_idx, c, comb[inv_idx as usize]
            // );

            // is_visits[idx] = true;
            // is_visits[inv_idx] = true;
        }
    }

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


Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin >> n;
    int v[n];
    map<int,int> a,b;
    vector<pair<int,int>> c,d;
    for(int i=0;i<n;i++) cin >> v[i];
    for(int i=0;i<n;i++){
        if(i%2==0) a[v[i]]++;
        else b[v[i]]++;
    }
    for(auto i:a) c.push_back(make_pair(i.second,i.first));
    for(auto i:b) d.push_back(make_pair(i.second,i.first));
    sort(c.begin(),c.end());
    sort(d.begin(),d.end());
    reverse(c.begin(),c.end());
    reverse(d.begin(),d.end());
    if(c[0].second!=d[0].second) cout << n-c[0].first-d[0].first << endl;
    else cout << min(n-c[1].first-d[0].first,n-c[0].first-d[1].first) << endl;
}

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

int main(){
    string s; cin >> s; int ans = INT_MAX;
    char target = s[0]; int tgt_cnt = 0;
    for (char j : s) if (j == target) tgt_cnt++;
    if(tgt_cnt == (int)s.size()) {
        cout << 0 << endl; return 0;
    }
    for (char i = 0; i < 26; i++) {
        target = i + 'a'; int cnt = 0;
        string t1 = s, t2;
        while(true) {
            t2 = ""; tgt_cnt = 0;
            for (auto j = 0; j < (int)t1.size() - 1; j++) {
                if (t1[j] == target or t1[j + 1] == target) t2 += target, tgt_cnt++;
                else t2 += t1[j];
            }
            t1 = t2; cnt++;
            if(tgt_cnt == (int)t2.size()) break;
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
using namespace std;

#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, a, b) for (int i = a; i > b; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define int long long

typedef long long ll;
typedef pair<int, int> Pair;

const int kMaxN = 3*100000;

int N;
string S;
int ans = kMaxN;

// w_count[i] = [0, i]までに存在する'W'の数
// e_count[i] = [i, N-1]までに存在する'E'の数
int w_count[kMaxN], e_count[kMaxN];

signed main() {
  cin >> N;
  cin >> S;

  w_count[0] = (S[0] == 'W') ? 1 : 0;
  e_count[N-1] = (S[N-1] == 'E') ? 1 : 0;
  FOR(i, 1, N) {
    w_count[i] = (S[i] == 'W') ? w_count[i-1]+1 : w_count[i-1];
    e_count[N-1-i] = (S[N-1-i] == 'E') ? e_count[N-1-(i-1)]+1 : e_count[N-1-(i-1)];
  }

  REP(i, N) {
    if (i == 0) {
      ans = MIN(ans, e_count[i+1]);
    } else if (i == N-1) {
      ans = MIN(ans, w_count[i-1]);
    } else {
      ans = MIN(ans, w_count[i-1]+e_count[i+1]);
    }
  }

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


Measured memory_bytes: 5380
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  int n,a,b,c,d;
  string s;
  cin>>n>>a>>b>>c>>d;
  cin>>s;
  for(int i=a-1;i<c-1;i++)
    {
    	if(s[i]=='#'&&s[i+1]=='#'){
    		cout<<"No"<<endl;
    		return 0;
    	}
    }
  for(int i=b-1;i<d-1;i++)
    {
    	if(s[i]=='#'&&s[i+1]=='#'){
    		cout<<"No"<<endl;
    		return 0;
    	}
    } 
   if(c<d)
   {
   	  cout<<"Yes"<<endl;
   	  return 0;
   }
   for(int i=b-1;i<=d-1;i++){
   	  if(s[i-1]=='.'&&s[i]=='.'&&s[i+1]=='.')
   	  {
   	  cout<<"Yes"<<endl;
   	  return 0;
     }
   }
   	cout<<"No"<<endl;
	return 0;
}


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

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007

    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    //#define float long double
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}


     int solve()
     {
         int n,k;
         cin>>n>>k;
         cout<<max(0,n-k+1);
     }
    signed main()
    {   
        
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

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

int main(void){
    int a;
    string s;
    cin>>a>>s;

    int len=s.size();
    if(len>a){
        for(int i=0; i<a; i++){
            cout<<s[i];
        }
        cout<<"...";
    }
    else
        cout<<s;
}


Measured memory_bytes: 3584
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)
import bisect
import heapq
import itertools
import math
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

n,d = MI()
ans = 0
for i in range(n):
    x,y = MI()
    if x**2+y**2 <= d**2:
        ans+=1
print(ans)

Measured memory_bytes: 10068
#include<bits/stdc++.h>
using namespace std;
int arr[100009];
int dp[100009];
int f(int n)
{
    if(n==1)
        return 0;
    if(n==2)
        return abs(arr[2]-arr[1]);
    if(dp[n]!=-1)
        return dp[n];
    else
    {
        dp[n] = min( f(n-1)+ abs(arr[n-1]-arr[n]),f(n-2)+abs(arr[n-2]-arr[n]));
    }
    return dp[n];
}
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<=n;i++)
        dp[i] = -1;
    for(int i=1;i<=n;i++)
        cin>>arr[i];
    cout<<f(n)<<endl;
    return 0;
}


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

/** Problem0009 : Prime Number **/
#define MAX 1000000

int main()
{
	bool prime[MAX];
	int  input, count;
	
	for (int i=0; i<MAX; i++)
		prime[i] = true;
	
	prime[0] = false; prime[1] = false;
	
	
	for (int i=2; i<MAX; i++) {
		if (prime[i]) {
			for (int j=2; i*j<MAX; j++) {
				prime[i*j] = false;
			}
		}
	}
	
	while (cin >> input) {
		count = 0;
		for (int i=0; i<=input; i++) {
			if (prime[i]) count++;
		}
		cout << count << endl;
	}
}

Measured memory_bytes: 2136
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int A, B;

bool isKaibun(int _num) {
	int keta[5];
	REP(i, 5) {
		keta[i] = _num % 10;
		_num /= 10;
	}
	if (keta[0] != keta[4] || keta[1] != keta[3]) {
		return false;
	}
	int num_inv = 0;
	REP(i, 5) {
		num_inv += pow(10, 4 - i)*keta[i];
	}
	if (num_inv >= A && num_inv <= B) {
		return true;
	}
	return false;
}

int main() {
	cin >> A >> B;
	int count = 0;
	REPS(i, A, B + 1) {
		if (isKaibun(i)) {
			count++;
		}
	}
	cout << count;
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include<cstdio>
#include<algorithm>
#include<utility>

using namespace std;

int main(void){
    int N;
    scanf("%d",&N);
    int X[N],L[N];
    for(int i=0;i<N;i++){
        scanf("%d %d",&X[i],&L[i]);
    }
    pair<int,int> itv[N];
    for(int i=0;i<N;i++){
        itv[i].first = X[i]+L[i];
        itv[i].second = X[i]-L[i];
    }
    sort(itv,itv+N);

    int ans = 0;
    int t = -1000000001;
    for(int i=0;i<N;i++){
        if(t<=itv[i].second){
            ans ++;
            t = itv[i].first;
        }
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 1664
#include <stdio.h>

int main(){
    int a,b,flg=0;
    scanf("%d %d",&a,&b);
    while(1){
        a-=b;
        flg++;
        if(a<=0){
            printf("%d\n",flg);
            break;
        }
    }
    return 0;
}

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

int main()
{
	int h;
	cin >> h;
	vector<int> a(h + 1);
	for (int i = 1; i <= h; i++) cin >> a[i];

	for (int i = 1; i <= h; i++) {
		cout << "node " << i << ": ";
		cout << "key = " << a[i] << ", ";
		int parent = a[i / 2];
		if (1 <= i / 2 && i / 2 <= h) cout << "parent key = " << a[i / 2] << ", ";
		if (1 <= 2 * i && 2 * i <= h) cout << "left key = " << a[2 * i] << ", ";
		if (1 <= 2 * i + 1 && 2 * i + 1 <= h) cout << "right key = " << a[2 * i + 1] << ", ";
		cout << endl;
	}
}


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

using namespace std;

int main() {
    int A, B, cnt = 0;
    cin >> A >> B;

    for (int i = 0; i < 2; ++i) {
        if (A >= B) {
            cnt += A;
            A--;
        } else {
            cnt += B;
            B--;
        }
    }

    cout << cnt << endl;

}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
#define mod  200003//1000000007
#define pub(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main(){
   ios_base::sync_with_stdio(false);
   ll n;
   cin>>n;
   bool y =0;
   for(int i =1;i<10;i++){
      if(n%i==0 && (n/i <10)){
         y =1;
         break;
      }
   }
   cout<<(y?"Yes":"No");
   return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int N, K;

void naive() {
    LL ans = 0;
    FOR(i, 1,  N + 1) {
        FOR(j, 1, N + 1) {
            FOR(k, 1, N + 1) {
                if ((i + j) % K == 0 &&
                    (j + k) % K == 0 &&
                    (k + i) % K == 0) {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}

int main(void) {
    cin >> N >> K;
    LL ans = 0;
    const auto foo = N / K;
    if (K % 2 == 0) {
        // all (mod K == k/2) count
        if (N % K >= K / 2) {
            ans += powl(foo + 1, 3);
        } else {
            ans += powl(foo, 3);
        }
    }
    // all (mod K == 0) count
    ans += powl(foo, 3);
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <vector>
#include <string>
#include <set>
#include <iterator>
#include <unordered_map>
#include <iomanip>
#include <cmath>
#include <limits>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <unordered_set>
#include <fstream>

using namespace std;

#define Fill(a, b) memset(a, b, sizeof(a))
typedef long long LL;
const LL inf = 1LL << 61;
const LL mod = 1000000007;

#ifndef DEBUG
#define DEBUG
#endif

#ifdef DEBUG
#define Debug(x) cout << #x << "=" << (x) << endl;
#else
#define Debug(x) ;
#endif



int main() {
    
    std::ios::sync_with_stdio(false);
    
    unordered_map<int, int> m;
    int n;
    cin >> n;
    int d;
    for (int i = 0; i < n; i++) {
        cin >> d;
        m[d]+=1;
    }
    
    cin >> n;
    bool res = true;
    for (int i = 0; i < n; i++) {
        cin >> d;
        if (m.find(d) != m.end() && m[d] > 0) {
            m[d]-=1;
        } else {
            res = false;
        }
    }
    
    if (res) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 8520
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main() {
  int n,m; cin >> n >> m;
  int a[n],b[n],c[m],d[m];
  for(int i=0;i<n;i++) cin >> a[i] >> b[i];
  for(int i=0;i<m;i++) cin >> c[i] >> d[i];
  int dis[n];
  for(int i=0;i<n;i++) dis[i]=abs(a[i]-c[0])+abs(b[i]-d[0]);
  
  int ans[n]={};
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      if(dis[i]>abs(a[i]-c[j])+abs(b[i]-d[j])){
        dis[i]=abs(a[i]-c[j])+abs(b[i]-d[j]);
        ans[i]=j;
      }
    }
  }
  for(int i=0;i<n;i++) cout << ans[i]+1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[3];
int main(){
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    if (a[2] == a[0]+a[1]){
        cout << "Yes";
    } else { cout << "No";}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

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

int main()
{   
    int N, i;
    string a;
    int b;
    cin >> N;
    vector<pair<string, int>> pairs(N);
    map<int, int> hash;
    for(i=0; i<N; i++){
        cin >> a >> b;
        pairs[i] = make_pair(a, b);
        hash[b] = i+1;
    }
    sort(pairs.begin(), pairs.end(), compare_first);
    for(i=0; i<N; i++){
        cout << hash[pairs[i].second] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int m;
		int f;
		int r;
		ArrayList<String> list = new ArrayList<String>();
		while(true){
			m = scan.nextInt();
			f = scan.nextInt();
			r = scan.nextInt();
			if(m == -1 && f == -1 && r == -1){
				break;
			}else if(m == -1 || f == -1){
				list.add("F");
			}else if(80 <= m + f){
				list.add("A");
			}else if(65 <= m + f){
				list.add("B");
			}else if(50 <= m + f){
				list.add("C");
			}else if(30 <= m + f){
				if(50 <= r){
					list.add("C");
				}else{
					list.add("D");
				}
			}else{
				list.add("F");
			}
		}
		for(int i = 0; i < list.size(); i++){
			System.out.println(list.get(i));
		}

		scan.close();
	}
}

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


 const int MAX = 1001;
const int MOD = 1000000007;



signed main(){
    int x,k;
    cin>>x>>k;
    int r[k];
    for(int i=0;i<k;i++)cin>>r[i];
    int q,d=0;
    cin>>q;
    int p=0,t,a,amin=0,amax=x;
    for(int i=0;i<q;i++){
        cin>>t>>a;
        while(p<k&&r[p]<t){
            if(p%2==0){
                if(p==0){
                    amin=r[p];
                    if(amin>amax)amax=amin;
                     d-=r[p];
                }else{
                    d-=(r[p]-r[p-1]);
                   
                         amin=max(amin,-d);
                         if(amin>amax)amax=amin;
                    
                   
                   
                     
                }
               
            }else{
                  d+=(r[p]-r[p-1]);
                if(p==1){
                    
                          amax=min(amax,x-d);
                    if(amax<amin)amin=amax;
                    
                  
                }else{
                    
                        amax=min(amax,x-d);
                        if(amax<amin)amin=amax;
                    
                } 
                
              
              
            }
            p++;
        }
        a=max(a,amin);a=min(a,amax);int o=0;
       // cerr<<d<<r[p-1]<<' '<<amax<<' '<<amin<<endl;
        if(p==0)cout<<min(max(a+d-t,o),x)<<endl;
        else{
            if(p%2==0)cout<<min(max(a+d-(t-r[p-1]),o),x)<<endl;
            else cout<<min(max(a+d+(t-r[p-1]),o),x)<<endl;
        }

    }

   return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define sz(x) (int)x.size()
#define newl "\n"
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define vl vector<ll>
#define pll pair<ll, ll>
#define vll vector<pll>
#define coutp cout << fixed << setprecision(12)
#define mem(x, val) memset(x, val, sizeof(x))
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define all(v) (v).begin(), (v).end()

const ld pi = 3.14159265359;
ll INF = 1e18 + 10;
ll MOD = 998244353;
ll mod = 1e9 + 7;

inline ll add(ll a, ll b, ll m)
{
    if ((a + b) >= m)
        return (a + b) % m;
    return a + b;
}

inline ll mul(ll a, ll b, ll m)
{
    if ((a * b) < m)
        return a * b;
    return (a * b) % m;
}

ll power(ll x, ll y, ll m)
{
    ll res = 1;
    x = x % m;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % m;
        y = y >> 1;
        x = (x * x) % m;
    }
    return res;
}
int n;
vl a(3001);
vector<vl> dp(3001,vl(3001,-1));

ll f(int l,int r) {
    if(l>r) return 0;
    if(dp[l][r]!=-1) return dp[l][r];
    dp[l][r] = max(a[l]+min(f(l+2,r),f(l+1,r-1)),a[r]+min(f(l+1,r-1),f(l,r-2)));
    return dp[l][r];
}

void solve()
{
    int n;
    cin>>n;
    ll tsum=0;
    for(int i=0;i<n;i++) {
        cin>>a[i];
        tsum+=a[i];
    }

    ll ans = f(0,n-1);
    cout<<(2*ans-tsum); 
}

int main()
{
    fastio;
    int t;
    t = 1;
    //cin >> t;
    //int test=t;
    
    while (t-- > 0)
    {
        //cout<<"Case #"<<(test-t)<<": ";
        solve();
        cout << newl;
    }

    return 0;
}

Measured memory_bytes: 74260
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;
  l:array of Integer;
  s,s123,s1,s2,s3:string;
  al:string = 'abcdefghijklmnopqrstuvwxyz';
  tf,tfl,tfr:Boolean;
begin
  try
    { TODO -oUser -cConsole メイン : ここにコードを記述してください }
    Readln(a);
    count:=0;
    max  :=0;
              {
    while true do begin
      sum:=a div 10;
      inc(count);
    end;     }


    for i:=1 to length(inttostr(a)) do
      count:=count+strtoint(inttostr(a)[i]);

    if a mod count = 0 then
      Writeln('Yes')
    else
      Writeln('No');
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

Measured memory_bytes: 128
s = int(input())
sd = s%100
su = s//100
if sd >= 13 or sd == 0 :
    if su >= 13 or su == 0:
        print("NA")
    else :
        print("MMYY")
else :
    if su >= 13 or su == 0 :
        print("YYMM")
    else :
        print("AMBIGUOUS")


Measured memory_bytes: 2940
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif
template<class T> ostream& operator<<(ostream& os, vector<T> const& v){
    rep(i,v.size()) os << v[i] << (i+1==v.size()?"":" ");
    return os;
}

const int MP = 1299709+1000;

vi seive(){
    vi isp(MP);
    loop(i,2,MP) isp[i] = i;
    loop(i,2,MP) if(isp[i]) for(int j=i+i;j<MP;j+=i) isp[j] = 0;
    isp.erase(remove(all(isp), 0), isp.end());
    return isp;
}

int main(){
    auto ps = seive();
    int n;
    while(cin>>n && n){
        auto i = lower_bound(all(ps), n);
        if(*i==n){
            cout << 0 << endl;
        } else {
            auto j = i-1;
            cout << *i-*j << endl;
        }
    }
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  if (a < b && b < c) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  return 0;
  
}



Measured memory_bytes: 3092
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a < b){
            System.out.println("a < b");
        }else if(a == b){
            System.out.println("a == b");
        }else{
            System.out.println("a > b");
        }
        sc.close();
    }
}


Measured memory_bytes: 26040
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n],ans=n;
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  bool up=true,down=true;
  for(int i=0;i<n-1;i++){
    if(a[i]==a[i+1]){
      ans--;
    }else if(a[i]<a[i+1]){
      up=false;
      if(down==false){
        up=true;
        down=true;
      }else{
        ans--;
      }
    }else{
      down=false;
      if(up==false){
        up=true;
        down=true;
      }else{
        ans--;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
fun main(args: Array<String>) {
    val (sx, sy, tx, ty) = readLine()!!.split(' ').map(String::toInt)
    val dx = tx - sx
    val dy = ty - sy

    (1..dy).forEach { print("U") }
    (1..dx).forEach { print("R") }

    (1..dy).forEach { print("D") }
    (1..dx).forEach { print("L") }

    print("L")
    (1..(dy+1)).forEach { print("U") }
    (1..(dx+1)).forEach { print("R") }
    print("D")

    print("R")
    (1..(dy+1)).forEach { print("D") }
    (1..(dx+1)).forEach { print("L") }
    print("U")
}

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

int	main()
{
	int	n, m;
	cin >> n >> m;
	vector<vector<int>> a(n, vector<int>(m));
	vector<int> b(m);
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j)
			cin >> a.at(i).at(j);
	}
	for (int j = 0; j < m; ++j)
		cin >> b.at(j);
	for (int i = 0; i < n; ++i) {
		int c = 0;
		for (int j = 0; j < m; ++j)
			c += a.at(i).at(j) * b.at(j);
		cout << c << endl;
	}
}



Measured memory_bytes: 3164
#include<iostream>
#include<string.h>
#include<algorithm>

using namespace std;

int main(){
  string a;
  cin >> a;
  size_t aa = a.length();
  if(aa > 2){
    reverse(a.begin(), a.end());
    cout << a << endl;
  }
  else{
    cout << a << endl;
  }
  return 0;
}

Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        var nm = Console.ReadLine().Split();
        var n = int.Parse(nm[0]);
        var m = int.Parse(nm[1]);

        var A = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

        var dp = new string[n + 1];
        dp[0] = "";
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < m; j++)
            {
                if (i + 1 < nums(A[j])) continue;
                if (dp[i + 1 - nums(A[j])] == null) continue;

                dp[i + 1] = max(dp[i + 1], dp[i + 1 - nums(A[j])] + A[j]);
            }
        }

        Console.WriteLine(dp[n]);
    }

    static string max(string x, string y)
    {
        if (x == null) return y;
        if (y == null) return x;
        if (x.Length < y.Length) return y;
        if (y.Length < x.Length) return x;

        if (0 < x.CompareTo(y))
        {
            return x;
        }
        else
        {
            return y;
        }
    }

    static int[] _nums = new[] { 2, 5, 5, 4, 5, 6, 3, 7, 6 };
    static int nums(int n)
    {
        return _nums[n - 1];
    }
}


Measured memory_bytes: 94980
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N, M;
  cin >> N >> M;
  
  vector<int64_t> vec(N);
  int64_t sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
    sum = sum + vec.at(i);
  }
  
  int64_t count = 0;
  for (int j = 0; j < N; j++) {
    if (vec.at(j) * 4 * M >= sum) {
      count++;
    }
  }
  
  string res = "No";
  if (M <= count) {
    res = "Yes";
  }
  
  cout << res << endl;
  
  
}

Measured memory_bytes: 256
def get_pattern(n, y):
    X = 10
    Y = 5
    Z = 1

    y //= 1000
    for nx in range(n+1):
        m = n - nx
        for ny in range(m+1):
            nz = m - ny
            sum = nx * X + ny * Y + nz * Z
            if y == sum:
                return nx, ny, nz
    return -1, -1, -1


n, y = [int(x) for x in input().split()]
a, b, c = get_pattern(n, y)
print(a, b, c)


Measured memory_bytes: 3064
import java.util.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

// AOJ 0017
public class Main {

	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		while (sc.hasNextLine()) {
			char[] cs = sc.nextLine().toCharArray();
			for (int i = 0; i < 26; i++) {
				char[] cs2 = new char[cs.length];
				for (int j = 0; j < cs.length; j++) {
					char c = cs[j];
					if (c != ' ' && c != '.') {
						c = (char)((int)(c - 'a' + i) % 26 + 'a');
					}
					cs2[j] = c;
				}
				
				String tmp = new String(cs2);
				//System.out.println(tmp);
				if (tmp.indexOf("the") >= 0 || tmp.indexOf("this") >= 0 || tmp.indexOf("that") >= 0) {
					System.out.println(tmp);
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 12000