akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(){
	int n,i,j,k,temp,count=0;
	scanf("%d",&n);
	int len[n];
	for(i=0;i<n;i++)
		scanf("%d",&len[i]);
	for(i=0;i<n-1;i++){
		k=0;
		for(j=n-1;j>i;j--)
			if(len[j]<len[j-1]){
				temp=len[j];
				len[j]=len[j-1];
				len[j-1]=temp;
				k=1;
			}
		if(!k)
			break;
	}
	i=0;j=1;k=2;
	while(i!=n-2){
		while(k<=n-1&&len[i]+len[j]>len[k++]){count++;}
		if(j==n-2){
			i++;
			j=i+1;
		}else
			j++;
		k=j+1;
	}
	printf("%d",count);
	return 0;
}

Measured memory_bytes: 128
# Author: cr4zjh0bp
# Created: Tue Mar 17 19:50:06 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import deque

sys.setrecursionlimit(10 ** 6)

n, q = na()
ab = nan(n - 1)
px = nan(q)

tree = [[] for _ in range(n)]
for i in range(n - 1):
    a, b = ab[i]
    a -= 1
    b -= 1
    tree[a].append(b)
    tree[b].append(a)

cnt = [0 for _ in range(n)]
for i in range(q):
    p, x = px[i]
    p -= 1
    cnt[p] += x

def dfs(i, p, s):
    x = s + cnt[i]
    cnt[i] = x
    for j in tree[i]:
        if j == p:
            continue
        dfs(j, i, x)

def bfs():
    q = deque()
    q.append((0, -1, 0))
    while len(q):
        p, b, s = q.popleft()
        x = s + cnt[p]
        cnt[p] = x
        for i in tree[p]:
            if i == b:
                continue
            q.append((i, p, x))

bfs()
print(*cnt)

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> ii;
typedef map<int, int> MPII;
typedef set<int> SETI;

const int mxN = 2e5;
const ld pi = 4.0 * atanl(1.0);
const int iinf = 1e9 + 10;
const int inf = 1e18 + iinf + 10;
const int mod = 1000000007;
const ld prec = .000001;

#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(c) c.begin(), c.end()
#define rall(c) c.end(), c.begin()

int n, m, t, a[mxN];
vi v;

void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }

int main() {
  fast();
  int x;
  cin >> n >> m >> x;
  for (int i = 0; i < m; ++i) cin >> a[i];
  int cz = 0, cm = 0;
  for (int i = 0; i < m; ++i) {
    if (a[i] < x && a[i] < n) ++cz;
    if (a[i] > x && a[i] < n) ++cm;
  }
  cout << min(cz, cm);

  return 0;
}



Measured memory_bytes: 3576
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int h, w, m;
    cin >> h >> w >> m;
    vector<int> h_accum(h);
    vector<int> w_accum(w);
    set<pair<int, int>> st;
    rep(i, m) {
        int hh, ww;
        cin >> hh >> ww;
        --hh, --ww;
        ++h_accum[hh];
        ++w_accum[ww];
        st.insert(make_pair(hh, ww));
    }
    int h_max = *max_element(h_accum.begin(), h_accum.end());
    int w_max = *max_element(w_accum.begin(), w_accum.end());
    vector<int> h_max_v, w_max_v;
    rep(i, h) if(h_accum[i] == h_max) h_max_v.push_back(i);
    rep(i, w) if(w_accum[i] == w_max) w_max_v.push_back(i);
    if ((ll)(h_max_v.size()) * (ll)(w_max_v.size()) > m) {
        cout << h_max + w_max << endl;
        return 0;
    }
    rep(i, (int)(h_max_v.size())) {
        rep(j, (int)(w_max_v.size())) {
            if (st.count(make_pair(h_max_v[i], w_max_v[j])) == 0) {
                cout << h_max + w_max << endl;
                return 0;
            }
        }
    }
    cout << h_max+ w_max - 1 << endl;
    return 0;
}


Measured memory_bytes: 23808
#include <iostream>
#include <utility>
#include <string.h>
using namespace std;

int main() {
    int n, x;
    cin >> n >> x;
    
    int res = 0;
    int m[n];
    int m_min = 0;
    for (int i = 0; i < n; i++) {
        cin >> m[i];
        x -= m[i];
        res++;
        if (m_min == 0 || (m_min > 0 && m[i] < m_min)) m_min = m[i];
    }

    res += x / m_min;
    x = x % m_min;
    cout << res << endl;
}

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

int main() {
  int64_t N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;
  
  int64_t chisai = min( {A, B, C, D, E} );
  N = N - chisai;
  int64_t ans = 5;
  if( N <= 0 ){
    cout << ans << endl;
  }else{
    ans += (N + chisai - 1) / chisai;
    cout << ans << endl;
  }
  
  
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2

using namespace std;
int MOD = 1000000007;

signed main(){
    int n;
    cin >> n;
    if(n >= 1200)cout << "ARC";
    else cout << "ABC";
    
    return 0;   
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://ddcc2019-final.contest.atcoder.jp/tasks/ddcc2019_final_a
// rm -r -f test;oj dl http://arc060.contest.atcoder.jp/tasks/arc060_a

Measured memory_bytes: 764
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string in;
	int ans=0;
	while(getline(cin,in))
	{
		int cnt=0;
		for(int i = 0; i < in.size(); ++i)
		{
			if('0'<=in[i]&&in[i]<='9')
			{
				cnt*=10;
				cnt+=in[i]-'0';
			}
			else
			{
				ans+=cnt;
				cnt=0;
			}
		}
		ans+=cnt;
	}
	cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1176
#include<iostream>
#include<cmath>
#include<algorithm>
typedef long long ll;
using namespace std;
bool cmp(int x, int y) {

	return x > y;


}
int main() {
	int n, k;
	cin >> n >> k;
	int a[200005];
	for (int i = 1; i <= n; i++) cin >> a[i];
	sort(a + 1, a + n + 1, cmp);
	ll sum = 0;
	for (int i = k + 1; i <= n; i++) sum += a[i];

	cout << sum;


	return 0;

} 

Measured memory_bytes: 1024
n, k = map(int, input().split())
data = []
for i in range(n):
    data.append( list(map(int, input().split())) )
data.sort( key = lambda x: x[0] )
pos = 0
for val in data:
    pos += val[1]
    if k <= pos:
        print(val[0])
        break

Measured memory_bytes: 29144
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long int
 
#define REP(i, n) for(int i = 0; i < (n); i++)
#define SREP(i, s) for(int i = 0; i < (s.size()); i++)
#define SORT(v, n) sort(v, v+n);
#define GSORT(v, n) sort(v, v+n, greater<int>());
#define VSORT(v) sort(v.begin(),v.end());
#define VGSORT(v) sort(v.begin(),v.end(),greater<int>());
#define REV(a) reverse(begin(a),end(a));

int main(){
	ios::sync_with_stdio(false);cin.tie(0);
////////////////////////////////////////////
	int h,w;
    cin >> h >> w;
    string s[h];
    REP(i,h) cin >> s[i];
    const int dx[8]={-1,0,1,1,1,0,-1,-1};
    const int dy[8]={1,1,1,0,-1,-1,-1,0};
    int t[h][w]={};
    REP(i,h){
        REP(j,w){
            if(s[i][j]=='.') continue;
            else{
                REP(k,8){
                    int nx=dx[k]+i;
                    int ny=dy[k]+j;
                    if(nx<0||nx>=h) continue;
                    if(ny<0||ny>=w) continue;
                    t[nx][ny]++;
                }
            }
        }
    }
    REP(i,h){
        REP(j,w){
            if(s[i][j]=='.'){
                cout << t[i][j];
            }else{
                cout << '#';
            }
        }
        cout << endl;
    }
    
/////////////////////////////////////////////
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999;
	
	public static void Main(string[] args)
	{
		var n = Input().ToInt();
		var a = n[0];
		var b = n[1];
		var c = n[2];
		var d = n[3];
		
		if(Math.Abs(a-b) <= d && Math.Abs(b-c) <= d || Math.Abs(a-c) <= d)
		{
			Console.WriteLine("Yes");
			return;
		}
		Console.WriteLine("No");
	}

	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}


Measured memory_bytes: 11092
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		//入力表示
		int n = sc.nextInt();
		int p[] = new int[n];

		for (int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}
		int ans = 0;

		//ansでカウントした回数を出力
		for (int i = 1; i < n - 1; i++) {
			if ((p[i - 1] < p[i]) && (p[i] < p[i + 1])) {
				ans++;
			} else if ((p[i - 1] > p[i]) && (p[i] > p[i + 1])) {
				ans++;
			}

		}
		System.out.println(ans);

	}

}

Measured memory_bytes: 23636
#include<stdio.h>

int search( int z, int s[], int n )
{
	int c = 0;
	int r = n;
	int l = 0;
	int m;
	while( l < r ){
		m = (l+r)/2;
		if( s[m] == z ){
			c = 1;
			break;
		}else if( z < s[m] ){
			r = m;
		}else{
			l = m+1;
		}
	}
	
	return c;
}

int main(void)
{
	int n, q, i, c, z;
	scanf( "%d", &n );
	int s[n];
	for( i = 0; i < n; i++ ){
		scanf( "%d", &s[i] );
	}
	
	c = 0;
	
	scanf( "%d", &q );
	
	for( i = 0; i < q; i++ ){
		scanf( "%d", &z );
		if( search( z, s, n ) == 1 ){
			c++;
		}
	}
	
	printf( "%d\n", c );
	
	return 0;
}


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

int func(int n){
  int c[n/2] = {0};
  int n_half = n/2;
  for(int i=2;i<n_half;i++){
    if(n%i==0){
      n /= i;
      c[i]+=1;
      i--;
      if(n>1) continue;
      else break;
    }
  }
  int r = 1;
  for(int i=2;i<n_half;i++){
    r *= (c[i]+1);
  }
  return r;
}

int main() {
  int N; cin >> N;
  int count = 0;
  for(int i=7;i<N+1;i+=2){
    if(func(i)==8){
      count += 1;
    } 
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<stack>
#include<queue>
#include<cstdlib>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#define fi first
#define se second
#define pb push_back
#define me(a,b) memset(a,b,sizeof(a))
#define INIT() std::ios::sync_with_stdio(false)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>P;
const int MAX_N=1000+5;
const int INF=0x7fffffff;
const int inf=100000;
const double EPS=1e-6;
const ull base=123;
const ll mod=1e9+7;
const double pi=4*atan(1.0);
int a[MAX_N];
int main()
{
    ll n;
    cin>>n;
    vector<char>c;
    while(n)
    {



            char p='a'+(n-1)%26;
            c.pb(p);
        n--;
        n/=26;

    }
    for(int i=c.size()-1; i>=0; i--)
    {
        cout<<c[i];
    }

}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
inline long long in(){long long x=0;char c=getchar();bool neg=false;while(c!='-'&&('0'>c||c>'9')) c=getchar();if(c=='-') neg=true,c=getchar();while('0'<=c&&c<='9') x=10*x+c-'0',c=getchar();if(neg) x=-x;return x;}
inline void out(long long x){if(x<0) putchar('-'),x=-x;if(x>9) out(x/10);putchar(x%10+'0');}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r){return l+rng()%(r-l+1);}
#define fasty ios_base::sync_with_stdio(false),cin.tie(nullptr);
#define task "O"
#define forinc(a,b,c) for(int a=b,_c=c;a<=_c;++a)
#define fordec(a,b,c) for(int a=b,_c=c;a>=_c;--a)
#define forv(a,b) for(auto&a:b)
#define fi first
#define se second
#define pb push_back
#define ii pair<int,int>
#define mt make_tuple
#define all(a) a.begin(),a.end()
#define reset(f, x) memset(f, x, sizeof(f))
#define bit(x,i) ((x>>(i-1))&1)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1<<(i-1)))
#define _ putchar(' ')
#define __ putchar('\n')
const int M=1e9+7;
int n;
int f[1<<22];
vector<int> ad[30];
main()
{
    //freopen(task".inp","r",stdin);
    //freopen(task".out","w",stdout);
    n=in();
    forinc(i,1,n) forinc(j,1,n) if(in()) ad[i].pb(j);
    f[0]=1;
    forinc(tt,0,(1<<n)-2)
    {
        int i=__builtin_popcount(tt)+1;
        forv(j,ad[i]) if(!bit(tt,j))
            f[on(tt,j)]=(f[on(tt,j)]+f[tt])%M;
    }
    cout<<f[(1<<n)-1];
}


Measured memory_bytes: 10496
import numpy as np
n,d = map(int,input().split())
x = np.array([[float(i) for i in input().split()] for i in range(n)])
count=0
for i in range(n):
    for j in range(i+1,n):
        a=np.linalg.norm(x[i]-x[j])
        if a.is_integer()==True:
            count+=1
            
print(count)        

Measured memory_bytes: 12432
# 最大公約数
def gcd(a, b):
    if a > b:
        return gcd(b, a)
    else:
        if a == 0:
            return b
        else:
            return gcd(b % a, a)


n = int(input())
a = list(map(int, input().split()))  # -> li = [1,2,3,...n]
lg = []
lg.append(0)
rg = []
rg.append(0)
for i in range(n):
    lg.append(gcd(lg[-1], a[i]))
    rg.append(gcd(rg[-1], a[n-i-1]))
# print(lg)
# print(rg)
m = 0
for i in range(n):
    g = gcd(lg[i], rg[n-1-i])
    if g > m:
        m = g
print(m)

Measured memory_bytes: 70756
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n) - 1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
const long long MOD = 998244353, INF = 1e17;
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a=b;return true;}return false;}
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)

template<class T>
class SegmentTree{
	private:
	int N;
	T initVal;
	std::vector<T>ary;
	std::function<T(T&,T&)>merge;
	void init(int n){
		while(N < n)N <<= 1;
		ary.resize(N << 1,initVal);
	}
	public:
		SegmentTree(int n,T initVal,std::function<T(T&,T&)>f):
			N(1),initVal(initVal),merge(f){init(n);}
	// -- a[i] = val;
	inline void update(int i,T val){
		ary[i += N] = val;
		while(i > 1){
			i >>= 1;
			ary[i] = merge(ary[i << 1],ary[(i << 1) + 1]);
		}
	}
	// -- a[i] += val;
	inline void add(int i,T val){
		update(i,ary[i + N] + val);
	}
	// -- [l,r)
	inline T query(int l,int r){
		if(l >= r)return initVal;
		T vr = initVal,vl = initVal;
		for(l += N,r += N;l != r;l >>= 1,r >>= 1){
			if(l & 1)vl = merge(vl,ary[l++]);
			if(r & 1)vr = merge(vr,ary[--r]);
		}
		return merge(vl,vr);
	}
	/*
	void debug show(){
		for(iint i = N;i < N;i++)std::cerr << ary[i] << ' ';
		std:::cerr << '\n';
	}
	*/
};
using ST = SegmentTree<int>;
//SUM : ST(n,0,[](int &a,int &b){return a+b};);
//MIN : ST(n,INF,[](int &a,int &b){return min(a,b);});

signed main(){
	IOS();
	int N;
	cin>>N;
	auto seg = ST(N,0,[](int &a,int &b){return max(a,b);});
	REP(i,N){
		int a;
		cin>>a;
		seg.update(i,a);
	}
	REP(i,N){
		cout<<max(seg.query(0,i),seg.query(i+1,N))<<endl;;
	}
}

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

int main()
{
	int k, s, cnt = 0;
	cin >> k >> s;
	for (int i = 0; i < k+1; i++) {
		for (int j = 0; j < k+1; j++) {
			if (s - i - j >= 0&& s - i - j <= k)cnt++;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pb push_back
int main(){
    int n;
    cin>>n;
    vi vec;
    for(int i=0;i<n;i++){
        int t;
        cin>>t;
        t--;
        vec.pb(t);
    }
    int ans=0;
    for(int i=0;i<n;i++){
        if(vec[i]==i){
            ans++;
            i++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
int solve(int ver , int hor , int prev)
{
    // prev 1 for ver
    // prev 0 for hor

    if(ver)
    {
        if(prev == 1)
        {
            return 2;
        }
        else
        {
            return 1;
        }
    }
    else
    {
        if(prev == 1)
        {
            return 2;
        }
        else
        {
            return 3;
        }
    }

}
int main()
{
    int n , prev , i;

    cin >> n;

    string a , b;

    cin >> a >> b;

    long long ans;

    if(a[0]==b[0])
    {
        ans = 3;
        prev = 1;
        i = 1;
    }
    else
    {
        ans = 6;
        prev = 0;
        i = 2;
    }

    for(i ; i<a.size() ; )
    {
        if(a[i]==b[i])
        {
            ans = (ans * solve(1 , 0 , prev))%mod;
            prev = 1;
            i++;
        }
        else
        {
            ans = (ans * solve(0 , 1 , prev))%mod;
            prev = 0;
            i += 2;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define ll long long
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<bool> c(n, false);
	int ans = 0;
	int pre = -1;
	int now;

	for (int i = 0; i < n; i++) {
		cin >> now;
		if (now - 1 == pre) {
			//printf("%d = true\n", pre);
			c[pre - 1] = true;
		}
		pre = now;
	}
	for (int i = 0; i < n; i++) {
		cin >> now;
		ans += now;
	}
	for (int i = 0; i < n - 1; i++) {
		cin >> now;
		if (c[i])ans += now;
	}

	printf("%d", ans);

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<complex>
#include<vector>
#include<cmath>
#include<cstdio>
using namespace std;
typedef complex<double> P;
typedef vector<P> G;
const double PI=acos(-1);
const double EPS=1e-8;
const double inf=1e8;
#define rep(i,a) for(int i=0;i<a;i++)
double dp[20][20][10010];
int main(){
  rep(i,20)rep(j,20)rep(k,10010)dp[i][j][k]=inf;
  int n;
  double x,y;
  cin>>n>>x>>y;
  y*=PI/180;
  G g(n);
  rep(i,n){
    int a,b;
    cin>>a>>b;
    g[i]=P(a,b);
  }
  double D[20][20]={0};
  double A[20][20]={0};
  rep(i,n)rep(j,n)A[i][j]=arg(g[i]-g[j]);
  rep(i,n)rep(j,n)D[i][j]=abs(g[i]-g[j]);
  dp[0][0][0]=0;
  rep(i,10010)rep(j,n)rep(k,n)if(i==0||j!=k){
    rep(l,n)if(l!=k){
      double dis=D[l][k];//abs(g[k]-g[l]);
      //if(i==0)printf("%.9f %.9f\n",x,dis+dp[j][k][l]);
      if(dis+dp[j][k][i]>x)continue;
      double q=A[k][j]-A[l][k];// arg(g[k]-g[j])-arg(g[l]-g[k]);
      if(q<0)q*=-1;
      while(q>PI)q=2*PI-q;//q-=PI;
      if(i==0){
	q=0;//abs(arg(g[l]-g[k]));
      }
      if(q>y)continue;
      dp[k][l][i+1]=min(dp[k][l][i+1],dp[j][k][i]+dis);
    }
  }
  int out=0;
  rep(i,n)rep(j,n)rep(k,10010)if(abs(dp[i][j][k]-inf)>EPS)out=max(out,k);
  cout<<out<<endl;
}

Measured memory_bytes: 32608
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int N = 2e5 + 5;
int n , mn = 1e9;
int main() {
    abdelrahman010
    cin >> n;
    for(int i = 0;i < n;i++) {
        int x;
        cin >> x;
        int cnt = 0;
        while(x % 2 == 0)
            cnt++ , x /= 2;
        mn = min(cnt , mn);
    }
    cout << mn;
    return 0;
}


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



int main(){

    int n;
    cin>>n;
    int cnt = 1;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        if(x==cnt) cnt++;
    }
    if(cnt==1) cout<<-1<<endl;
    else cout<<n+1-cnt<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define M 1000000007
typedef long long ll;
int main() { 
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n,a[1000000],s=0,h,i;
    cin>>h>>n;
    for(i=0;i<n;i++){
        cin>>a[i];
        s+=a[i];
    }
    if(h<=s){
        cout<<"Yes";
    }
    else
    cout<<"No";
    return 0;
}


Measured memory_bytes: 2816
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int h, w, n;
    cin >> h >> w >> n;
    int r = max(h, w);
    cout << 1+(n-1)/r << endl;
    return 0;
}



Measured memory_bytes: 256
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
if a>=b: print((n-1)*b)
else:
    ans=0
    for i in range(n-1):
        temp=x[i+1]-x[i]
        if a*temp>b: ans+=b
        else: ans+=a*temp
    print(ans)

Measured memory_bytes: 20048
"use strict";

const main = (arg) => {
  const input = arg.trim().split("\n");
  const X = parseInt(input[0].split(" ")[0]);
  const N = parseInt(input[0].split(" ")[1]);
  if (N === 0) return console.log(X);

  const p_arr = input[1].split(" ").map(i => parseInt(i)).sort((a, b) => a - b);

  for (let i = 0; i < 10000; i++) {
    const current_m = X - i;
    if (!p_arr.includes(current_m)) return console.log(current_m);
    const current_p = X + i;
    if (!p_arr.includes(current_p)) return console.log(current_p);
  }

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  


Measured memory_bytes: 29644
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;

typedef long long ll;

#define REP(i,a,n) for(ll i = a ; i < n ; i++)
#define rep(i,n) REP(i,0,n)
#define MAX 1000100

ll before[MAX],now[MAX];
bool ans[MAX],p[MAX];
vector<ll> v;

int main(){
  memset(p,true,sizeof(p));
  p[0] = p[1] = false;
  for(ll i=2;i*i<=MAX;i++){
    if(p[i]){
      for(ll j=i+i;j<MAX;j+=i){
        p[j] = false;
      }
    }
  }
  rep(i,MAX) if(p[i]) v.push_back(i);

  ll A,B;

  while(cin>>A>>B){
    ll a = max(2LL,A - B);
    ll b = A + B;

    for(int i=0;a+i<=b;i++){
      before[i] = MAX;
      ans[i] = true;
    }

    for(ll i=0;v[i]*v[i]<=b;i++){
      for(ll j=max(2LL,((a+v[i]-1)/v[i])*v[i]);j<=b;j+=v[i]){
        if(!ans[j-a]) continue;

        ll val = j;
        now[j-a] = 0;
        while(val % v[i] == 0){
          val /= v[i];
          now[j-a]++;
        }

        if(before[j-a] < now[j-a]){
          ans[j-a] = false;
        }
        else{
          before[j-a] = now[j-a];
        }
      }
    }

    ll fox = 0;
    for(int i=0;i+a<=b;i++) if(ans[i]) fox++;
    cout<<fox<<endl;
  }
}

Measured memory_bytes: 18000
#include<iostream>
using namespace std;
int main(){
  int floor[4][3][10]={{{}}},n,b,f,r,v;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> b >> f >> r >> v;
    floor[b-1][f-1][r-1] += v;
  }
  for(int i=0;i<4;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<10;k++){
    cout << " " << floor[i][j][k];
      }
      cout << endl;
    }
    if(i!=3)
    cout << "####################" << endl;
  }
}


Measured memory_bytes: 3104
package main

import (
	"fmt"
)

func solve(l, r, d int) int {
	answer := 0

	for i := l; i <= r; i++ {
		if i%d == 0 {
			answer++
		}
	}

	return answer
}

func scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}

func main() {
	nums := scanNums(3)
	l := nums[0]
	r := nums[1]
	d := nums[2]

	result := solve(l, r, d)
	fmt.Println(result)
}


Measured memory_bytes: 1772
package main
import (
  "fmt"
  // "math"
)

func main() {
  var (
    X int
    t int
  )
  fmt.Scan(&X)
  fmt.Scan(&t)

  diff := X - t

  if diff > 0 {
    fmt.Println(diff)
  } else {
    fmt.Println(0)
  }

}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
char str[100004];
bool check[100004];
int n,k,r,s,p;
int point;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>k>>r>>s>>p>>str;
	for(int i=0;i<n;i++)
	{
		if(i-k>=0 and check[i-k] and str[i]==str[i-k]) continue;
		else
		{
			if(str[i]=='p') point+=s;
			if(str[i]=='s') point+=r;
			if(str[i]=='r') point+=p;
			check[i]=true; 
		}
	}
	cout<<point<<endl;
	return 0;	
} 

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

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

    int maxa=int(sqrt(n-1));

    int ans=0;

    for(int i=1;i<maxa+1;i++){
        int j=i;
        while(i*j<n){
            j++;
            ans++;
        }
        
    }
    ans=ans*2-maxa;

    cout<<ans<<endl;
    
    
}

Measured memory_bytes: 3680
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
#include <iomanip>
#include <functional>
#define FOR(i, a, n) for (long long i = (a); i < (n); i++)
#define REP(i, n) for(long long i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
using namespace std;
typedef long long ll;

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

	int A[3] = { 0 };
	int temp;

	REP(i, 2)
	{
		cin >> temp;
		A[temp - 1] = 1;
	}

	REP(i, 3)
	{
		if (A[i] == 0)
			cout << i + 1 << endl;
	}

	return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
    int N;cin>>N;
    string S;cin>>S;
    vector<int> R(N,0),W(N,0);
    rep(i,N){
        if(S.at(i)=='R')R.at(i)++;
        else W.at(i)++;
        if(i!=0){
            R.at(i)+=R.at(i-1);
            W.at(i)+=W.at(i-1);
        }
    }
    int res = 0;
    if(R.at(N-1)==0||W.at(N-1)==0){
        cout<<0<<endl;
        return 0;
    }
    rep(i,N){
        if(W.at(i)>R.at(N-1)-R.at(i))continue;
        res = max(res,W.at(i));
    }
    cout<<res<<endl;
}

Measured memory_bytes: 5236
#include <bits/stdc++.h>
 
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
 
using namespace std;

void solve(){

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

	int n,m;

	cin >> n >> m;

	if(n>m){
		for(int i=0;i<n;i++){
			cout << m;
		}
	}	
	else{
		for(int i=0;i<m;i++){
			cout << n;
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
n = int(input())
chd = [[] for i in range(n)]
node = [[-1, -1, 0, 0, 0, 'leaf'] for i in range(n)]
root = -1


def putDepth(nodenum, d):
    node[nodenum][3] = d
    if node[nodenum][2] > 0:
        node[nodenum][5] = 'internal node'
        for i in chd[nodenum]:
            putDepth(i, d + 1)
    if node[nodenum][0] == -1:
        node[nodenum][5] = 'root'


def putHeight(nodenum):
    h1 = 0
    h2 = 0
    if node[nodenum][2] > 0:
        h1 = putHeight(chd[nodenum][0]) + 1
    if node[nodenum][2] == 2:
        h2 = putHeight(chd[nodenum][1]) + 1
    node[nodenum][4] = max(h1, h2)
    return node[nodenum][4]

for i in range(n):
    idx, left, right = map(int, input().split())
    if left >= 0:
        chd[idx].append(left)
        node[left][0] = idx
        node[idx][2] += 1
    if right >= 0:
        chd[idx].append(right)
        node[right][0] = idx
        node[idx][2] += 1
    if node[idx][2] == 2:
        node[left][1] = right
        node[right][1] = left

for i in range(n):
    if node[i][0] == -1:
        root = i
        putDepth(root, 0)
        break

putHeight(root)

for i in range(n):
    print(f'node {i}: parent = {node[i][0]}, sibling = {node[i][1]}, '\
          f'degree = {node[i][2]}, depth = {node[i][3]}, height = '\
          f'{node[i][4]}, {node[i][5]}')



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

int main () {
  int N;
  cin >> N;
  vector <int> num(N);
  for (int i = 0; i < N; i++) cin >> num.at(i);
  vector <int> num2(N);
  for (int i = 0; i < N; i++) num2.at(i) = num.at(i);
  sort (num2.begin(),num2.end());
  int count = 0;
  for (int i = 0; i < N; i++) {
    if (num.at(i) != num2.at(i)) count++;
  }
  if (count == 0) cout << "YES" << endl;
  else if (count == 2) cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

public class Main {

	public static void main(String[] args) 
	{
		Scanner scan = new Scanner(System.in);
		
		while(true)
		{
			String s = scan.nextLine();
			
			if(s.equals(".")) {break;}
			
			int par = 0;
			int brac = 0;
			Stack<Integer> pars = new Stack<Integer>();
			Stack<Integer> bracs = new Stack<Integer>();
			boolean done = false;
			
			for(int i = 0; i < s.length(); i++)
			{
				if(s.substring(i, i+1).equals("("))
				{
					//start
					pars.push(par);
					bracs.push(brac);
					
					par += 1;
				}
				if(s.substring(i, i+1).equals("["))
				{
					//start
					pars.push(par);
					bracs.push(brac);
					
					brac += 1;
				}
				if(s.substring(i, i+1).equals(")"))
				{
					par -= 1;
					
					if(par < 0) 
					{
						System.out.println("no");
						done = true;
						break;
					}
					
					//end
					int shouldbepar = pars.pop();
					int shouldbebrac = bracs.pop();
					if(par != shouldbepar || brac != shouldbebrac)
					{
						System.out.println("no");
						done = true;
						break;
					}
				}
				if(s.substring(i, i+1).equals("]"))
				{
					brac -= 1;
					
					if(brac < 0) 
					{
						System.out.println("no");
						done = true;
						break;
					}
					
					//end
					int shouldbepar = pars.pop();
					int shouldbebrac = bracs.pop();
					if(par != shouldbepar || brac != shouldbebrac)
					{
						System.out.println("no");
						done = true;
						break;
					}
				}
				
			}// ( [  ) ]
			// [ ( ] )
			if(!done)
			{
				if(par == 0 && brac == 0)
				{
					System.out.println("yes");
				}
				else
				{
					System.out.println("no");
				}
			}
			
		}
		
	}

}



Measured memory_bytes: 68080
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("input.txt");ofstream out("output.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const ll G = 2000005;
ll a,k,mod = 1e9+7;
ll fac[G], inv_fac[G];

ll binpow(ll x, ll K){
    x%=mod;
    if(K<2) return K ? x : 1;
    return (binpow(x*x, K/2)*(K&1 ? x : 1))%mod;
}

ll modinv(ll c){
    return binpow(c, mod-2);
}

ll CizNpoK(ll N, ll K){
    ll o = fac[N]*inv_fac[K];
    o %= mod;
    return (o*inv_fac[N-K])%mod;
}

int main() {
    fast;
    fac[0] = 1;
    for(ll q=1; q<G; q++) fac[q] = (fac[q-1]*q)%mod;
    inv_fac[G-1] = modinv(fac[G-1]);
    for(ll q=G-2; q>=0; q--){
        inv_fac[q] = (inv_fac[q+1]*(q+1))%mod;
    }
    cin>>k;
    str t; cin>>t; a = t.size();
    k += a;
    ll all = binpow(26, k), pidori = 0;
    for(ll q=0; q<a; q++){
        pidori += CizNpoK(k, q)*binpow(25, k-q);
        pidori %= mod;
    }
    cout<<(all-pidori+mod)%mod;
}

Measured memory_bytes: 35524
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	l := scanInt()
	s := scanString()
	cnt := 0
	for i := 0; i < l; i++ {
		for j := i + 1; j < l; j++ {
			if s[i] == s[j] {
				continue
			}
			k := strings.Replace("RGB", string(s[i]), "", 1)
			k = strings.Replace(k, string(s[j]), "", 1)
			cnt += strings.Count(s[j+1:], k)
			if (2*j-i) <= (l-1) && k == string(s[2*j-i]) {
				cnt--
			}
		}
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 6400
/*------U Have To DO It------*/
/* BY-> RicoProg */
/*        ___ 
           __|__|
          |  |___       */
#include <bits/stdc++.h>
using namespace std;
 
 
//---------------------------------------------------MACROS----------------------------------------------------------
#define ll long long
#define ld long double
#define beg(i ,n) for(ll i=0;i<n;i++)
#define beg1(i ,n) for(ll i=1;i<n;i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back 
#define mp make_pair
#define nl "\n" 
#define sp " "
#define vec(v , n) vector<ll> v(n)
#define all(x) x.begin() , x.end()
#define pii pair<int , int>
#define pll pair<ll , ll>
#define mii map<int , int>
#define mll map<ll , ll>
#define msi map<string , int>
#define mci map<char , int>
#define f1 first
#define f2 second

//---------------------------------------------------GLOBAL----------------------------------------------------------
const ll MOD2 = 998244353 ;
const ll MOD = 1e9 + 7 ;
const ll MAX = 1e5 + 7 ;
const ll inf = 1e18L + 5 ;
const double pi = 3.14159265358979323846 ;
ll fpow(ll n , ll m ){ll res=1 ;while(m>0){if(m&1){res*=n ;}m/=2 ;n*=n ;}return res;}

//---------------------------------------------------FUNCTIONS-------------------------------------------------------

const ll nax = 1e5 + 5 ;

void solve(){
	ll n;
	cin >> n ;
	ll ar[n] ;
	vector<pll > v ;
	beg(i , n){
		cin >> ar[i] ;
		v.pb(mp(ar[i] , i)) ;
	}
	sort(all(v)) ;
	beg(i , n) cout << v[i].f2+1 << sp ;
}

//---------------------------------------------------DRIVER----------------------------------------------------------
int main()
{
    fast ;
    int t=1 ;
    // cin >> t ;
    while(t--){
        solve() ;
    }
    return 0;
}   

Measured memory_bytes: 3312
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

int main(){
     long int N;
    long int i=0,j=0,k=0;
    cin >> N;
long int sum=0,total3=0,total5=0,total15=0;

sum =(1+N)*N/2;
for(i=3; i<=N; i=i+3) {
       total3 += i;
       j = i/3*5;
       if(j<=N){
       total5 += j;
       }
       k= i/3*15;
       if(k<=N){
           total15 +=k;
       }
   }

cout << sum-total3-total5+total15 <<endl;

}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    int n,B[200001];
    cin>>n;
    rep(i,n-1) cin>>B[i];
    int ans=0;
    ans+=B[0]+B[n-2];
    rep(i,n-2) ans+=min(B[i],B[i+1]);
    cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
long long gcd(long long a, long long b)
{
	if (b == 0)return a;
	return gcd(b, a%b);
}
 
long long lcm(long long a, long long b)
{
	return a * b / gcd(a, b);
}
 
 
int main(int argc, char *argv[])
{
	long long a, b;
	while (cin >> a >> b)
	{
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}
 
	return 0;
}



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

int main(){
  long long n;
  cin >> n;
  long long m = 0;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) m = i;
  }
  int ans = 0;
  m = n / m;
  while (m != 0) {
    m /= 10;
    ans++;
  }
  cout << ans << endl;
  return 0;
}


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

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

		for (int i = 0; i < 3; i++) {
			A[i] = sc.nextInt();
		}

		Arrays.sort(A);

		int tmp = A[2] - A[1];
		tmp = tmp + (A[1] - A[0]);

		System.out.println(tmp < 0? "0": tmp);

	}
}


Measured memory_bytes: 22100
/**
*    created: 23.05.2020 01:37:44
**/
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;
    int y = stoi(s.substr(0,4));
    int m = stoi(s.substr(5,2));
    int d = stoi(s.substr(8,2));
    if (y < 2019) cout << "Heisei" << endl;
    else if (y > 2019) cout << "TBD" << endl;
    else {
        if (m < 4) cout << "Heisei" << endl;
        else if (m > 4) cout << "TBD" << endl;
        else {
            if (d <= 30) cout << "Heisei" << endl;
            else if (d < 30) cout << "TBD" << endl;
        }
    }
    return 0;
}

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

char CFromI(int i) {
  if (i == 0)
    return '0';
  else if (i == 1)
    return '1';
  else if (i == 2)
    return '2';
  else if (i == 3)
    return '3';
  else if (i == 4)
    return '4';
  else if (i == 5)
    return '5';
  else if (i == 6)
    return '6';
  else if (i == 7)
    return '7';
  else if (i == 8)
    return '8';
}

int main() {
  int H, W;
  cin >> H >> W;
  
  string Lines[H];
  for (int i = 0; i < H; i++)
    cin >> Lines[i];
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++){
	  if (Lines[i].at(j) != '#'){
        int count = 0;
        for (int k = -1; k <= 1; k++) {
          if (i + k >= 0 && i + k < H) {
            for (int l = -1; l <= 1; l++) {
              if (j + l >= 0 && j + l < W) {
                if (Lines[i+k].at(j+l) == '#')
                  count++;
              }
            }
          }
        }
        Lines[i].at(j) = CFromI(count);
   	  }
    }
  }
  
  for (int i = 0; i < H; i++)
    cout << Lines[i] << endl;
  
  return 0;
}


Measured memory_bytes: 256
function shcdHash( key )
{
  if( 'S' == key ) {
    return 0;
  } else if( 'H' == key ) {
    return 1;
  } else if( 'C' == key ) {
    return 2;
  } else if( 'D' == key ) {
    return 3;
  } else {
    return 0;
  }
} 
var input = '';
var readable = process.stdin;
readable.resume();
readable.setEncoding( 'utf-8' );
readable.on( 'data', function( chunk ) {
  input += chunk;
});

readable.on( 'end', function() {
  var cards = { S:[] , H:[], C:[], D:[] };
  var shcd = [ 'S', 'H', 'C', 'D' ];
  for( var key in cards ) {
    for( var i=1; i<=13; i++ ) {
      cards[key].push( i );
    }
  }
  var data = input.split( '\n' );
 
  for( var i=1; i<data.length; i++ ) {
    var p = data[i].split( ' ' );
    var k = shcdHash( p[0] );
    var res = cards[ shcd[k] ].indexOf( Number( p[1] ) );
    if( -1 != res ) {
        cards[ shcd[k] ].splice( res, 1 );
    }
  }
  for( var i=0; i<4; i++ ) {
    for( var j = 0; j<cards[ shcd[i] ].length; j++ ) {
      console.log( shcd[i]+" "+cards[ shcd[i] ][j] );
    }
  }
});

Measured memory_bytes: 7640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  string S,T;
  cin>>S>>T;
  
  int sw=0;
  
  for(int i=0;i<S.size();i++){
    if(S.at(i)!=T.at(i)){
      sw=1;
    }
  }
  
  if(sw==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}



  

Measured memory_bytes: 3628
N, K = map(int, input().split())
X = list(map(int, input().split()))
ans = []
for i in range(N-K+1):
	ans.append(min(abs(X[i]) + abs(X[i+K-1] - X[i]), abs(X[i+K-1]) + abs(X[i] - X[i+K-1])))
print(min(ans))

Measured memory_bytes: 14224
using System;
using System.Linq;
using System.Collections.Generic;
class ProgramC
    {
        static void Main(string[] args)
        {
            
            //入力
            int n = int.Parse(Console.ReadLine());
            Dictionary<string, int> map = new Dictionary<string, int>();
            int max = 0;


            for(int i = 0; i < n;i++)
            {
                string input = Console.ReadLine();
                try
                {
                    map.Add(input, 1);
                }
                catch
                {
                    map[input]++;
                }

                if(map[input] > max)
                    max = map[input];
                    
            }

            var keys = map.Where(x => x.Value == max).Select(x => x.Key).ToList();
            keys.Sort(StringComparer.OrdinalIgnoreCase);
            foreach (var s in keys)
            {
                Console.WriteLine(s);
            }
        } 
    } 

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

using namespace std;
using ll = long long;

ll sqint(ll num){

	ll l = 0;
	ll r = 1e10;

	while(r - l > 1){
		ll mid = (r + l) / 2;
		(mid * mid <= num ? l : r) = mid;
	}
	return r;
}



int main()
{
	ll s; cin >> s;
	if(s == 1000000000000000000) {
		cout << 0 << " " << 0 << " " << 1000000000 << " " << 0 << " " << 0 << " " << 1000000000 << endl;
		return 0;
	}

	cout << 0 << " " << 0 << " ";
	ll sq = sqint(s);
	ll a = sq, b = sq;
	if(sq * (sq - 1) >= s) {
		a--;
	}

	ll aaa = a * b - s;
	if(aaa > 1e9) {
		return 1;
	}

	cout << a << " " << 1 << " " << aaa << " " << b << endl;
}

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

int main()
{
  int n; cin>>n;
  int t=0, h=0;
  rep(i,n)
  {
    string u,v; cin>>u>>v;
    if(u>v) t+=3;
    if(v>u) h+=3;
    if(v==u)
    {
      h++; t++;
    }
  }
  cout << t << " " << h  << "\n";
}


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

#define fr(i,n) _back
#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int T = 1e5 + 3;

map<ll,ll> freq;
ll v[T];
ll n,MOD;

int main() {
    ios_base::sync_with_stdio(false);
    cin >> n >> MOD;

    for(int i = 1; i <= n; i++) {
        cin >> v[i];
        v[i] = (v[i] + v[i-1]) % MOD;
        freq[v[i]]++;
    }

    freq[0]++;
    ll ans = 0;

    for(int i = 1; i <= n; i++) {
        freq[v[i-1]]--;
        ans += (ll)freq[v[i-1]];
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
  int N,K,x,Sum;
  cin >> N;
  cin >> K;
  Sum = 0;
  
  rep(i,N){
  cin >> x;
  if (x <= K/2)
    Sum += 2 * x;
  else
    Sum += 2 * (K-x);
  }
  cout << Sum << endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <queue>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAXN = 100005;
struct Edge{
	int to,next,w;
}e[MAXN<<3];
struct E{
	int u,v,c;
	bool operator < (const E &b)const
	{
		return c<b.c;
	}
}t[MAXN<<1];
int head[MAXN<<3],n,m,fa[MAXN],id[MAXN],sz;
bool vis[MAXN<<3];
int getan(int x)
{
	return x==fa[x]?x:fa[x]=getan(fa[x]);
}
int cnt=0;
inline void insert(int u,int v,int w)
{
	e[++cnt].to=v,e[cnt].next=head[u],head[u]=cnt,e[cnt].w=w;
}
inline void work(int l,int r)
{
	for(int i=l;i<=r;++i){
		vis[t[i].u]=vis[t[i].v]=id[t[i].u]=id[t[i].v]=0;
		fa[t[i].u]=t[i].u;
		fa[t[i].v]=t[i].v;
	}
	for(int i=l,x,y;i<=r;++i)
		x=getan(t[i].u),y=getan(t[i].v),fa[x]=y;
	for(int i=l,x,y;i<=r;++i){
		x=getan(t[i].u),y=getan(t[i].v);
		if(!vis[t[i].u]){
			if(!id[x])id[x]=++sz;
			insert(t[i].u,id[x],1);
			insert(id[x],t[i].u,1);
			vis[t[i].u]=1;
		}
		if(!vis[t[i].v]){
			if(!id[y])id[y]=++sz;
			insert(t[i].v,id[y],1);
			insert(id[y],t[i].v,1);
			vis[t[i].v]=1;
		}
	}
}
struct Node{
	int x,v;
	bool operator < (const Node &b)const
	{
		return v>b.v;
	}
};
priority_queue<Node>q;
int d[MAXN<<3];
inline void dij()
{
	memset(vis,0,sizeof(vis));
	memset(d,0x3f,sizeof(d));
	d[1]=0;
	q.push((Node){1,0});
	while(!q.empty()){
		Node x=q.top();
		q.pop();
		int u=x.x;
		if(vis[u])continue;
		vis[u]=true;
		for(int i=head[u];i;i=e[i].next){
			int v=e[i].to;
			if(d[v]>d[u]+e[i].w){
				d[v]=d[u]+e[i].w;
				q.push((Node){v,d[v]});
			}
		}
	}
	cout<<(d[n]==0x3f3f3f3f?-1:d[n])<<endl;
}
int que[MAXN<<3];
inline void bfs()
{
	memset(vis,0,sizeof(vis));
	int front=1,back=0;
	que[++back]=1,vis[1]=1;
	d[1]=0;
	d[n]=0x3f3f3f3f;
	while(front<=back){
		int u=que[front++];
		for(int i=head[u];i;i=e[i].next){
			int v=e[i].to;
			if(!vis[v]){
				d[v]=d[u]+1;
				que[++back]=v;
				vis[v]=1;
			}
		}
	}
	cout<<(d[n]==0x3f3f3f3f?-1:d[n]/2)<<endl;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;++i){
		scanf("%d%d%d",&t[i].u,&t[i].v,&t[i].c);
	}
	sz=n;
	sort(t+1,t+m+1);
	int p=1;
	while(p<=m){
		int r=p;
		while(t[r+1].c==t[r].c)++r;
		work(p,r);
		p=r+1;
	}
//	dij();
	bfs();
	return 0;
}


Measured memory_bytes: 22016
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
 

  string s;
  cin>>s;

  int num=0;
  for(int i=0;i<s.size();i++){
    if(s.at(i)=='+')
      num++;
    else if(s.at(i)=='-')
      num--;
  }

  cout<<num<<endl;

	return 0;
}

Measured memory_bytes: 3608
#include <iostream>

constexpr int MAX_N = 100000;

int n, q;

int seg[MAX_N * 4];

void init(int size) {

	n = 1;

	while (n < size)
		n *= 2;
}

void add(int k, int v) {

	k += n - 1;

	seg[k] += v;

	while (k > 0) {

		k = (k - 1) / 2;

		seg[k] = seg[k * 2 + 1] + seg[k * 2 + 2];
	}
}

int getSum(int a, int b, int k, int l, int r) {

	if (r <= a || b <= l)
		return 0;
	
	if (a <= l&&r <= b)
		return seg[k];

	return getSum(a, b, k * 2 + 1, l, (l + r) / 2) + getSum(a, b, k * 2 + 2, (l + r) / 2, r);
}

int main() {

	std::cin >> n >> q;

	init(n);

	int com, x, y;

	for (int i = 0; i < q; ++i) {

		std::cin >> com >> x >> y;

		if (com == 0)
			add(x - 1, y);
		else
			std::cout << getSum(x - 1, y, 0, 0, n) << std::endl;
	}

	return 0;
}

Measured memory_bytes: 3872
n, m = [int(i) for i in input().split()]

a = []
b = []
for i in range(n):
    a.append(input())
for j in range(m):
    b.append(input())

for i in range(n-m+1):
    for j in range(n-m+1):
        a_dash = [a[i+_][j:j+m] for _ in range(m)]
        if b == a_dash:
            print("Yes")
            exit()
else:
    print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;
const double PI=acos(-1);


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

    int n,k;
    cin >> n >> k;
    double ans=0;
    vector<ll> p(25);
    p[0]=1;
    rep(i,24) p[i+1]=p[i]*2;
    rep(i,n) {
        int j=i+1;
        int cnt=0;
        while (j<k) {
            j*=2;
            ++cnt;
        }
        ans+=1.0/(n*p[cnt]);
    } 
    
    cout << fixed << setprecision(15) << ans << endl;
   
    return 0;   
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, N, rim;

  cin >> N >> A;

  rim = N % 500;

  if(A >= rim){
    cout << "Yes" << endl;
  }  
  else if(A < rim){
    cout << "No" << endl;
  }

}


Measured memory_bytes: 256