akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////////////////

ll n,m;
ll cal(vector<ll>v){
    sort(v.begin(),v.end());
    vector<l_l>a;
    ll vs=v.size();
    ll pos=0;
    while(pos<=vs-1){
        ll val=v[pos];
        ll cou=1;
        while(pos<=vs-2&&v[pos]==v[pos+1]){
            cou++;
            pos++;
        }
        a.pb(l_l(val,cou));
        pos++;
    }
    vector<ll>x,y;
    ll xs=0,ys=0;
    for(auto z:a){
        if(z.first%m<=m/2){
            x.pb(z.second);
            xs+=z.second;
        }else{
            y.pb(z.second);
            ys+=z.second;
        }
    }
    if(xs>ys){
        swap(xs,ys);
        swap(x,y);
    }
    ll dc=0;
    for(auto z:y){
        dc+=z/2;
    }
    dc=min(dc,(ys-xs)/2);
    ll res=0;
    res=xs+dc;
    
    return res;
}


int main(){fastio;
    cin>>n>>m;
    ll t=m/2+1;
    vector<ll>v[t];
    rep(i,0,n-1){
        ll c;cin>>c;
        ll d=c%m;
        if(d>=t)d=m-d;
        v[d].pb(c);
    }
    ll ans=0;
    rep(i,0,t-1){
        if(i==0||i*2==m){
            ans+=v[i].size()/2;
            continue;
        }
        //for(auto zzz:v[i])cout<<zzz<<" ";cout<<endl;
        ans+=cal(v[i]);
        //cout<<ans<<endl;
    }
    cout<<ans<<endl;
    
    return 0;
}





Measured memory_bytes: 3200
//abc150B
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void) {
  int n, i, cou=0;
  char s[50];
  scanf("%d %s", &n, &s);
  for(i=0; i < n - 2; i++)
    if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') cou++;
  printf("%d", cou);
}



Measured memory_bytes: 128
N, M = map(int, input().split())
a = []

oks = [True for i in range(N+1)]
for i in range(M):
    x = int(input())
    a.append(x)
    oks[x] = False

dp = [0 for i in range(N+1)]
dp[0] = 1

now = 0
while now < N:
    next = now+1
    while next <= min([N, now+2]):
        if oks[next]:
            dp[next] += dp[now]
            dp[next] %= 1000000007 
        next += 1
    now += 1

print(dp[N])



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

int dou(int n){
    n=2*n;
    return n;
}

int plu(int n,int k){
    n=n+k;
    return n;
}

int main(){
    int N,K,D=1,min=0;
    cin>>N>>K;
    while(1){
        for(int i=0;i<=N;i++){
            for(int j=N-i;j>0;j--){
                D=dou(D);
            }
            for(int j=i;j>0;j--){
                D=plu(D,K);
            }
            if(i==0){min=D;}
            if(min>D){
                min=D;
            }
            D=1;
        }
        break;
    }
    cout<<min<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
// #define lli long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// int const mod = 7340033;
int const mod = 1e9+7;
int power(int a,int b,int m){
    a %= mod;
    int res = 1;
    while(b){
        if(b&1){
            res = res*a;
            res %= m;
        }
        a=a*a;
        a%=m;
        b=b/2;
    }
    return res;
}
 
int inverse(int x){
    return power(x,mod-2,mod);
}

int const N = 2e5+5;
int const inf = 1e15;

void solve(){
    int i,j,l;
    int n,k;
    char c;
    cin>>c;
    c++;
    cout<<c<<endl;
}

int32_t main(){
    IOS;
    int t;
    t = 1;
    // pre();
    // cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}

/*

*/

Measured memory_bytes: 256
#include<stdio.h>
int max(int x,int y);

int main(void)
{
  int A,B;
  scanf("%d",&A);
  scanf("%d",&B);
  
  printf("%d",max(A,B));
  
  return 0;
}

int max(int x,int y)
{
  int m;
  
  if((x-y)>=(x+y)){
    if((x-y)>=(x*y)){
      m = x-y;
    }
    else if((x-y)<(x*y)){
      m = x*y;
  }
  }
  else{
    if((x+y)>=(x*y)){
      m = x+y;
    }
    
    else if((x+y)<(x*y)){
      m = x*y;
    }
  }
    
    return m;
  }
    

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
#include<stack>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define rep2(i, a)for(auto i : a)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x, std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll co(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
struct UnionFind {
	vector<int> par, s;
	UnionFind(int N) : par(N), s(N, 1) { rep(i, 0, N)par[i] = i; }
	int root(int x) { return par[x] == x ? x : par[x] = root(par[x]); }
	void unite(int x, int y) { x = root(x), y = root(y); if (x == y)return; if (s[x] < s[y])swap(x, y); s[x] += s[y]; par[y] = x; }
	bool same(int x, int y) { return root(x) == root(y); }
	int size(int x) { return s[root(x)]; }
	map<int, int> cnt() { map<int, int> cnt; rep2(v, par)cnt[root(v)]++; return cnt; }
};
#define P pair<ll, ll>
int main()
{
	ll n, m, a, b;
	cin >> n >> m;
	vector<P> br(m);
	for (int i = 0; i < m; ++i)
	{
		cin >> a >> b;
		a--; b--;
		br[i] = P(a, b);
	}

	reverse(br.begin(), br.end());
	UnionFind uf(n);

	stack<ll> ans;
	ll e_cnt = n * (n - 1) / 2;
	for (const auto& p : br)
	{
		ans.push(e_cnt);
		if (!uf.same(p.first, p.second))
		{
			e_cnt -= uf.size(p.first) * uf.size(p.second);
			uf.unite(p.first, p.second);
		}
	}

	while (!ans.empty())
	{
		cout << ans.top() << endl;
		ans.pop();
	}
	return 0;
}

Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
//NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER
//ABC 172, task a, 2020/06/26
//ms,
/*
*/

int main(void){
  string S, T;
  int ans=0;

  cin >>S >>T;
  for(int i=0;i<S.size();i++){
    if(S.at(i) != T.at(i)) ans++;
  }
  cout <<ans<<endl;
  return 0;
}
/*
*/


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

public class Main {
	private static void solve(){
		//Implement solution here.
		int n = ni();
		int[] a = na(n);		
		
		int[] l = new int[n];
		l[0] = a[0];
		for(int i = 1; i < n; i++) {
			l[i] = gcd(l[i-1], a[i]);
		}
		
		int[] r = new int[n];
		r[n-1] = a[n-1];
		for(int i = n-2; i >= 0; i--) {
			r[i] = gcd(r[i+1], a[i]);
		}
		
		int result = Math.max(l[n - 2], r[1]);		
		for(int i = 1; i < n - 1; i++) {
			result = Math.max(gcd(l[i - 1], r[i + 1]), result);
		}
		System.out.println(result);
	}

	//Find greatest common divisor
	static int gcd (int a, int b) {
		return b > 0 ? gcd(b, a%b) : a;
	}
	
	//Switch input source (stdin/file)
	private static BufferedReader br  = new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args){
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 42048
#include <iostream>

using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

    COMinit();

    long long ans = 0;
    for (int i=0; i < n; ++i) {
        for (int j=0; j < m; ++j) {
            if (i * j == 0) {
                ans += (((n - i) * (m - j)) % MOD) * (i + j);
            } else {
                ans += 2 * ((((n - i) * (m - j)) % MOD) * (i + j) % MOD);
            }
            ans %= MOD;
        }
    }
    cout << (ans * COM(n*m-2, k-2)) % MOD << endl;
}

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

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

    int ans=0;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            for(int k=0;k<=c;k++){
                if(i*500 + j*100 + k*50 == x)ans++;
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <strings.h>

int main(void)
{
    int n;
    std::cin >> n;

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

    for (int i = 0; i < n; i++) {
        if (i > 0) {
            std::cout << " ";
        }
        std::cout << a[n-i-1];
    }
    std::cout << std::endl;

    return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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 int mod=1000000007;
const int INF=1001001001;

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

Measured memory_bytes: 3640
def p_m():
    n, k = map(int, input().split())
    *a, = map(int, input().split())
    mod = 10 ** 9 + 7
    # dp[i][j]はi番目の子にj個の飴を配る方法が何通りかどうか
    dp = [[0] * (k + 1) for _ in range(n + 1)]
    for i in range(n + 1):
        dp[i][0] = 1

    for i in range(1, n + 1):
        for j in range(1, k + 1):
            if j - 1 - a[i - 1] >= 0:
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1 - a[i - 1]]) % mod
            else:
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod
    print(dp[n][k])


if __name__ == '__main__':
    p_m()


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

#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

	int x = 1, y = 1;
	for(int i = 0;i < n;i++){
		int t, a;
		cin >> t >> a;
		int tmp = (x+t-1)/t;
		if(tmp*a >= y){
			x = tmp*t;
			y = tmp*a; 
		}else{
			tmp = (y+a-1)/a;
			x = tmp*t;
			y = tmp*a;
		}
	}
	cout << x + y << endl;

	return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair <int , int> pii;
typedef pair <ll , ll> pll;

#define print(a) {for(auto xxxxx : (a)) cout << xxxxx << ' '; cout << '\n';}
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin() , (a).end()
#define rall(a) (a).rbegin() , (a).rend()

ll next(){ll x; cin >> x;return x;}
const int maxn = 2e5 + 2 , intf = 2e9;
const ll inf = 2e18 , mod = 1e9 + 7;
const ld eps = 1e-9;


void solve(){
    ll x; cin >> x;
    cout << 1000*(x / 500) + ((x % 500)/5)*5 << '\n';
}


//#define DEBUG

signed main(){
	#ifdef DEBUG
        freopen("input.txt" , "r" , stdin);
    #else
        //freopen(".in" , "r" , stdin); freopen(".out" , "w" , stdout);
        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.precision(20);
    #endif
 
    for (int t = 1; t--;) solve();
 
    #ifdef DEBUG
        cout << setprecision(3) << fixed << "\n\nRuntime: " << (long double)(clock()) / CLOCKS_PER_SEC << " s.\n";
    #endif

	return 0;
}
/*


*/



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <deque>
#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;

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

int N, K, v[201010];
double f[201010];
int main () {
    cin >> N >> K;
	rep(i,N) {
		cin >> v[i];
	}
	rep(i,N) {
		f[i] = 1.0 * (v[i] + 1)/2;
	}
	double tot = 0;
	rep(i,K) {
		tot += f[i]; 
	}
	double res = tot;
	for (int i = K; i < N; ++i) {
		tot = tot + f[i] - f[i-K];
		res = max(res, tot);
	}
	printf("%.10f\n", res);
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n-1); i >= 0; i--)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
const int IINF = 1000000000;
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; }

int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N; cin >> N;
    vector<int> L(N);
    rep(i,N) cin >> L[i];

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

    int ans = 0;
    for(int a = 0; a < N; a++){
        for(int b = a+1; b < N; b++){
            int ab = L[a]+L[b];
            int ok = 0;
            int ng = N;
            
            while(abs(ok-ng)>1){
                ll mid = (ok+ng) / 2;
                auto f = [&](ll mid){
                    return ab > L[mid]; 
                };
                if(f(mid)) ok = mid;
                else ng = mid;
            }
            int count = ok - b;
            if (count > 0 ) ans += count;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        String pattern = scanner.next();


        int[][] memo = new int[pattern.length()][13];
        int[] remTable = new int[pattern.length()];

        remTable[remTable.length - 1] = 1;

        for (int i = remTable.length - 2; i >= 0; i--) {
            remTable[i] = (remTable[i + 1] * 10) % 13;
        }

        System.out.println(run(pattern, 0, remTable, 5, memo));
    }

    private static int modValue = (int) (Math.pow(10, 9) + 7);

    private static int run(String pattern, int i, int[] remTable, int rem, int[][] memo) {
        if (i == pattern.length()) {
            return rem == 0 ? 1 : 0;
        }

        if (memo[i][rem] != 0) {
            return Math.max(0, memo[i][rem]);
        }

        int d = Character.getNumericValue(pattern.charAt(i));

        int sum = 0;

        if (d == -1) { // '?' case
            for (int j = 0; j <= 9; j++) {
                int actualRem = (j * remTable[i]) % 13;
                int newRem = rem - actualRem;
                if (newRem < 0) newRem += 13;
                sum += run(pattern, i + 1, remTable, newRem, memo);
                sum = sum % modValue;
            }
        } else {
            int actualRem = (d * remTable[i]) % 13;
            int newRem = rem - actualRem;
            if (newRem < 0) newRem += 13;
            sum += run(pattern, i + 1, remTable, newRem, memo);
            sum = sum % modValue;
        }

        if (sum == 0) {
            memo[i][rem] = -1;
        } else {
            memo[i][rem] = sum;
        }

        return sum;
    }
}


Measured memory_bytes: 50424
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
long long n,m,k;
char a[1010];
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]=='I')
		{
			m++;
		}
		if(a[i]=='D')
		{
			m--;
		}
		k=max(k,m);
	}
	cout<<k;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdlib>
#include<cstdio>

using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    if(n<=999)
        printf("ABC\n");
    else
        printf("ABD\n");
    return 0;
}


Measured memory_bytes: 256
s=input()
n=len(s)
dp=[4*[0]for i in range(n+1)]
dp[0][0]=1
for i in range(1,n+1):
  for j in range(4):
    dp[i][j]+=dp[i-1][j]*((s[i-1]=="?")*2+1)
  if s[i-1] in "A?":dp[i][1]+=dp[i-1][0]
  if s[i-1] in "B?":dp[i][2]+=dp[i-1][1]
  if s[i-1] in "C?":dp[i][3]+=dp[i-1][2]
  for j in range(4):dp[i][j]%=10**9+7
#for i in range(n+1):print(dp[i],(" "+s)[i])
print(dp[-1][-1])

Measured memory_bytes: 27604
#include <bits/stdc++.h>
using namespace std;
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define int long long
#define ll long long
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define mii  map<ll ,ll >
#define sz(a) (int)a.size()
#define msi  map<string,ll >
#define rep(a,b)    for(ll i=a;i<b;i++)
#define rep0(n)    for(ll i=0;i<n;i++)
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define r0 return 0;
#define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
#define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define Set(a, s) (a, s, sizeof (a))
#define FOR repi
#define pii pair<int,int>
#define REVERSE(v) reverse(all(v))
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define debug cerr<<"bhau"<<endl
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
template<typename T, typename U> static inline void amin(T &x, U y) 
{ 
    if (y < x) 
        x = y; 
}
template<typename T, typename U> static inline void amax(T &x, U y) 
{ 
    if (x < y) 
        x = y; 
}
 
ll max(ll a, ll b) { return (a > b)? a : b;}
int min(int a, int b) { return (a < b)? a : b;} 
int dp[200][5][2];
int vis[200][5][2];
int kk;
int n;
string s;
int fun(int p,int k,int flag){
	if(k>kk) return 0;
	if(k==kk){
		return 1;
	}
	if(p==n) return 0;
	if(vis[p][k][flag]) return dp[p][k][flag];
	int &z=dp[p][k][flag];
	vis[p][k][flag]=1;
	char c=s[p]-'0';

	for(int cur=0;cur<=9;cur++){
		int nflag=flag|(cur<c);
		int newk=k+(cur?1:0);
		if(nflag==0 && cur>c) continue;
		z+=fun(p+1,newk,nflag);
	}
	// trace(p,k,flag,z);
	return z;
}
int solve(){

	cin>>s>>kk;
	n=s.size();
	
	memset(dp,0,sizeof(dp));
	// dp[0][0][0][0]=1;
	int ans=fun(0,0,0);
	// trace(ans);
	cout<<ans;	
	// for(int i=1;i<=n;i++){
	// 	int c=s[i-1]-'0';
	// 	for(int cur=0;cur<10;cur++){
	// 		for(int j=0;j<=k;j++){
	// 			int newk=j+(cur?1:0);
	// 			if(newk>k) continue;
	// 			dp[i][newk][cur][1]=dp[i-1][j][]
	// 		}
	// 	}
	// }


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


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

int main(void){
    int n,m=0;
    //int l[n];
    int l[3000] ;
    cin >> n;
    for(int i=0;i<n;i++)
    l[i]=0;
    for(int i=0;i<n;i++) cin >> l[i];
    sort(l, l + n);
    for(int i=0;i<n;i++){
      for(int j=1;j<n-i;j++){
        for(int k=1;k<n-i-j;k++){
        if(l[i]<l[i+j]+l[i+j+k]&&l[i+j]<l[i]+l[i+j+k]&&l[i+j+k]<l[i+j]+l[i]){
            m+=1;
         }}} }
    cout << m<<endl;
    


    
    return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}
ll const N=(ll)2e5+111;
ll const LG=(ll)log2(N)+1;



void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
        cin>>n;
        string ans="";
        while(n>0){
                if(n%26==0){
                        n--;
                        ans+=('a'+n%26);
                }else{
                        ans+='a'+((n-1)%26);
                }
                n/=26;
        }
        reverse(all(ans));
        cout<<ans<<endl;
        
}       
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        while(q--){
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int) n; i++)
#define repb(i, n) for (int i = (int) n; i >= 0; i--)
#define reps(i, m, n) for (int i = (int) m; i < (int) n; i++)
#define repsb(i, m, n) for (int i = (int) m; i >= (int) n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
# define pb(a) push_back(a)
#define ll long long int
int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return 1; } return 0; }
template < class T > bool chmin(T & a,const T & b) { if (b < a) { a = b; return 1; } return 0; }
//vector<vector<int>> vec(n_rows, vector<int>(n_cols, value));
using namespace std;
int main(int argc, char const * argv[]){
    ll h, w;
    cin >> h >> w;
    ll ans = (h == 1 || w == 1) ? 1 : (h * w + 1) / 2;
    cout << ans << endl;
    return 0;
}

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

using namespace std;

const int P = 1000000007;

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

	int n;
	cin >> n;

	vector<int> a;
	a.resize(n);

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

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

	long long ans = 1;

	int cnt = 0;

	for(int i = n - 1; i > 0; i -= 2) {
		while(!a.empty() && a.back() >= i) {
			++cnt;
			a.pop_back();
		}

		ans = ans * cnt * (cnt - 1) % P;

		cnt -= 2;
	}
	
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
int L,a,b,m;
int x=0;
int gy[3][3],tmp[3][3],ans[3][3];
int pw(int n,int k){
  if(k<0)return pw(n,k+MOD-1);
  int res=1;
  while(k){
    if(k&1)res*=n;//res%=MOD;
    n*=n;//n%=MOD;
    k>>=1;
  }
  return res;
}
void toans(){
  memset(tmp,0,sizeof(tmp));
  for(int i=0;i<3;i++)
    for(int j=0;j<3;j++)
      for(int k=0;k<3;k++)
        tmp[i][j]+=gy[i][k]*ans[k][j];
  for(int i=0;i<3;i++)for(int j=0;j<3;j++)ans[i][j]=tmp[i][j]%m;
}
void gygy(){
  memset(tmp,0,sizeof(tmp));
  for(int i=0;i<3;i++)
    for(int j=0;j<3;j++)
      for(int k=0;k<3;k++)
        tmp[i][j]+=gy[i][k]*gy[k][j];
  for(int i=0;i<3;i++)for(int j=0;j<3;j++)gy[i][j]=tmp[i][j]%m;
}
void g(int n){
  int t=n;
  memset(ans,0,sizeof(ans));
  ans[0][0]=ans[1][1]=ans[2][2]=1;
  while(n){
    if(n&1)toans();
    gygy();
    n>>=1;
  }
}
void f(int n){
  int l=(pw(10,n-1)-a)/b;if((pw(10,n-1)-a)%b)l++;if((pw(10,n-1)-a)<0)l=0;
  int r=(pw(10,n)-a)/b;r--;if((pw(10,n)-a)%b)r++;if((pw(10,n)-a)<0)r=-1;
  r=min(r,L-1);l=min(l,L);
  memset(gy,0,sizeof(gy));
  gy[0][1]=gy[1][1]=gy[2][2]=1;
  gy[1][2]=b;
  gy[0][0]=pw(10,n)%m;
  g(r-l+1);
  x=(ans[0][0]*x+ans[0][1]*((a%m+b%m*l)%m)+ans[0][2])%m;
}
//main
signed main(){
  cin>>L>>a>>b>>m;
  for(int i=1;i<=18;i++)f(i);
  cout<<x<<endl;
}


/*
解説AC
多分キムチ鍋食べてた日の回
行列累乗使うってネタバレは見てたけど桁が動くから出来なくね？って思ってたけど良く考えたら桁18種類だし場合分けするだけだった
実装はそこまで詰まらずに出来たのでわりかし満足
*/


Measured memory_bytes: 256
/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

#define F first
#define S second
#define pb push_back

#define endl '\n'

const int max4 = 10004;
const int maxx = 100005;
const int max6 = 1000006;
const int lg5 = 17;

const int INF = 2 * 1000000007;
const long long INFLL = 4LL * 1000000000 * 1000000000;

/***************/

int powmod (int a, int b, int mod) {
    int res = 1; a %= mod;
    for (; b; b >>= 1) {
        if (b & 1) {
            res = 1LL * res * a % mod;
        }
        a = 1LL * a * a % mod;
    }
    return res;
}

int gcd (int a, int b) {
    while (b > 0) {
        int t = a % b;
        a = b, b = t;
    }
    return a;
}

int lcm (int a, int b) {
    return (a / gcd (a, b)) * b;
}

int is_prime (int n) {
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (int i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}

/******Don't forget to use long long when needed!!******/

long long pref[2 * maxx];
int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n;
    cin >> n; int x;
    for (int i = 1; i <= n; i++) {
        cin >> x;
        pref[i + 1] = pref[i] + x;
    }
    sort(pref + 1, pref + n + 2);
    long long res = 0;
    for (int i = 1; i <= n + 1;) {
        int j = i;
        while (j <= n + 1 && pref[i] == pref[j]) {
            j++;
        }
        res += 1LL * (j - i) * (j - i - 1) / 2;
        i = j;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;

namespace ABC169A
{
    class Program
    {
        static void Main(string[] args)
        {

            var A = RInt;
            var B = RInt;
            Console.WriteLine(A*B);

        }


    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String RNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int RInt => int.Parse(RNext());
        public static long RLong => long.Parse(RNext());
        public static int[] RInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] RLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
        public static string RString => RNext();
        //以下未テスト
        public static int[] RIntsC(int c) => Enumerable.Repeat(0, c).Select(x => int.Parse(RNext())).ToArray();
        public static long[] RLongsC(int c) => Enumerable.Repeat(0, c).Select(x => long.Parse(RNext())).ToArray();
        public static char[][] RMap(int h) => Enumerable.Repeat(0, h).Select(x => Console.ReadLine().ToCharArray()).ToArray();
    }

    static class Debug
    {
        static public void Draw2D<T>(T[,] map, int mode = 1)
        {
#if DEBUG
            int W = map.GetLength(0);
            int H = map.GetLength(1);

            string[,] map2 = new string[W + 1, H + 1];
            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (i == 0 && j == 0) map2[i, j] = 0.ToString();
                    else if (i == 0) map2[i, j] = (j - 1).ToString();
                    else if (j == 0) map2[i, j] = (i - 1).ToString();
                    else map2[i, j] = map[i - 1, j - 1].ToString();
                }
            }

            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (mode == 0) Console.Write(map2[i, j].Last());
                    if (mode == 1) Console.Write(map2[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
#endif
        }

        public static void Draw1D<T>(T[] array, int mode = 0)
        {
#if DEBUG
            Console.WriteLine(string.Join(" ", array));
#endif
        }
    }
}


Measured memory_bytes: 27824
n = int(input())
strs = ["".join(sorted(str(input()))) for _ in range(n)]

cache = {}
cnt = 0
for s in strs:
  if s in cache.keys():
    cnt = cnt + cache[s]
    cache[s] = cache[s] + 1
  else:
    cache[s] = 1
print(cnt)

Measured memory_bytes: 19400
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,c,d,e,k;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    scanf("%d",&d);
    scanf("%d",&e);
    scanf("%d",&k);
    if(e-a<=k)
        printf("Yay!");
    else
        printf(":(");
    return 0;
}

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


int main () {
  int l;
  string S;
  cin >> l >> S;
  int64_t r = 0;
  int64_t g = 0;
  int64_t b = 0;
  for (int i = 0; i < l; i++) {
    if (S.at(i) == 'R') r++;
    if (S.at(i) == 'G') g++;
    if (S.at(i) == 'B') b++;
  }
  int64_t total = r * g * b;
  int64_t x = 0;
  for (int d = 1; d <= (l - 1) / 2; d++) {
    for (int i = 0; i < l - 2 * d; i++) {
      if (S.at(i) != S.at(i + d) && S.at(i) != S.at(i + 2 * d) && S.at(i + d) != S.at(i + 2 * d)) {
        x++;
      }
    }
  }
  int64_t T = total - x;
  cout << T << endl;
}


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if (abs(c - a) <= d || (abs(b - a) <= d && abs(c - b) <= d)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

int main() {
  string O, E;
  cin >> O;
  cin >> E;
  int s, t;
  s = 0;
  t = 0;
  for(int i = 0; i < O.size() + E.size(); i++) {
    if(i % 2 == 0) { cout << O[s]; s++; }
    else { cout << E[t]; t++; }
  
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

int main(void){
  int a,b,c;
  cin >> a >> b >> c;
  if(a != b){
    if(b == c){
      cout << a << endl; return 0;
    } else {
      cout << b << endl; return 0;
    }
  } else {
    cout << c << endl; return 0;
  }

  return 0;
}

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

using namespace std;

int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    long long n,co=1;
    cin>>n;
    vector<string>v;
    while(n--)
    {
        string s;
        cin>>s;
        v.push_back(s);
    }
    sort(v.begin(),v.end());
    for(int i=1;i<v.size();i++)
    {
        if(v[i]!=v[i-1]) co++;
    }
    cout<<co;
    return 0;
}


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

using namespace std;

const int m = 1000000;
int n, h[m + 5];
bool f, g;

int main() {
    scanf("%d", &n);
    for (int i = 1, t; i <= n; i++)
        scanf("%d", &t), h[t]++;
    f = g = true;
    for (int i = 2; i <= m; i++) {
        int tot = 0;
        for (int j = i; j <= m; j += i)
            tot += h[j];
        if (tot > 1)
            f = false;
        if (tot == n)
            g = false;
    }
    if (f)
        printf("pairwise coprime");
    else if (g)
        printf("setwise coprime");
    else
        printf("not coprime");
    return 0;
}

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

const int N=1e5+9;
int n,m,par[N];
vector <int> g[N];

int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0);
    cin >> n >> m;
    for(int i=0;i<m;i++){
        int u,v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    memset(par,-1,sizeof par);
    queue <int> q;
    q.push(1),par[1]=0;
    while(!q.empty()){
        int v=q.front();
        q.pop();
        for(auto u:g[v]){
            if(par[u]!=-1)continue;
            par[u]=v;
            q.push(u);
        }
    }
    for(int i=2;i<=n;i++){
        if(par[i]==-1){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes\n";
    for(int i=2;i<=n;i++)
        cout << par[i] << '\n';
}

Measured memory_bytes: 12956
#include<iostream>

using namespace std;

int main() {
	
	int x, y;
	
	while( cin >> x >> y  ) {
		
	cout << x / y << " "
		 << x % y << " "
		 << fixed << (double)x / y << " \n";
	
	}
		
	return 0;
}


Measured memory_bytes: 3252
#include <bits/stdc++.h>
using namespace std;
int a[1024];
bool b[10010];
int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; ++ i) {
        scanf("%d", &a[i]);
    }
    for (int i = 0; i < n; ++ i) {
        int tmp = 0;
        for (int j = i; j < n && j - i < 4; ++ j) {
            tmp = tmp * 10 + a[j];
            b[tmp] = true;
        }
    }
    for (int i = 0; i < 10000; ++ i) {
        if (!b[i]) {
            printf("%d\n", i);
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3232
#include "bits/stdc++.h"
using namespace std;

int main(){

	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif

	ios::sync_with_stdio(false),cin.tie(0);

	int n; cin >> n;

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

	sort(a,a+n);

	long long ans = a[n-1];

	int tt = n-2;
	int ind = n-2;
	bool first = true;

	while(tt>0){
		ans += a[ind];
		if(!first){
			ind--;
		}
		first = !first;
		tt--;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4440
import sys
readline = sys.stdin.readline

def root(x):
    if uf[x] == x:
        return x
    else:
        uf[x] = root(uf[x])
        return uf[x]

def same(x, y):
    return root(x) == root(y)

def unite(x, y):
    rx = root(x)
    ry = root(y)
    if rx == ry:
        return
    uf[rx] = ry

N, M = map(int,readline().split())
p = list(map(int,readline().split()))
p.insert(0, -1)
uf = [i for i in range(N+1)]
for i in range(M):
    a, b = (map(int,readline().split()))
    unite(a, b)
for i in range(1, N+1):
    root(i)

ans = 0
#戒めコード
#N += 1
#match = [[] for i in range(N)]
#for i in range(1, N):
#    match[uf[i]].append(i)
#for i in range(1, N):
#    matchlen = len(match[i])
#    for j in range(matchlen):
#        if p[match[i][j]] in match[i]:
#            ans += 1

for i in range(1, N+1):
    if same(i, p[i]):
        ans += 1
print(str(ans))

#root(i)=root(j)ならばiとjは行き来できる(iはjの居る場所に到達できる)
#知りたいのはiがp[i]のいる位置に来れるかどうか
#root(i)=root(p[i])なら,iはp[i]の位置に来れる,すなわちi番目にiを持ってくることができる

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

int main(){
  int n;
  char card;
  while(1){
    cin >> n;
    if(n == 0) break;
    int cou=0,ba=0;
    int now[11]={0};
    for(int i=0;i<100;i++){
      cin >> card;
      if(card == 'M'){
	now[cou]++;
      }
      else if(card == 'L'){
	now[cou] += ba + 1;
	ba=0;
      }
      else{
	ba += now[cou]+1;
	now[cou] = 0;
      }
      cou++;
      if(cou == n){
	cou = 0;
      }
    }
    sort(now,now+n);
    for(int i=0;i<n;i++){
      cout << now[i] << " ";
    }
    cout << ba << endl;
  }
}

Measured memory_bytes: 1184
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int sum = 0;

        for (int i=1; i<=k; i++) {
            for (int j=1; j<=k; j++) {
                for (int l=1; l<=k; l++) {
                    sum += gcd(gcd(i, j), l);
                }
            }
        }

        System.out.println(sum);
    }

    public static int gcd(int num1, int num2) {
        if (num2 == 0) return num1;
        return gcd(num2, num1 % num2);
    }
}


Measured memory_bytes: 35796
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<string,int>> vpsi;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
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 int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a,   b) * b;}

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

int a,b;
cin >> a >> b;
fin(lcm(a,b));

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val w = sc.next
    println(w.distinct.foldLeft("Yes") {
      (acc, s) => {
        if (acc == "No") acc
        else {
          if (w.count(_ == s) % 2 == 0) "Yes"
          else "No"
        }
      }
    })
  }
}


Measured memory_bytes: 27428
var a = require('fs').readFileSync('/dev/stdin', 'utf8');
var b = a.split(' ').map(Number);
var W = b[0];
var H = b[1];
var x = b[2];
var y = b[3];
var r = b[4];
if((x-r) >= 0 && (y-r) >= 0 && (x+r) <= W && (y+r) <= H){
    console.log('Yes');
}else{
    console.log('No');
}


Measured memory_bytes: 15112
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define endl "\n"
typedef long long ll;
#define traceV(v) for(auto x:v)cout<<x<<" ";cout<<endl
#define traceM(mp) for(auto x:mp)cout<<x.first<<" "<<x.second<<endl
#define MOD 1000000007

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

  double L; cin>>L;
  double l = L/3;

  double res = l*l*l;
  cout << fixed << setprecision(12) << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <math.h>
#include <list>
using namespace std;

int main()
{
  int a1,a2,a3; cin >> a1 >> a2 >> a3;
  
  int ans11 = abs(a2-a1)+abs(a3-a2) , ans12 = abs(a3-a1)+abs(a3-a2);
  int ans21 = abs(a2-a1) + abs(a1-a3) , ans22 = abs(a2-a3) + abs(a3-a1);
  int ans31 = abs(a3-a1) + abs(a3-a2) , ans32 = abs(a3-a2) + abs(a2 - a1);
  
  int ans = min(ans11,min(ans12,min(ans21,min(ans22,min(ans31,ans32)))));
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;  
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define Rep(i, a, b) for(ll i = a; i <= b; i++)
#define repr(i, a, b) for(ll i = b-1; i >= a; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
// const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

////////////////////////////////////////////////////////

int main() {
    string s; cin >> s;
    ll a = 0;
    rep(i, 0, sz(s)){
        a += s[i] - '0';
        a %= 9;
    }

    if(a == 0) co("Yes");
    else co("No");

    return 0;
}
 
 


Measured memory_bytes: 3756
# editorial参照
# 格子まで詰め込もうとしたのが困難
# 十分大きい黒白の塊一つに孤立した白黒の点を取る


a,b = map(int, input().split( ))
k=50
W = [["."]*(k*2) for i in range(k)] 
B = [["#"]*(k*2) for i in range(k)]
for i in range(b-1):
    h = (i//k)*2
    w = (i%k)*2
    W[h][w]="#"



for i in range(a-1):
    h = (i//k)*2+1
    w = (i%k)*2+1
    B[-h][-w]="."
    
ans = [''.join(W[i]) for i in range(k)]+ [''.join(B[i]) for i in range(k)]
print(100,100)
print('\n'.join(ans))


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
#define lambda(RES_TYPE, ...) (function<RES_TYPE(__VA_ARGS__)>)[&](__VA_ARGS__) -> RES_TYPE
#define method(FUNC_NAME, RES_TYPE, ...) function<RES_TYPE(__VA_ARGS__)> FUNC_NAME = lambda(RES_TYPE, __VA_ARGS__)
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

int main(){
  int q = in();
  map<string,int> m;
  rep(_,q){
    int kind = in();
    if(kind==0){
      string key = in<string>();
      int x = in();
      m[key] = x;
    }else if(kind==1){
      string key = in<string>();
      cout << m[key] << endl;
    }
  }
}



Measured memory_bytes: 27824
from collections import defaultdict


count = defaultdict(int)
n = int(input())
for _ in range(n):
    s = input()
    count[s] += 1

m = int(input())
for _ in range(m):
    s = input()
    count[s] -= 1

ans = [num for num in count.values()] + [0]
print(max(ans))

Measured memory_bytes: 3316
N = int(input())
s = list(input())
count = [0] * N

for i in range(1,N):
    # print(s[0:i], s[i:N])
    left = set(s[0:i])
    right = set(s[i:N])
    count[i] = len(left & right)
print(max(count))

Measured memory_bytes: 3060
#include <stdio.h>

int main(void){
	
	int A,B,T,count=0;
	
	scanf("%d",&A);
	scanf("%d",&B);
	scanf("%d",&T);
	
	while(A<=T){
		count+=B;
		T-=A;
	}
	
	printf("%d",count);
	
	return 0;
}

Measured memory_bytes: 128