akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair

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

    ll n;
    cin>>n;
    set<string>s;
    string st;
    for(ll i=1;i<=n;i++)
    {
        cin>>st;
        s.insert(st);
    }
    cout<<s.size();
}


Measured memory_bytes: 19212
#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f
using namespace std;

int main()
{
    string s1,s2;
    cin>>s1>>s2;
    int ans=1e4;
    ///这里补充一下的我的错误理解，就是如果遇到不同的就跳出，这不对，万一剩下的还有很多相同的呢
    for(int i=0; i<=s1.length()-s2.length(); i++)///这块减法实在搞不明白就用加法
    {
        int num=0;
        for(int j=0; j<s2.length(); j++)
        {
            if(s1[i+j]!=s2[j])
                num++;
        }
        ans=min(ans,num);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3636
// https://qiita.com/drken/items/fd4e5e3630d0f5859067
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N int
	fmt.Scan(&N)
	d := make([]int, N)
	for i := range d {
		fmt.Scan(&d[i])
	}

	sort.Ints(d)

	maxD := 0
	num := 0
	for _, v := range d {
		if maxD < v {
			maxD = v
			num += 1
		}
	}
	fmt.Println(num)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
string side[4],Longitudinal[5];
int mox[2][2]={{1,-1},{0,-1}},moy[2][2]={{-1,1},{-1,0}};
char str[5]="URDL";
void serch(int x,int y,int then)
{
    if(then==-1)then=3;
    if(!x&&!y){
        cout<<endl;
        exit(0);
    }
    for(int i=0;i<4;i++){
        int now=(then+i)%4,ka=now/2;
        if(!(now%2)&&y+moy[0][ka]<5&&y+moy[0][ka]>-1&&side[y+moy[1][ka]][x]=='1'){
            cout<<str[now];
            serch(x,y+moy[0][ka],now-1);
        }
        else if(now%2&&x+mox[0][ka]<5&&x+mox[0][now/2]>-1&&Longitudinal[y][x+mox[1][ka]]=='1'){
            cout<<str[now];
            serch(x+mox[0][ka],y,now-1);
        }
    }
}
int main()
{
    for(int i=0;i<4;i++)cin>>Longitudinal[i]>>side[i];
    cin>>Longitudinal[4];
    cout<<"R";
    serch(1,0,0);
}

Measured memory_bytes: 3144
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

# Written by NoKnowledgeGG @YlePhan

#import math
#mod = 10**9+7
def main():
  w = input()
  dic = {}
  for i in range(len(w)):
    if w[i] in dic:
      dic[w[i]] +=1
    else:
      dic[w[i]] = 1
  for k,v in dic.items():
    if v % 2 != 0:
      print('No')
      exit()
  print('Yes')
if __name__ == '__main__':
  main()

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

using namespace std;
 
int main()
{
    double n, s[10];
     
    while (cin >> n) {
        double ans = 0.0;
        s[0] = n;         
        for (int i = 1; i < 10; i++) {
            if ((i+1) % 2 == 0) {
                s[i] = 2.0 * s[i-1];
            } else {
                s[i] = s[i-1] / 3.0;
            }
        }
        for (int i = 0; i < 10; i++) {
            ans += s[i];
        }
        printf("%.8f\n" ,ans);
    }
    return 0;
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  string s; cin>>s;
  ll k; cin>>k;
  set<char> se;
  ll n=s.size();
  rep(i,n) se.insert(s[i]);
  
  ll cnt=0;
  for(char e: se){
    set<string> t;
    rrep(i,n){
      if(s[i]==e){
        t.insert(s.substr(i,n-i));
      }
    }
    // vsort(t);
    set<string> ng;
    for(auto e: t){
      // cout<<e<<endl;
      rep(i,e.size()){
        string now=e.substr(0,i+1);
        if(ng.count(now)) continue;
        ng.insert(now);
        cnt++;
        if(cnt==k){
          cout<<now<<endl;
          return 0;
        }
      }
    }
  }
  
}

Measured memory_bytes: 16256
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <algorithm>

using namespace std;

int main(void) {

	int a, b;
	string str;

	cin >> a >> b;
	cin >> str;
	b--;

	if (str[b] == 'A') str[b] = 'a';
	if (str[b] == 'B') str[b] = 'b';
	if (str[b] == 'C') str[b] = 'c';

	cout << str << endl;

	return 0;
}

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

using namespace std;

int main(){
    int n, d; cin >> n >> d;
    vector<vector<int>> xs(n, vector<int>(d));
    for(int ni=0; ni<n; ++ni){
        for(int di=0; di<d; ++di){
            cin >> xs[ni][di];
        }
    }
    int ans=0;
    for(int i=0; i<n; ++i){
        for(int j=i+1; j<n; ++j){
            int s=0;
            for(int k=0; k<d; ++k){
                int dd=xs[i][k]-xs[j][k];
                s+=dd*dd;
            }
            for(int k=0; k*k<=s; ++k){
                if(k*k==s){
                    ++ans;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}



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

#define DEBUG
#ifdef DEBUG
#define dump(x) cout << "[*] " #x ": " << x << endl
#define debug(x) x
#else
#define dump(x)
#define debug(x)
#endif

constexpr int MAX = 100001;

// dp[i] :== i に行くコストの最小値
int dp[MAX];
int N;
int K;
vector<int> h;

int main() {
    cin >> N >> K;
    h = vector<int>(N+1);

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

    dp[0] = dp[1] = 0;
    for (int i = 2; i < MAX; ++i) {
        dp[i] = INT_MAX;
    }
    for (int i = 2; i <= N; ++i) {
        for (int k = 1; k <= K; ++k) {
            if (i - k >= 0) {
                dp[i] = min(dp[i], dp[i-k] + abs(h[i]-h[i-k]));
            }
        }
    }
    cout << dp[N] << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, H[100000];
    cin >> N;
    REP(i, N) cin >> H[i];
    int before = H[0] - 1;
    FOR(i, 1, N) {
        if (H[i] == before) {
            before = H[i];
        } else if (H[i] > before) {
            before = H[i] - 1;
        } else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
 /*   double t,x;
    cin>>t>>x;
    t=t/x;
    cout<<t*1.0<<'\n';*/
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a*b)/2<<'\n';
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args) {
	    Scanner sc=new Scanner(System.in);
	    long l=sc.nextLong();
	   
		String ans="";
	    while(l-->0) {
	    	ans=(char)('a'+(l%26))+ans;
	    	l/=26;
	    }
	   
		System.out.println(ans);
	}
}


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

using namespace __gnu_pbds; 
using namespace std;
using   ll=long long;
using   ld=long double;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int
#define pll				pair<int , int>

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007
#define hell            998244353 

ll mod_pow(ll a,ll b,ll m) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2 , mod);
}

void solve()
{
	int n , m;
	
	cin >> n >> m;
	
	cout << (n-1)*(m-1);
}

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


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

int main(){
	int x,y,w,h,r;
	cin >> w >> h >> x >> y >> r;
	
	if((x<=w-r)&&(x>=r)&&(y<=h-r)&&(y>=r )) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}



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

vector<ll> ret;
void divisor(long long n)
{

    for (long long i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ret.push_back(i);
            if (i * i != n)
                ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
}

int main()
{
    //最大公約数を求める。
    ll n, m;
    cin >> n >> m;
    divisor(m);
    ll k = 0;

    k = ret[lower_bound(ret.begin(), ret.end(), n) - ret.begin()];
    cout << m / k << endl;
    //公約数のうち、N以上となるもののうち最小値になるものを選択すれば良い。
    //Mが大きすぎるのでfor分で回すと死ぬ。
    //公約数と成り得る数をqueに格納していけば絶対にできる。(どうやる？)
}

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

int main() 
{
    int N;
    cin >> N;
    map<string, int>mp{{"AC",0}, {"WA",0}, {"TLE",0}, {"RE",0}};
    for (int i = 0; i < N; i++) {
        string str;
        cin >> str;
        mp[str]++;
    }
    
    vector<string> S{"AC", "WA", "TLE", "RE"};
    int hoge = 0;
    for (int i = 0; i < S.size(); i++) {
        for (auto itr = mp.begin(); itr != mp.end(); itr++) {
            if (itr->first == S[hoge]) {
                cout << itr->first << " x " << itr->second << endl;
                hoge++;
            }
        }
    }
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main()
{
        int a, b, c;
        cin>>a>>b>>c;
        int cnt=0;
        for(int i=a;i<=b;i++)
        {

            if(c%i==0) cnt++;
        }
        cout<<cnt<<"\n";

        return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
 
using namespace std;  
 
typedef long long ll;
typedef long double ld;
 
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define rs resize
#define all(x) x.begin(), x.end()   
 
void pre(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

void pudge(){
    int n;
    cin >> n;  
    if (n < 100){
        cout << 0 << '\n';
        return;
    }
    for (int i = 100; i <= 105; i++){
        if (n % i == 0){
            cout << 1 << '\n';
            return;
        }
    }
    int t = n % 100, a = n / 100, cnt = 0;

    for (int i = 5; i > 0; i--){
        cnt += t / i;
        t %= i;
    }
    if (cnt <= a)
        cout << 1;
    else
        cout << 0;

}
 
int main(){ 
    pre();
    pudge();
    return 0;
}

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

using namespace std;

#define int long long
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF 1e9
#define LINF 1e18

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if(s == "abc") cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
/*
Author: Babin Dutta
*/
 
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,n) for(int i=0;i<n;i++)
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define mm 998244353
 
ll power(ll x, ll y, ll p)
{
    ll res = 1;  
    x = x % p;  
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; 
        x = (x*x) % p;  
    }
    return res;
}
ll modInverse(ll A,ll M)
{
    return power(A,M-2,M);
}
const int N = 2001;
int dp[N];

void init(int n){
	dp[0] = 1;
	for(int i=0;i<=n;i++){
		for(int j=3;i+j<=n;j++){
			dp[i+j] = ((dp[i+j]%mod)+(dp[i]%mod))%mod;
		}
	}
}

void solve(){
	int n; cin>>n;
	if(n <= 2){
		cout<<0<<endl;
		return;
	}
	init(n);
	ll ans = dp[n];
	cout<<ans<<endl;
}
 
int main(){
	#ifdef JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    #endif
	boost;
	int t=1; //cin>>t;
	for(int i=1;i<=t;i++) solve();
	return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
int euclidean_gcd(int a, int b) {
  if(a < b) return euclidean_gcd(b, a);
  int r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
signed main()
{
int x=0,y=0,z=0,w=0,n=0,m=0,a=0,b=0;
std::cin >> x;
std::vector<string> v;
string s;
rep(i,x){
  std::cin >>s;
  if(i==0){
    v.pb(s);
  }else{
    rep(i,v.size()){
      if(s==v[i]){
        std::cout << "No" << '\n';
        return 0;
      }
    }
    if(v[v.size()-1][v[v.size()-1].size()-1]!=s[0]){
      std::cout <<"No" << '\n';
      return 0;
    }
    v.pb(s);
  }
}
std::cout << "Yes" << '\n';
}


Measured memory_bytes: 384
def time2min x
    h, m = x.split(":").map(&:to_i)
    h * 60 + m
end

n, t = gets.chomp.split.map(&:to_i)
arr = []
ptime1, pname1, ptime2, pname2 = gets.chomp.split
(n - 1).times{
    time1, name1, time2, name2 = gets.chomp.split
    interval = time2min(time1) - time2min(ptime2)
    arr << [name1, interval] if interval >= t
    ptime1, pname1, ptime2, pname2 = time1, name1, time2, name2
}
puts arr.length
arr.each{|a, b| puts "#{a} #{b}"}



Measured memory_bytes: 6880
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int MOD = 1000000007;

int main(void){
    int N, R; cin >> N >> R;
    
    if (N >= 10) cout << R << endl;
    else cout << R + 100 * (10 - N) << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sun May 19 20:12:17 2019

@author: Owner
"""

from operator import itemgetter
import bisect

N, M = map(int, input().split())


ab = [(0, 0)]*M
for m in range(M):
    ab[m] = tuple(map(int, input().split()))

ab = tuple(sorted(ab, key = itemgetter(1)))

#print(ab)
x_rm = -1
res = 0
for m in range(M):
    if ab[m][0] < x_rm:
        continue
    else:
        x_rm = ab[m][1]
        res += 1
    
    
        

print(res)



Measured memory_bytes: 57560
# ContestName
# URL
import sys
#import numpy as np

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    coins = [1]
    d = 6
    while d <= N:
        coins.append(d)
        d *= 6
    d = 9
    while d <= N:
        coins.append(d)
        d *= 9
    dp = [0] * (N+1)
    for i in range(1, N+1):
        n = 100000
        for c in coins:
            if i - c < 0:
                continue
            t = dp[i-c] + 1
            if t < n:
                n = t
        dp[i] = n
    print(dp[N])

main()


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

int main() {
  int a ,b;
  cin >> a >> b;
  if ((a*b)%2 == 0) {
   cout << "Even" << endl;
  }
  else if ((a*b)%2 == 1) {
   cout << "Odd" << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    W -= r, H -= r;
    if (r <= x && x <= W && r <= y && y <= H) {
         printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 1992
//inputに入力データ全体が入る
var alphabet="abcdefghijklmnopqrstuvwxyz"
function Main(input) {
    var tmp=inputting(input)
    console.log(alphabet.charAt(1+alphabet.indexOf(tmp[0][0])))//標準出力
}
function inputting(input){
    //標準入力で受け取ったデータを、改行区切りでi行目、空白区切りでj番目のデータが[i][j]に格納される配列に変換する
    input = input.split("\n");
    var tmp=[]
    for(var i=0;i<input.length;i++){
        tmp[i]=input[i].split(" ")
    }
    return tmp
}
function parseint_array(arr){
    var ret=[]
    for(var i=0;i<arr.length;i++){
        ret[i]=[]
        for(var j=0;j<arr[i].length;j++){
            ret[i][j]=parseInt(arr[i][j])
        }
    }
    return ret
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//Main("1\n2 3\npoyo")//標準入力サンプル

Measured memory_bytes: 7372
#include<iostream>
#include<string>
#include<ctype.h>
using namespace std;

int main(){
	string s;
	getline(cin, s);
	for(int i=0;i<s.size();i++){
		if(isalpha(s[i])){
			s[i] -= 32;
		}
	}
	cout << s << endl;
}

Measured memory_bytes: 0
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
import numpy as np

K, S = MAP()

cnt = 0

for X in range(K+1):
	for Y in range(K+1):
		Z = S - X - Y
		if 0 <= Z <= K:
			cnt += 1
print(cnt)



Measured memory_bytes: 21976
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;
typedef vector<int> ivec;

const int MOD=1000000007;
int INF=100100100100100;
int a[150];
signed main(){
  int n;cin>>n;
  rep(i,n)cin>>a[i];
  int ans=0;
  int ma=0;
  rep(i,n){
    if(ma<=a[i]){
      ans++;ma=max(ma,a[i]);
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

#define pi acos(-1.0)
#define pii pair<int, int>
#define mod 1000000007
#define MAX 1000000
#define pb push_back
#define FOR(i, a, b) for(int i=a; i<=b; i++)
#define dbg1(a) printf("yo is %d\n",a)
#define dbg2(a, b) printf("yo is %d %d\n",a ,b)
#define mem(ara,val) memset(ara,val,sizeof(ara))

using namespace std;
typedef long long ll;
typedef vector<int> vi;

int a[110];

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    int n, x;
    cin>>n>>x;
    FOR(i, 0, n-1) scanf("%d", &a[i]);
    sort(a, a+n);
    int res = 0;
    FOR(i, 0, n-1)
    {
        if(i==n-1)
        {
            if(x==a[i]) res++;
        }
        else if(x>=a[i])
        {
            res++;
            x -= a[i];
        }
    }
    printf("%d\n", max(res, 0));
    //main();
    return 0;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max,count
#include <string>	//string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt
#include <sstream>	//stringstream,getline
#include <cmath>	//ceil,M_PI

using namespace std;

int main() {

	int D, T, S;
	cin >> D >> T >> S;

	if (D <= T * S) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;

}

Measured memory_bytes: 3640
#include <bits/stdc++.h> 
#include <chrono>
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<long, long> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

int main(){
    int N;cin>>N;
    vector<int>A(N),B(N);
    REP(i,N){
        cin>>A[i];
        B[i]=A[i];
    }
    SORT(B);
    REP(i,N){
        if(A[i]!=B[N-1]){
            cout<<B[N-1]<<endl;
        }else{
            cout<<B[N-2]<<endl;
        }
    }
    return 0;
}


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

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

ll mod = 1e9 + 7;


int main() {
    string s, t;
    cin >> s >> t;
    vector<int> a(26, -1), b(26, -1);
    int S = s.size();
    rp(i, 0, S) {
        int x = s.at(i) - 'a';
        int y = t.at(i) - 'a';
        if (a.at(x) < 0) {
            a.at(x) = y;
        } else if (a.at(x) != y) {
            printf("No\n");
            return 0;
        }
        if (b.at(y) < 0) {
            b.at(y) = x;
        } else if (b.at(y) != x) {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
} 


Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    int a,b;
    cin>>a>>b;
    if(a>b)swap(a,b);
    for(int i=0;i<b;i++){
        cout<<a;
    }
    cout<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    while(true){
      c= c-b;
      if(c<=0){
        System.out.println("Yes");
        break;
      }
      a= a-d;
      if(a<=0){
        System.out.println("No");
        break;
      }
    }
  }
}

Measured memory_bytes: 35788
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
//	cut here before submit 
//	freopen ("testcase.WCITU", "r", stdin );
	int n;
	while (scanf ("%d", &n ), n ){
		map<int,int, greater<int> > color; color.clear();
		rep (i, n ){
			int in;
			scanf ("%d", &in );
			color[in]++;
		} // end rep
		int res = 0;
		bool found = false;		
		map<int,int,greater<int> >::iterator it = color.begin();
		for (; it != color.end(); it++ ){
			if ((*it).second > n/2 ){
				res = (*it).first;
				found = true;
				break;
			} // end if
		} // end for
		
		if (found ){
			printf ("%d\n", res );
		}else{
			printf ("NO COLOR\n" );
		} // end if
	} // end while

	return 0;
}

Measured memory_bytes: 2736
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;cin>>N;
  cout<<(N<1000? "ABC":"ABD")<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <stack>

using namespace std;

int main(){
	int w,sum;

	while(true){
		scanf("%d",&w);
		if(w == -1)break;

		sum = 1150;

		if(w > 10){
			sum += 125*(min(10,w-10));
		}

		if(w > 20){
			sum += 140*(min(10,w-20));
		}

		if(w > 30){
			sum += 160*(w-30);
		}

		printf("%d\n",4280-sum);

	}

    return 0;
}

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

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

  auto get_times = [&](int l, int r) {
    int l_time = x[l];
    int r_time = x[r];
    if(l_time >= 0 && r_time >= 0) {
      return abs(r_time);
    }
    if(l_time < 0 && r_time < 0) {
      return abs(l_time);
    }
    if(l_time < 0 && r_time >= 0) {
      return min(abs(l_time) * 2 + abs(r_time), abs(r_time) * 2 + abs(l_time));
    }
    return -1;
  };

  int l = 0;
  int r = k - 1;

  int ans = 2147483647;
  while(r < n) {
    int t = get_times(l, r);
    ans = min(ans, t);
    l++;
    r++;
  }

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


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

int main() {
    char a[10][10];
    scanf("%s%s%s",a[0],a[1],a[2]);
    printf("%c%c%c\n",a[0][0],a[1][1],a[2][2]);
} 


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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    vector a(n + 1, 0L);
    for (auto&& aa : a) {
        cin >> aa;
    }

    if (n == 0) {
        if (a[0] == 1) {
            cout << 1 << endl;
        } else {
            cout << -1 << endl;
        }
        return 0;
    }

    if (a[0] != 0) {
        cout << -1 << endl;
        return 0;
    }

    vector s(n + 1, a[n]);
    for (auto i : irange(0L, n) | reversed) {
        s[i] = s[i + 1] + a[i];
    }

    int64_t p = 1;
    int64_t ans = 1;
    for (auto i : irange(1L, n + 1)) {
        p = min(2 * p, s[i]);
        if (p < a[i]) {
            cout << -1 << endl;
            return 0;
        }
        ans += p;
        // cerr << p << " " << s[i] << " " << p - a[i] << "\n";
        p -= a[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 4844
#include<iostream>
using namespace std;
int main(){
long i,n,m,c[101]={0};
while(cin>>n){
cin>>m;
c[n]++;c[m]++;
if(n==0){
if(c[1]/2*2==c[1]){cout<<"NG"<<endl;goto L1;}
if(c[2]/2*2==c[2]){cout<<"NG"<<endl;goto L1;}
for(i=3;i<101;i++)if(c[i]/2*2!=c[i])break;
if(i==101)cout<<"OK"<<endl;else cout<<"NG"<<endl;
L1:for(i=0;i<101;i++)c[i]=0;
}
}
return 0;
}

Measured memory_bytes: 1156
using Atcoder;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var K = Console.ReadLine().Split(' ');
            var A = int.Parse((K[0]));
            var P = int.Parse((K[1]));
            var ret = (A * 3 + P) / 2;
            Console.Write(ret);

        }

    }

    //var N = int.Parse(Console.ReadLine());
    //var S = Console.ReadLine();
    //var K = Console.ReadLine().Split(' ');
    //var N = int.Parse((K[0]));
    //var M = int.Parse((K[1]));
}


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

int main() {
  int N, N1, N2, N3, N4;
  cin >> N;
  
  if (N / 10 % 111 == 0) {
    cout << "Yes" << endl;
  }
  else if ((N - (N / 1000) * 1000) % 111 == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3616
n = int(input())

li = 0
print(li)
ls = input()
if ls=="Vacant":
    exit()

ri = n-1
print(ri)
rs = input()
if rs=="Vacant":
    exit()

while ri>li:
    mid = (ri+li)//2
    print(mid)
    s = input()

    if s=="Vacant":
        exit()
    
    if (mid-li)%2==0:
        if s!=ls:
            ri = mid
            rs = s
        else:
            li = mid
            ls = s
    else:
        if s!=ls:
            li = mid
            ls = s
        else:
            ri = mid
            rs = s


Measured memory_bytes: 3660
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>


using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };

#define ARRAY_MAX 100005

const ll INF = 1e9 + 7;
const ll MOD = 1e9 + 7;


//平方分割
const int sqrtN = 1024;

template<typename T>
struct SqrtDecomposition {
	//RSQ(平方分割)
private:
	T N, K;
	vector<T> data;
	vector<T> bucketSum;
public:
	SqrtDecomposition(T n) : N(n) {
		K = (N + sqrtN - 1) / sqrtN;
		data.assign(K * sqrtN, 0);
		bucketSum.assign(K, 0);
	}
	void add(T x, T y) {
		T k = x / sqrtN;
		data[x] += y;
		T sum = 0;
		for (T i = k * sqrtN; i < (k + 1) * sqrtN; ++i) {
			sum += data[i];
		}
		bucketSum[k] = sum;
	}
	// [x, y)
	T getSum(T x, T y) {
		int sum = 0;
		for (int k = 0; k < K; ++k) {
			T l = k * sqrtN, r = (k + 1) * sqrtN;
			if (r <= x || y <= l)
				continue;
			if (x <= l && r <= y) {
				sum += bucketSum[k];
			}
			else {
				for (T i = max(x, l); i < min(y, r); ++i) {
					sum += data[i];
				}
			}
		}
		return sum;
	}
};



int main() {

	int N, Q;
	cin >> N >> Q;

	SqrtDecomposition<int> decomp(N);

	for(int i = 0;i < Q;i++)
	{
		int c, x, y;
		cin >> c >> x >> y;
		x--;
		if (c == 0) {
			decomp.add(x, y);
		}
		else {
			cout << decomp.getSum(x, y) << endl;
		}
	}
}


Measured memory_bytes: 3316
from collections import deque
from copy import deepcopy
def dfs(world,i,j):#コピーした世界と開始場所
  c=0
  mc=-1
  pos=deque()
  pos.append((i,j,c))
  while pos:
    i,j,c=pos.popleft()
    if world[i][j]=="#":
      continue
    if world[i+1][j]!="#":
      pos.append((i+1,j,c+1))
    if world[i-1][j]!="#":
      pos.append((i-1,j,c+1))
    if world[i][j+1]!="#":
      pos.append((i,j+1,c+1))
    if world[i][j-1]!="#":
      pos.append((i,j-1,c+1))
    world[i][j]="#"
    if mc<c:
      mc=c
  return mc
ans=0
H,W=map(int,input().split())
#１．シャープが壁の迷路を作る
world=[]
world.append(["#"]*(W+2))
for i in range(H):
  world.append(["#"]+list(input())+["#"])
world.append(["#"]*(W+2))
#作った
#dfsをすべての場所で行う
for i in range(H+2):
  for j in range(W+2):
    if world[i][j]==".":
      mc=dfs(deepcopy(world),i,j)
      if ans<mc:
        ans=mc
print(ans)

Measured memory_bytes: 3436
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
	char S[3];
	char T[3];
	cin>>S[0]>>S[1]>>S[2];
	cin>>T[0]>>T[1]>>T[2];
	int R=0;
	for(int i=0;i<3;i++){
		if(S[i]==T[i]){
			R++;
		}
	}

	cout<<R<<endl;
	return 0;
}


Measured memory_bytes: 256
import std.algorithm;
import std.range;
import std.stdio;
import std.math;
import std.array;
import std.string;
import std.conv;

/// 数列の読み込み
auto readNums(T = int)() {
	return readln().chomp.split.map!(to!T).array;
}

/// 数の読み込み
auto readNum(T = int)() {
	return readNums!T.front;
}

/// 指定行数読み込み
auto readRows(size_t rows) {
	return generate(() => readln().chomp).take(rows).array;
}

/// 範囲の計算
auto range(T)(T a, T b, T c, T d) {
    auto start = max(a, c);
    auto end = max(b, d);
    return (start < end) ? tuple(start, end) : tuple(cast(T) 0, cast(T) 0);
}

auto maxElement(R)(R r) {
    return r.reduce!((a, b) => max(a, b));
}

auto minElement(R)(R r) {
    return r.reduce!((a, b) => min(a, b));
}

void main() {
	const nums = readNums();
	immutable a = nums[0];
	immutable b = nums[1];
	immutable c = nums[2] * 2;
	immutable x = nums[3];
	immutable y = nums[4];
	
	if(a + b < c) {
		writefln("%s", a * x + b * y);
		return;
	}
	
	if(x < y) {
		immutable bunit = min(b, c);
		writefln("%d", c * x + bunit * (y - x));
	} else {
		immutable aunit = min(a, c);
		writefln("%d", c * y + aunit * (x - y));
	}
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	h, w int
	s    []string
	ch   = make(chan [][]int)
)

func calcLeft() {
	ls := make([][]int, h)
	for i := range ls {
		ls[i] = make([]int, w)
		for j := 0; j < w; j++ {
			if s[i][j] == '#' {
				ls[i][j] = 0
				continue
			}
			if j == 0 {
				ls[i][j] = 1
				continue
			}
			ls[i][j] = ls[i][j-1] + 1
		}
	}
	ch <- ls
}

func calcRight() {
	rs := make([][]int, h)
	for i := range rs {
		rs[i] = make([]int, w)
		for j := w - 1; j >= 0; j-- {
			if s[i][j] == '#' {
				rs[i][j] = 0
				continue
			}
			if j == w-1 {
				rs[i][j] = 1
				continue
			}
			rs[i][j] = rs[i][j+1] + 1
		}
	}
	ch <- rs
}

func calcTop() {
	ts := make([][]int, h)
	for i := range ts {
		ts[i] = make([]int, w)
	}
	for j := 0; j < w; j++ {
		for i := 0; i < h; i++ {
			if s[i][j] == '#' {
				ts[i][j] = 0
				continue
			}
			if i == 0 {
				ts[i][j] = 1
				continue
			}
			ts[i][j] = ts[i-1][j] + 1
		}
	}
	ch <- ts
}

func calcDown() {
	ds := make([][]int, h)
	for i := range ds {
		ds[i] = make([]int, w)
	}
	for j := 0; j < w; j++ {
		for i := h - 1; i >= 0; i-- {
			if s[i][j] == '#' {
				ds[i][j] = 0
				continue
			}
			if i == h-1 {
				ds[i][j] = 1
				continue
			}
			ds[i][j] = ds[i+1][j] + 1
		}
	}
	ch <- ds
}

func main() {
	fmt.Scan(&h, &w)

	sc := bufio.NewScanner(os.Stdin)
	s = make([]string, h)
	for i := range s {
		sc.Scan()
		s[i] = sc.Text()
	}

	go calcLeft()
	go calcRight()
	go calcTop()
	go calcDown()

	s1, s2, s3, s4 := <-ch, <-ch, <-ch, <-ch
	ans := 0
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if v := s1[i][j] + s2[i][j] + s3[i][j] + s4[i][j] - 3; v > ans {
				ans = v
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 138352
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    VS w(n);
    REP(i,n)cin>>w[i];
    string ans = "Yes";
    FOR(i,1,n)
    {
        if(w[i-1][w[i-1].size()-1] != w[i][0])ans = "No";
    }
    SORT(w);
    FOR(i,1,n)
    {
        if(w[i-1] == w[i])ans = "No";
    }
    PUTS(ans);
}

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

using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238463;
const int MAXN = 3e5 + 5;


    void debug_out() {
    cerr << endl;
}

template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

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

    if(m>=n)
        cout<<"unsafe"<<endl;
    else
        cout<<"safe"<<endl;
    return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
int main(void)
{
   int N,i,j;

   scanf("%d",&N);
   for(i=1;i<10;i++)
      for(j=1;j<10;j++)
         if(i*j==N){
            printf("Yes\n");
            return 0;
         }
   printf("No\n");
   return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(long long)>
using namespace std;
#define All(v) (v).begin(),(v).end()
const long long mod = 1000000007;
const long long inf = mod*mod;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
long long gcd(long long x, long long y) {
    if (y == 0)return x;
    else return gcd(y, x % y);
}
signed main(){
    vector<int> b(10,0);
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        if(a>=3200){
            b[8]++;
        }
        else{
            b[a/400]=1;
        }
    }
    int c=0;
    for(int i=0;i<8;i++){
        c+=b[i];
    }
    cout<<max(c,1)<<' '<<c+b[8]<<endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

def solve():
    K, N = map(int, input().split())
    A = list(map(int, input().split()))
    B = max((A[i]-A[i-1])%K for i in range(N))
    res = K-B
    return str(res)

if __name__ == '__main__':
    print(solve())



Measured memory_bytes: 26436
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define fs first
#define sc second

int main(void){
    int n;
    cin >> n;
    cout << n*n*n;
    return 0;
}

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

int mark[100005],arr[100005];
int ans = 0;
int n,mark1=-1;

int dfs(int start){
	if(mark[arr[start]]){
		return -1;
	}

	mark[start]=1;
	ans++;


	if(arr[start]==2){
		mark1 = ans;


		return mark1;
	}

   
    if(!mark[arr[start]]){
    	dfs(arr[start]);
    }else{
    	return -1;
    }
   
}

int main(){
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> arr[i];
	}

   // cout<<endl;
    cout<<dfs(1)<<endl;

	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <set>
using namespace std;

#define LET(name, value) __typeof(value) name = value
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define FOREQ(i, a, b) for (int i = (a); i <= (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOREACH(i, c) for (LET(i, (c).begin()); i != (c).end(); ++i)

struct Piece {
  int left;
  int right;
  int weight;
  int xsum;
  set<Piece*> children;

  Piece(): left(10000), right(-10000), weight(0), xsum(0) {}
};

char field[70][20];
Piece* pieces[70][20];

void dfs(Piece* piece, char mark, int y, int x) {
  static const int dy[] = {-1, 0, 1, 0};
  static const int dx[] = {0, -1, 0, 1};

  piece->weight += 1;
  piece->xsum += x;
  pieces[y][x] = piece;

  REP(i, 4) {
    int ny = y + dy[i], nx = x + dx[i];
    if (field[ny][nx] == '.') { continue; }
    if (field[ny][nx] == mark) {
      if (pieces[ny][nx] == NULL) { dfs(piece, mark, ny, nx); }
    } else if (i == 0) {
      if (pieces[ny][nx] == NULL) {
        dfs(new Piece, field[ny][nx], ny, nx);
      }
      piece->children.insert(pieces[ny][nx]);
    } else if (i == 2) {
      piece->left = min(piece->left, x);
      piece->right = max(piece->right, x+1);
    }
  }
}

inline bool order(int a, int b, int c) {
  return a < b && b < c;
}

bool check(Piece* piece, int& weight, int& xsum) {
  weight = piece->weight;
  xsum = piece->xsum;
  FOREACH(it, piece->children) {
    int w, xs;
    if (!check(*it, w, xs)) { return false; }
    weight += w;
    xsum += xs;
  }
  return order(2*piece->left*weight, 2*xsum+weight, 2*piece->right*weight);
}

int main() {
  int w, h;
  while (scanf("%d%d", &w, &h), w|h) {
    memset(field, '.', sizeof(field));
    memset(pieces, 0, sizeof(pieces));

    FOREQ(x, 1, w) { field[h+1][x] = '#'; }
    FOREQ(y, 1, h) FOREQ(x, 1, w) { scanf(" %c", &field[y][x]); }

    Piece* root = NULL;
    FOREQ(x, 1, w) {
      if (field[h][x] != '.') {
        dfs(new Piece, field[h][x], h, x);
        root = pieces[h][x];
        break;
      }
    }

    int w, xs;
    puts(check(root, w, xs) ? "STABLE" : "UNSTABLE");
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if((a+d-1)/d>=(c+b-1)/b){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
    return 0;
}




Measured memory_bytes: 3620
//私は<= と <の区別がつかないカスです
#include <iostream>
using namespace std;
#define ll long long
// Google大好き！！！
int main(void) {
  int n;
  cin >> n;

  ll ans = 1;
  const ll m = 1e18;
  bool flag = false;

  for (int i = 0; i < n; i++) {
    ll a;
    cin >> a;

    // cout << a << "kasu" << ans << endl;
    if (a == 0) {
      cout << a << endl;
      return 0;
    }
    //ans >mとしていたカスです。あほバカ
    if (flag || (m + 1) / ans < a || ans * a > m) {
      flag = true;
    }
    ans *= a;
  }
  if (flag)
    cout << -1 << endl;
  else
    cout << ans << endl;
}

Measured memory_bytes: 3636
import java.util.*;
public class Main {
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		int n = Integer.parseInt(scan.next());
		int x = Integer.parseInt(scan.next());
		int[] a = new int[n];
		for(int i = 0;i < n; ++i){
			a[i] = Integer.parseInt(scan.next());
		}
		Arrays.sort(a);
		int ans = 0;
		for(int i = 0;i < n; ++i){
			if (a[i] <= x){
				++ans;
				x-=a[i];
				if(i == n-1 && x != 0){
					--ans;
				}
			}else{
				break;
			}
		}
		System.out.println(ans);

	}

}


//end

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  int64_t D, A;
  cin >> N >> D >> A;
  vector<int64_t> X(N), H(N);
  for (int i = 0; i < N; i++) {
    cin >> X[i] >> H[i];
  }
  vector<int> idx(N);
  iota(idx.begin(), idx.end(), 0);
  sort(idx.begin(), idx.end(), [&](int a, int b) { return X[a] < X[b]; });
  vector<int64_t> NX(N), NH(N);
  for (int i = 0; i < N; i++) {
    NX[i] = X[idx[i]], NH[i] = H[idx[i]];
  }
  X = NX, H = NH;
  int64_t res = 0;
  vector<int64_t> CS(N + 1, 0);
  for (int i = 0; i < N; i++) {
    if (H[i] > CS[i]) {
      int p = upper_bound(X.begin(), X.end(), X[i] + 2 * D) - X.begin();
      int64_t cnt = (H[i] - CS[i] + A - 1) / A;
      res += cnt;
      CS[i] += cnt * A;
      CS[p] -= cnt * A;
    }
    CS[i + 1] += CS[i];
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 8832