akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;
int h, w, cnt;
char map[105][105];
int mark[105][105];
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
void DFS(int x, int y, char target)
{
    mark[x][y] = cnt;

    for(int i = 0; i < 4; i++)
    {
        int tx = x + dx[i];
        int ty = y + dy[i];

        if(tx >= 0 && tx < h && ty >= 0 && ty < w && !mark[tx][ty] && map[tx][ty] == target)
            DFS(tx, ty, target);
    }

    return;
}
int main(void)
{
    while(scanf("%d%d", &h, &w) != EOF)
    {
        if(h == 0 && w == 0)
            break;

        for(int i = 0; i < h; i++)
            scanf("%s", map[i]);

        cnt = 0;
        memset(mark, 0, sizeof(mark));

        for(int i = 0; i < h; i++)
            for(int j = 0; j < w; j++)
        {
            if(!mark[i][j])
            {
                cnt++;
                DFS(i, j, map[i][j]);
            }
        }

        printf("%d\n", cnt);
    }

	return 0;
}



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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> A(H,vector<char>(W));
  for(int i=0; i<H; i++) {
    for(int j=0; j<W; j++) {
      cin >> A.at(i).at(j);
//      cout << A.at(i).at(j);
//      if(j==W-1) cout << endl;
    }
  }
  
  vector<int> GYOU(H);
  
  for(int i=0; i<H; i++) {
    for(int j=0; j<W; j++) {
      if(A.at(i).at(j)=='#') {
        GYOU.at(i)++;
      }
      if(j==W-1 && GYOU.at(i)==0) {
        for(int j=0; j<W; j++) {
          A.at(i).at(j)=' ';
        }
      }
    }
  }

  vector<int> RETSU(W);
  
  for(int j=0; j<W; j++) {
    for(int i=0; i<H; i++) {
      if(A.at(i).at(j)=='#') {
        RETSU.at(j)++;
      }
      if(i==H-1 && RETSU.at(j)==0) {
        for(int i=0; i<H; i++) {
          A.at(i).at(j)=' ';
        }
      }
    }
  }

  for(int i=0; i<H; i++) {
    for(int j=0; j<W; j++) {
      if(A.at(i).at(j)!=' ') {
        cout << A.at(i).at(j);
      }
      if(j==W-1 && GYOU.at(i)!=0) cout << endl;
    }
  }
  
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
int N;
string S[111111];


int en(string s){
    int ret=0;
    rep(i,s.size())ret=ret*26+s[i]-'a';

    int t=26;
    for(int i=1;i<s.size();i++){
        ret+=t;
        t*=26;
    }
    return ret;
}

const int MAX=26*26*26*26;
bool ex[MAX*4];

string smin(string &a,string &b){
    if(a.size()<b.size())return a;
    if(a.size()>b.size())return b;
    return min(a,b);
}

signed main(){
    cin>>N;
    rep(i,N)cin>>S[i];

    rep(i,N){
        rep(j,S[i].size()){
            for(int len=1;len<=4&&j+len<=S[i].size();len++){
                int tmp=en(S[i].substr(j,len));
                ex[tmp]=1;
            }
        }
    }

    string ans="zzzzzzz";
    for(char a='a';a<='z';a++){
        string s=string(1,a);
        if(!ex[en(s)])ans=smin(ans,s);
        for(char b='a';b<='z';b++){
            string t=s+string(1,b);
            if(!ex[en(t)])ans=smin(ans,t);
            for(char c='a';c<='z';c++){
                string u=t+string(1,c);
                if(!ex[en(u)])ans=smin(ans,u);
                for(char d='a';d<='z';d++){
                    string v=u+string(1,d);
                    if(!ex[en(v)])ans=smin(ans,v);
                }
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 8688
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;
 
// debugger
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << ", ";
    return os << "}";
}
 
template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
    return os << "[ " << p.first << ", " << p.second << " ]" ;
}

#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
// 
 
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 
 
#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define len length
#define ret0 return 0
#define ret return 
 
 
#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)
#define sz(a) (ll)(a).size()
 
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>
 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
 
#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)1e7+5
#define N (1ll<<10)
#define pi 3.141592653589793238462643

void solve(){
    ll k;
    cin >> k;
    ll x = 0;
    for(ll i = 0; i < MAXN; i++){
        x = ((x * 10) % k + 7) % k;
        if(x == 0){
            print(i + 1);
            ret;
        }
    }
    print(-1);
}
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
        start_routine();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
 
    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
        
    #ifndef ONLINE_JUDGE
        end_routine();
    #endif
}


Measured memory_bytes: 3648
#include <iostream>
#include <cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
typedef pair<double,double>P_D;
#define rep(i, n) for (int i = 0; i < n; i++)
#define reprev(i, n) for (int i = n - 1; i >= 0; i--)
#define MAX 100100
#define MAX_N 200100
#define SENTINEL 2000000000
const int MOD = 1e9+7;
#define NIL -1
const int INF = 1 << 29;
#define ALL(a)  (a).begin(),(a).end()

string s,t;
int main(){
    cin>>s>>t;
    int n=s.length();
    map<char,char>m1,m2;
    rep(i,n){
        char a=s[i],b=t[i];
        if((m1.count(a) && m1[a]!=b) ||(m2.count(b) && m2[b]!=a)){
            cout<<"No"<<endl;
            return 0;
        }
        m1[a]=b;m2[b]=a;
        
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 776
A_s,B_s,C_s,D_s=input().split()
A=int(A_s)
B=int(B_s)
C=int(C_s)
D=int(D_s)

ansA=int(C/B)
ansC=int(A/D)

if C%B!=0:
    ansA=ansA+1
if A%D!=0:
    ansC=ansC+1
    
if ansA<=ansC:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9164
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
ll x,n;
cin>>x>>n;
map<ll, ll> mp;
for (ll i = 0; i < n; i++) {
    ll t;
    cin>>t;
    mp[t]++;
}
ll diff = INF;
ll ans = 0;
for (ll i = -200; i <= 200; i++) {
    if (mp[i]) continue;
    if (chmin(diff, abs(x - i))) ans = i;
}
cout << ans << endl;
}

Measured memory_bytes: 3656
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#define mid ((l + r) >> 1)
#define lson (x << 1)
#define rson ((x << 1) | 1)
using namespace std;
typedef long long LL;
const LL INF = 0x3f3f3f3f3f3f3f3f;

struct node{
	LL l,r,v;
}s[200005];
bool cmp(node x,node y){ return x.r < y.r; }

LL tag[800005] = {0};
LL val[800005] = {0};

void pushdown(LL x,LL l,LL r){
	if(!tag[x]) return;
	tag[lson] += tag[x]; val[lson] += tag[x];
	tag[rson] += tag[x]; val[rson] += tag[x];
	tag[x] = 0;
}

void pushup(LL x){
	val[x] = max(val[lson],val[rson]);
}

void modify(LL x,LL l,LL r,LL L,LL R,LL v){
	if(L <= l && r <= R){
		tag[x] += v;
		val[x] += v;
		return;
	}
	pushdown(x,l,r);
	if(L <= mid) modify(lson,l,mid,L,R,v);
	if(R > mid) modify(rson,mid + 1,r,L,R,v);
	pushup(x);
}

LL query(LL x,LL l,LL r,LL L,LL R){
	if(L <= l && r <= R) return val[x];
	pushdown(x,l,r);
	LL ret = -INF;
	if(L <= mid) ret = max(ret,query(lson,l,mid,L,R));
	if(R > mid) ret = max(ret,query(rson,mid + 1,r,L,R));
	pushup(x); return ret;	
}

int main(){
	LL n,m;
	scanf("%lld %lld",&n,&m);
	for(LL i = 1;i <= m;i ++) scanf("%lld %lld %lld",&s[i].l,&s[i].r,&s[i].v);
	sort(s + 1,s + 1 + m,cmp); s[m + 1].r = -1;
	LL sr = 1;
	for(LL i = 1;i <= n;i ++){
		modify(1,1,n,i,i,query(1,1,n,1,i));
		while(s[sr].r == i){
			modify(1,1,n,s[sr].l,s[sr].r,s[sr].v);
			sr ++;
		}
	}
	printf("%lld\n",max(0LL,query(1,1,n,1,n)));
	return 0;
}

Measured memory_bytes: 17408
N, M = map(int, input().split())
X = list(map(int, input().split()))

X.sort()

result = 0
temp = []
if M <= N:
    print(0)
else:
    for i in range(M-1):
        temp.append(-(X[i] - X[i+1]))
    temp.sort()
    for i in range(M-N):
        result += temp[i]
    print(result)


Measured memory_bytes: 13960
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)

multiple_4 = 0
multiple_2 = 0
multiple_other = 0

a.each do |item|
    if item % 4 == 0 then
        multiple_4 += 1
    elsif item % 2 == 0 then
        multiple_2 += 1
    else
        multiple_other += 1
    end
end

if multiple_4 == 0 then
    puts multiple_2 >= 2 && multiple_other == 0 ? "Yes" : "No"
else
    multiple_other += 1 if multiple_2 > 0
    puts multiple_4+1 >= multiple_other ? "Yes" : "No"
end

Measured memory_bytes: 21672
from math import sqrt


def is_prime(x):
    if x < 2:
        return False
    for i in range(2, int(sqrt(x)) + 1):
        if x % i == 0:
            return False

    return True


def f(x):
    st = set()
    for i in range(1, int(sqrt(x)) + 1):
        if x % i == 0:
            st.add(i)
            st.add(x // i)

    return st


a, b = map(int, input().split())

a_set = f(a)
b_set = f(b)

ans = 0
for e in a_set:
    if is_prime(e) or e == 1:
        if e in b_set:
            ans += 1

print(ans)


Measured memory_bytes: 4624
#include<bits/stdc++.h>
    #define ll long long
    #define db double
    #define lowbit(p) (p&(-p))
    #define pb push_back
    #define mp make_pair
    #define pii pair<int,int>
    #define A first
    #define B second
    using namespace std;
    void read(int &x){
    	x=0; char c=getchar(); int p=1;
    	for (;c<48;c=getchar())if (c=='-')p=-1;
    	for (;c>47;c=getchar())x=(x<<1)+(x<<3)+(c^48);
    	x*=p;
    }
    void read(ll &x){
    	x=0; char c=getchar(); int p=1;
    	for (;c<48;c=getchar())if (c=='-')p=-1;
    	for (;c>47;c=getchar())x=(x<<1)+(x<<3)+(c^48);
    	x*=p;
    }
    void Min(int &x,int y){
    	if (x>y)x=y;
    }
    void Max(int &x,int y){
    	if (x<y)x=y;
    }
    void Min(ll &x,ll y){
    	if (x>y)x=y;
    }
    void Max(ll &x,ll y){
    	if (x<y)x=y;
    }
     
    #define M 100005
    struct ed{
    	int x,nx;
    }e[M<<1];
    int fa[M],nx[M],ecnt=1,n,mx,id,val[M],Q[M],tot;
    bool mark[M];
    void add(int x,int y){
    	e[ecnt]=(ed){y,nx[x]};
    	nx[x]=ecnt++;
    }
    void dfs(int f,int x,int d){	
    	fa[x]=f;
    //	printf("%d->%d\n",f,x);
    	if (d>mx){
    		mx=d;
    		id=x;
    	}
    	for (int i=nx[x];i;i=e[i].nx)if (e[i].x!=f){
    		dfs(x,e[i].x,d+1);
    	}
    }
    int qu(int x){
    	int res=0,i,j,y;
    	for (i=nx[x];i;i=e[i].nx)if (!mark[e[i].x]){
    		y=e[i].x;
    		for (j=nx[y];j;j=e[j].nx)if (e[j].x!=x){
    			return -1;
    		}	
    		res++;
    	}
    	return res;
    }
    void chk(){
    	mx=0;
    	int tmp,i,j,x;
    	dfs(0,1,0);
    //	printf("id=%d\n",id);
    	mx=0;
    	dfs(0,id,0);
    //	printf("id=%d\n",id);
    	for (x=id;x;x=fa[x]){
    //		printf("%d ",x);
    		Q[++tot]=x;
    		mark[x]=1;
    //		printf("fa[%d]=%d\n",x,fa[x]);
    	}
    //	printf("\n");
    	for (i=1;i<=tot;i++){
    		tmp=qu(Q[i]);
    		if (tmp==-1){
    			printf("-1\n");
    			exit(0);
    		}
    		else {
    			val[i]=tmp;
    		}
    	}
    	for (i=1;i<=tot;i++){
    		if (val[i]!=val[tot-i+1]){
    			if (val[i]<val[tot-i+1]){
    				return ;
    			}
    			else{
    				for (j=1;j<=tot-j+1;j++){
    					swap(Q[j],Q[tot-j+1]);
    					swap(val[j],val[tot-j+1]);
    				}
    				return ;
    			}
    		}
    	}
    }
    void pt(){
    	int now=0,i,l,r;
    	for (i=1;i<=tot;i++){
    		l=now+2; r=now+val[i]+1;
    		for (int x=l;x<=r;x++){
    			printf("%d ",x);
    		}
    		printf("%d ",now+1);
    		now=r;
    	}
    	printf("\n");
    }
    int main(){
    //	freopen(".in","r",stdin);
    //	freopen(".out","w",stdout);
    //	freopen("1.in","r",stdin);
    	read(n);
    	int i,x,y;
    	for (i=1;i<n;i++){
    		read(x); read(y);
    		add(x,y);
    		add(y,x);	
    	}
    	chk();
    	pt();
    	return 0;
    }

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

int main(void){
  int c1,c2,c3;
  while(cin>>c1>>c2>>c3){
    int d=20-c1-c2,a=0;
    for(int i=1;i<=10;++i)if(d>=i)++a;
    if(a<4) cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1152
n,p = map(int,input().split())

def calc(x):
    c = []
    b, e = 2, 0
    while b * b <= x:
        while x % b == 0:
            x = x // b
            e = e + 1
        if e > 0:
            c.append((b, e))
        b, e = b + 1, 0
    if x > 1:
        c.append((x, 1))
    return c   
    
if p == 1:
    print(1)
else:
    a = calc(p)
    ans = 1
    for i in range(len(a)):
        if a[i][1] >= n:
            ans *= a[i][0] ** (a[i][1] // n)
    print(ans)
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pb push_back
#define SZ(x) ((int)(x.size()))
#define FOR(i,s,n) for (ll i = (s); (i) < (n); ++i)
#define FORD(i,s,l) for (ll i = (s); (i) >= l; --i)
#define F first
#define S second
#define TC int __tc; cin >> __tc; FOR(case_num,1,__tc+1)
#define TEST(x,i) ((x)&(1ll<<(i)))
#define SET(x,i) ((x)|(1ll<<(i)))
#define FLIP(x,i) ((x)^(1ll<<(i)))
#define CLEAR(x,i) ((x)&~(1ll<<(i)))

const double pi = 4 * atan(1);
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;
const int MAXN = 200005;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	ll a,b,c;
	cin >> a >> b >> c;
	
	ll k;
	cin >> k;
	
	while (k && a >= b){
		b*=2;
		k--;
	}
	
	while(k && b >= c) {
		c*=2;
		k--;
	}
	
	cout << ((a < b && b < c) ? "Yes" : "No") << "\n";

}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solveA();
		// new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		String line = "";

		try {
			scanner = new Scanner(System.in);
			line = scanner.nextLine();

			char[] wkArray = line.toCharArray();
			StringBuffer buf = new StringBuffer();
			for (int i = 0; i < wkArray.length; i++) {
				if (wkArray[i] == '1') {
					buf.append(9);
				} else if (wkArray[i] == '9') {
					buf.append(1);
				} else {
					buf.append(wkArray[i]);
				}

			}

			System.out.println(buf.toString());

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 22868
//IncubatorMan
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
char gap = 32;
template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << gap << x;
        return os << '}'; 
}
template<typename A, typename B> 
ostream& operator<<(ostream &os, const pair<A, B> &p) {
        return os << '(' << p.first << gap << p.second << ')';
}

template <class T>
void read(T &x) {
    char c;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        ;
    for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);
}
#define ll long long 
#define lll __int128_t
#define pb push_back
#define mp make_pair
typedef pair < int,int> ii;
typedef vector<ii> vii;
typedef vector<ll>vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve(){
    ll k;
    read(k);
    ll ans=0;
    for(ll i=1;i<=k;i++){
        for(ll j=1;j<=k;j++){
            ll x = __gcd(i,j);
            for(ll l=1;l<=k;l++){
                ans += __gcd(l,x);
            }
        }
    }
    cout<<ans<<endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
        int test=1;
        //read(test);
        while(test--){
            solve();
        }
    return 0;
}

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

#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);

typedef long long int lli;

int main()
{
	fio;
	int n,k;
	cin>>n>>k;
	vector<int> h(n);
	for(int i=0;i<n;i++) cin>>h[i];
	vector<int> dp(n,2e9+1);
	dp[0] = 0;
	for(int i=1;i<n;i++)
	{
		for(int j=max(0,i-k);j<i;j++)
		{
			dp[i] = min(dp[j] + abs(h[j]-h[i]),dp[i]);
		}
	}
	cout<<dp[n-1]<<endl;
	cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){

  int n,m;
  while(cin >> n >> m && n+m){
    vector<int> V;
    for(int i = 0; i < n+m; i++){
      int in;
      cin >> in;
      V.push_back(in);
    }
    sort(V.begin(),V.end());
    int time = V[0];
    for(int i = 0; i < V.size()-1; i++) time = max(time,V[i+1]-V[i]);
    cout << time << endl;
  }
  return 0;
}

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

#define REP(i, s,  n) for(int i = s;i < (n);i++)
#define VSORT(v) sort(v.begin(), v.end());
#define int64 long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> PP;

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

int N;
int64 a[100000];

// 最大公約数の取得
int64 gcd(int64 a, int64 b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

// 最小公倍数の取得
int64 lcm(int64 a, int64 b) {
	return a * b / gcd(a, b);
}

signed main(){
	cin >> N;
	int64 x = 0;
	int64 ans = 0;
	REP(i, 0, N) {
//		scanf("%d", &a[i]);
//		if(i == 0) {
//			x = a[i];
////		    cout << "x = " << x << " a[" << i << "] = " << a[i] << endl;
//		} else {
//			x = lcm(x, a[i]);
////		    cout << "x = " << x << " a[" << i << "] = " << a[i] << endl;
//		}
		scanf("%d", &x);
		ans += (x - 1);
	}

//	if(x > 0) {
//		x--;
//		REP(i, 0, N) {
//			ans += x % a[i];
//		    cout << "ans = " << ans << " = " << x << " % " << a[i] << endl;
//		}
//	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
p = []
ans = 0
x = sum(A)
k = 0
for i in range(n):
    if A[i] < B[i]:
        ans += 1
        k += A[i] - B[i]
    elif A[i] > B[i]:
        p.append(A[i] - B[i])
        
p.sort(reverse=True)
for i in p:
    if k >= 0:
        break
    k += i
    ans += 1

if k >= 0:
    print(ans)
else:
    print(-1)

Measured memory_bytes: 18708
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

int main()
{
    IOS();
    ll a,b,c;
    cin>>a>>b>>c;
    cout<<max({a + 10 * b + c,10 * a + b + c,a + b + 10*c})<<endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;

class Program {
    static void Main() {
        while(true) {
            int[] arr = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            if((arr[0] | arr[1])== 0) break;
            Array.Sort(arr);
            Console.WriteLine(string.Join(" ", arr));
        }
    }
}


Measured memory_bytes: 16348
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6+10;
typedef long long ll;
//注意有些int类型要改成long long类型 
vector<int> ve[N]; //vector最好定义在外面，不然可能爆栈
int main(){
//	freopen("input.txt","r",stdin); 
	int n,m;
	cin>>n>>m;
	int a,b;
	priority_queue<int> q;
	ll earn=0;
	for(int i=0;i<n;i++)
	{
		scanf("%d%d",&a,&b);
		if(a>m) continue; //要有这个条件，不然下面的vector可能会成负值
		ve[m-a+1].push_back(b); //表示只能在m-a+1天或者之前做，不然在假期内完不成这项任务
	}
	for(int i=m;i>=1;i--)
	{
		for(int v:ve[i]) q.push(v);
		if(!q.empty())
		{
			earn+=q.top();
			q.pop();			
		}
	}
	cout<<earn<<endl;
	return 0;
}

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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define debug(v) {for (auto x : v) cerr << x << ' '; cerr << endl;}

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

const ll INF = 1e15L;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int a, b, q;
	scanf("%d%d%d", &a, &b, &q);
	vll s(a+2), t(b+2);
	for (int i = 0; i < a; i++) scanf("%lld", &s[i]);
	for (int i = 0; i < b; i++) scanf("%lld", &t[i]);
	s[a] = t[b] = -INF;
	s[a+1] = t[b+1] = INF;
	sort(all(s));
	sort(all(t));

	while (q-- > 0) {
		ll x;
		scanf("%lld", &x);
		auto its = lower_bound(all(s), x);
		auto its2 = prev(its);
		auto itt = lower_bound(all(t), x);
		auto itt2 = prev(itt);
		ll answer = x - min(*its2, *itt2);
		answer = min(answer, max(*its, *itt) - x);
		answer = min(answer, 2 * (*its - x) + (x - *itt2));
		answer = min(answer, (*its - x) + 2 * (x - *itt2));
		answer = min(answer, 2 * (*itt - x) + (x - *its2));
		answer = min(answer, (*itt - x) + 2 * (x - *its2));
		printf("%lld\n", answer);
	}
}


Measured memory_bytes: 2944
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int kaijou(int num){
    if(num == 1){
        return 1;
    }else{
        return num * kaijou(num - 1);
    }
}

int main(){
    int N;
    cin >> N;
    int x[N], y[N];
    rep(i, N) cin >> x[i] >> y[i];
    vector<int> a(N);
    for(int i = 0; i < N; i++) a[i] = i + 1;
    double all_sum = 0;
    do{
        double sum = 0;
        rep(i, N-1){
            double x_len = (double)pow(x[a[i]-1] - x[a[i+1]-1], 2);
            double y_len = (double)pow(y[a[i]-1] - y[a[i+1]-1], 2);
            double length = sqrt(x_len + y_len);
            sum += length;
        }
        all_sum += sum;
    }while(next_permutation(a.begin(), a.end()));
    double ans = all_sum / kaijou(N);
    printf("%.7f\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

int main() {
  using namespace std::string_literals;
  std::string S;
  std::cin >> S;

  if (S.at(1) == 'B') {
    std::cout << "ARC" << std::endl;
  } else {
    std::cout << "ABC" << std::endl;
  }

  return 0;
}

Measured memory_bytes: 3544
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

int main() {
   long long a,b;
   cin>>a>>b;
   int count=1;
   bool flag=true;
   while(flag){
      a=a*2;
      if(a>b){
         flag=false;
      }
      else{
         count++;
      }
   }
   cout<<count<<endl;
}



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

int main(){
  int N;
  vector<int64_t> H(100010);

  cin >> N;
  for (int i=0; i<N; i++) cin >> H[i];

  int cur = 0, ans = 0;
  for (int i=0; i<N-1; i++){
    if(H[i+1] <= H[i]){
      cur++;
      ans = max(ans, cur);
    } else {
      cur = 0;
    }
  }

  cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

vector <ll> V[101010];
ll A[101010];
ll n;

void die() { cout << "NO" << endl; exit(0); }

ll dfs(ll p, ll r)
{
	if(V[p].size() == 1){
		return A[p];
	}
	
	vector <ll> X;
	ll s = 0;
	
	for(ll &t: V[p]){
		if(t != r){
			ll x = dfs(t, p);
			s += x;
			X.push_back(x);
		}
	}
	
	if(s < A[p] || A[p] * 2 < s) die();
	if(*max_element(X.begin(), X.end()) > A[p]) die();
	
	return A[p] * 2 - s;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll i, u, v;
	
	cin >> n;
	
	for(i=1; i<=n; i++){
		cin >> A[i];
	}
	
	for(i=1; i<n; i++){
		cin >> u >> v;
		V[u].push_back(v);
		V[v].push_back(u);
	}
	
	if(n == 2){
		cout << (A[1] == A[2]? "YES" : "NO") << endl;
		return 0;
	}
	
	for(i=1; i<=n; i++){
		if(V[i].size() > 1) break;
	}
	
	cout << (dfs(i, 0) == 0? "YES" : "NO") << endl;
	
	return 0;
}

Measured memory_bytes: 14592
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n,m;
	vector<string>grid;
	vector<vector<int> >dp;
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>m;
	grid.resize(n);
	dp.resize(n,vector<int>(m,0x3f3f3f3f));
	for(int i=0;i<n;i++) cin>>grid[i];
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
			if(i==0&&j==0) dp[i][j]=grid[0][0]=='#';
			else {
				if(i>0) dp[i][j]=min(dp[i][j],dp[i-1][j]+(grid[i-1][j]=='.'&&grid[i][j]=='#'));
				if(j>0) dp[i][j]=min(dp[i][j],dp[i][j-1]+(grid[i][j-1]=='.'&&grid[i][j]=='#'));
			}
	cout<<dp[n-1][m-1]<<"\n";
	return 0;
}

Measured memory_bytes: 384
//# define FLAG
///delet....................................
# include   <bits/stdc++.h>
using namespace std;
# define    pb                      push_back
# define    mp                      make_pair
# define    IOS                     ios::sync_with_stdio(false)
# define    mem(a,b)                memset(a,b,sizeof(a))
# define    FO(i,n,a)               for(int i=n; i>=a; --i)
# define    FOR(i,a,n)              for(int i=a; i<=n; ++i)
# define    pi                      acos(-1.0)
# define    MAX(a,b)                (a)>(b)?(a):(b)
# define    MIN(a,b)                (a)<(b)?(a):(b)
# define    LINF                    0xfcfcfcfcfcfcfcf
# define    INF                     0x3f3f3f3f
# define    MOD                     1000000007
# define    eps                     0.00000001
# define    hr                      putchar('\n')
# define    bug                     puts("H");
# pragma    comment(linker,"/STACK:1024000000,1024000000")
typedef     vector<int>             VI;
typedef     long long               LL;
typedef     unsigned long long      ULL;
inline char gtc() {
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
# define    Template                LL
inline Template read() {
    int flag=1;
    char ch=gtc();
    if(ch==EOF)return EOF;
    Template sum=0;
    while(!((ch>='0'&&ch<='9')||ch=='-'))ch=gtc();
    if(ch=='-')flag=-1,ch=gtc();
    while(ch>='0'&&ch<='9')sum=sum*10+ch-'0',ch=gtc();
    return sum*flag;
}
inline void out(Template x) {
    if(x<0)putchar('-'),x=-x;
    if(x>9)out(x/10);
    putchar(x%10+'0');
}
///coding...................................

int main() {
    IOS;
#ifdef FLAG
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif
    int a,b;
    cin>>a>>b;
    cout<<a*a-b<<endl;
    return 0;
}










///delete FLAG..............................




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

int main(){
    ll a, b;
    cin >> a >> b;
    cout << a / __gcd(a, b) * b << endl;
    return 0;
}

Measured memory_bytes: 256
main::IO()
main = do
  n <- getLine
  ds <- map read . words <$> getLine
  putStrLn $ show $ sumTakoyaki ds

sumTakoyaki :: [Int] -> Int
sumTakoyaki [] = 0
sumTakoyaki (d:ds) = s + (sumTakoyaki ds)
                      where s = foldl (flip $ (+) . (d*)) 0 ds


Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#include <iomanip>
using namespace std;
#define mod (long)(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
#define long long long
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<long> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } long C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };

int main(){
    int N, H, W;
    cin >> N >> H >> W;
    int ans = 0;
    for(int i = 0; i < N; i++){
        int A, B;
        cin >> A >> B;
        ans += (A >= H && B >= W);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,k;
    long h[200005];
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>h[i];
    sort(h,h+n);
    long long sum=0;
    for(int i=0;i<n-k;i++)
        sum+=h[i];
    cout<<sum;
    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

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

		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		System.out.println((s.lastIndexOf("Z") - s.indexOf("A")) + 1);
	}

}

Measured memory_bytes: 27092
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
using namespace std;

int main() {
	int N, M, R;
	cin>>N>>M>>R;
	int r[R];
	for(int i=0;i<R;++i){
		cin>>r[i];
		r[i]--;
	}
	long cost[N][N];
	for(int i=0;i<N;++i){
		for(int j=0;j<N;++j){
			if(i==j)cost[i][j] = 0;
			else cost[i][j] = 1e9+7;
		}
	}

	long A, B, C;
	for(int i=0;i<M;++i){
		cin>>A>>B>>C;
		A--;
		B--;
		if(cost[A][B] > C){
			cost[A][B] = C;
			cost[B][A] = C;
		}
	}

	long DP[N][N];
	for(int i=0;i<N;++i){
		for(int j=0;j<N;++j){
			DP[i][j] = cost[i][j];
		}
	}

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

	/**
	for(int i=0;i<N;++i){
		for(int j=0;j<N;++j){
			cout<<DP[i][j]<<" ";
		}
		cout<<endl;
	}
	cout<<endl;
	**/

	stack<pair<int, long> > statestack;
	stack<map<int, int> > mapstack;
	for(int i=0;i<R;++i){
		statestack.push(make_pair(r[i], 0));
		map<int, int> map1;
		map1[r[i]]++;
		mapstack.push(map1);
	}
	long ans = 1e9+7;
	pair<int, long> state;
	map<int, int> statemap;
	while(!statestack.empty()){
		state = statestack.top();
		statemap = mapstack.top();
		statestack.pop();
		mapstack.pop();
		int owari = 1;
		for(int i=0;i<R;++i){
			if(statemap[r[i]]==0)owari = 0;
		}
		if(owari==1){
			if(state.second < ans)ans = state.second;
			continue;
		}
		for(int i=0;i<R;++i){
			if(state.first==r[i])continue;
			if(statemap[r[i]]==0){
				statemap[r[i]] = 1;
				statestack.push(make_pair(r[i], state.second + DP[state.first][r[i]]));
				mapstack.push(statemap);
				statemap[r[i]] = 0;
			}
		}
	}
	cout<<ans<<endl;
}


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

int main()
{
  ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
  ll n, t;
  cin >> n >> t;
  
  vector<ll> a(n, 0);
  for(ll i = 0; i < n; i++)
    cin >> a[i];
  
  ll ans = t;
  for(ll i = n-1; i >= 1; i--)
  {
    if( a[i]-a[i-1] >= t)
      ans += t;
    else
      ans += (a[i]-a[i-1]);
  }
  
  cout << ans << endl;
  return 0;
}
  

Measured memory_bytes: 1792
import java.util.Scanner;

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

		String s = sc.next();
		String t = sc.next();

		if (s.equals(t.substring(0,s.length()))) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	}
}


Measured memory_bytes: 26772
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

int main(void){
    
    int a,b,c;
    cin >> a >> b >> c;
    cout << min( a+b, min(a+c,b+c) );
    
    
    
    return 0;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

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

    int a = 0;

    for(int i=0;i<m;i++){
        int x;
        cin >> x;
        a += x;
    }

    int ans = n - a;
    if(ans < 0){
        cout << "-1" << endl;
    } else {
        cout << ans << endl;
    }

    return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
//const ll INF = 1e18;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);

int main()
{
    string s;
    cin >> s;
    int flag[30]; fill(flag,flag+30,0);
    for(int i = 0; i < s.size(); i++) flag[s[i]-'a']++;
    if(s.size() != 26){
        for(int i = 0; i < 26; i++){
            if(!flag[i]){
                cout << s << char('a'+i) << endl; 
                return 0;
            }
        }
    }else{
        for(int i = s.size()-1; i >= 0; i--){
            for(int j = s[i]-'a'+1; j < 26; j++){
                if(flag[j] == 0){
					cout << s.substr(0,i) << char(j+'a') << endl;
					return 0;
				}
            }
            flag[s[i]-'a']--;
        }
    }
    cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>

using namespace std;

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

int main(){
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  int k,s;
  cin>>k>>s;
  int ans=0;
  rep(l,0,k+1){
    rep(m,0,k+1){
      int n=s-l-m;
      if(0<=n && n<=k && l+m+n==s) ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = 1000'000'007;

int ans;
signed main(){
    int n;
    cin>>n;
    rep(i,n){
        int a;
        cin>>a;int temp=0;

        while(a){
            if(a%2!=0)break;
            a/=2;
            temp++;
        }
        ans+=temp;
    }
    cout<<ans<<endl;
 
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>

int main() {
  using namespace std;
  int a, b;
  scanf("%d %d", &a, &b);
  int i;
  int c = 0;
  for(i = 1; i <= b-a-1; i++){
    c += i;
  }
  cout << (c-a) << "\n";
  return 0;
}

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

int main(){
    int a,b;
    cin >> a >> b;
    if(a >= 13) cout << b << endl;
    else if(a >= 6) cout << b/2 << endl;
    else cout << 0 << endl;
}

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

using namespace std;

typedef long long int lli;

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

    int n, ans = 0;
    cin >> n;

    for (int i=1; i<=n; i++) {
        int cont = 0, num = i;
        while (num > 0) {
            num /= 10;
            cont++;
        }
        if (cont%2) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
# B - FizzBuzz Sum

n = int(input())

def sum_of_mult(k, n):
    """n以下のkの倍数の和"""
    return k * (n // k) * (n // k + 1) // 2

s1  = sum_of_mult(1, n)  # 1〜nまでの和
s3  = sum_of_mult(3, n)  # 3の倍数の和
s5  = sum_of_mult(5, n)  # 3の倍数の和
s15 = sum_of_mult(15, n) # 15の倍数の和

print(s1 - s3 - s5 + s15)


Measured memory_bytes: 9192
from math import *


def distance (p,n,x,y):
    dis = 0.0
    if p == "inf":
        for i in range(0,n) :
            if dis < abs(x[i]-y[i]):
                dis = abs(x[i]-y[i])
    else :
        for i in range(0,n) :
            dis += abs(x[i]-y[i])**p
        dis = dis ** (1.0/p)
    return dis


if  __name__ == '__main__' :
     n = int(input())
     x = map(int,raw_input().split())
     y = map(int,raw_input().split())
     print distance(1,n,x,y)
     print distance(2,n,x,y)
     print distance(3,n,x,y)
     v = distance('inf',n,x,y)
     print "%.6f" % v

Measured memory_bytes: 6700
using System;
using System.Collections.Generic;
using System.Linq;

namespace oasobi
{
    static class MainClass
    {
        public static void Main()
        {
            string[] input1 = Console.ReadLine().Split(' ');
            int a = int.Parse(input1[0]);
            int b = int.Parse(input1[1]);
            int c = int.Parse(input1[2]);
            int d = int.Parse(input1[3]);

            bool takahasi = true;

            while(a > 0 && c > 0)
            {
                c -= b;

                if(c > 0)
                {
                    a -= d;

                    if(a <= 0)
                    {
                        takahasi = false;
                        break;
                    }
                }
                else
                {
                    break;
                }
            }

            if(takahasi == true)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

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

int main()
{
  long long sum=0,a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k>a)
  {
    sum+=a;
    k-=a;

  }
  else
  {sum+=k;
  k=0;}
  if(k>b)
  {
    k-=b;
  }
  else
  k=0;
  if(k>0)
  {
    sum-=k;
    k=0;
  }
  cout<<sum<<"\n";
}


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

int main() {
    int64_t h;
    cin >> h;
    int64_t count = 0;
    while (h != 0) {
        if (h > 1) h /= 2;
        else h = 0;
        count++;
    }
    cout << (int64_t)pow(2, count) - 1 << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <unordered_set>
#include <cstdint>
#include <vector>
#include <sstream>
#include <string>
#include <climits>
#include <set>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <numeric>
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;

	vector<double> niz(n);

	for (int i = 0; i < n; i++)
		cin >> niz[i];

	sort(niz.begin(), niz.end());

	for (int i = 0; i < n - 1; i++)
		niz[i + 1] = (niz[i] + niz[i + 1]) / 2;

	cout << niz[n - 1];
}

Measured memory_bytes: 3772
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf = 1e9;
const ll INF = 1e18;
const int NODE_SIZE = 310;

ll N;  //グラフのノードの数
ll d[NODE_SIZE][NODE_SIZE];  //ノード接続関係 兼 最短距離(任意の二点間)
ll b[NODE_SIZE][NODE_SIZE];
bool f[NODE_SIZE][NODE_SIZE];
ll warshall_floyd(){
    ll sum=0;
    REP(i,0,N) {
        REP(j,0,N) {
            sum += d[i][j];
        }
    }
    sum/=2;
    REP(k,0,N){
        REP(i,0,N){
            if(d[i][k] == INF || i==k) continue;
            REP(j,0,N){
                if(d[k][j] == INF || j==k) continue;
                //d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                if(b[i][j] > d[i][k] + d[k][j]){
                    return -1;
                }else if(b[i][j] == d[i][k] + d[k][j] && !f[i][j]){
                    sum -= b[i][j];
                    f[i][j] = f[j][i] = true;
                }
            }
        }
    }

    return sum;
}

int main(){
    cin>>N;

    REP(i,0,N){
        REP(j,0,N){
            if(i==j) d[i][j] = 0;
            else d[i][j] = INF;
        }
    }

    REP(i,0,N){
        REP(j,0,N){
            cin>>b[i][j];
            d[i][j]=b[i][j];
        }
    }

    p(warshall_floyd());
    return 0;
}


Measured memory_bytes: 1920
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
#include <numeric>
using namespace std;

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

const string blah[] = { "deficient", "perfect", "abundant" };
int N;

int f() {
  vector<int> v;
  for (int i = 1; i * i <= N; ++i) {
    if (N % i == 0) {
      v.push_back(i);
      if (i != N/i)
        v.push_back(N/i);
    }
  }
  const int S = accumulate(v.begin(), v.end(), 0) - N;
  // printf("%d %d : ", N, S);
  return N == S ? 1 : N > S ? 0 : 2 ;
}

int main() {
  while (-1 != scanf("%d", &N)) {
    if (!N) break;
    printf("%s number\n", blah[f()].c_str());
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<functional>
#include<math.h>

using namespace std;

int main() {
	int N, x, mid;
	long ans = 0;
	long A[200005], B[200005];

	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> A[i];
		B[i] = A[i]-(i+1);

	}
	sort(B, B+N);


		mid = B[N/2];
		for (int i = 0; i < N; i++) {
			x = B[i] - mid;
			ans += abs(x);
		}
	
	cout << ans <<endl;

	return 0;
}

Measured memory_bytes: 3328
import math
A,B,H,M = map(int,input().split())

ho_theta = H*30 + M * 0.5
min_theta = M * 6

theta = math.radians(abs(ho_theta-min_theta))
C = A**2 + B**2 -2*A*B*(math.cos(theta))
print(math.sqrt(C))

Measured memory_bytes: 9500
#include <algorithm>
#include <cmath>
#include <iostream>

using namespace std;

int main()
{
  int n, x, y; cin >> n >> x >> y;
  
  int ans[2005];
  for (int i = 1; i < n; ++i) ans[i] = n-i;
  
  int d[2005][2005]; int m = (x + y) / 2;
  for (int i = 1; i <= n-1; ++i) for (int j = i+1; j <= n; ++j) {
    d[i][j] = j-i;
    int nd = abs(i-x)+abs(j-y)+1;
    if (d[i][j] > nd) {--ans[d[i][j]]; ++ans[nd]; d[i][j] = nd;}
  }
  
  for (int i = 1; i < n; ++i) cout << ans[i] << endl;
  return 0;
}

Measured memory_bytes: 256