akhauriyash/Code-Regression huggingface dataset:
#! /usr/bin/env python
# -*- coding: utf-8 -*-

def rec(y, x, used, TILE):
    if (not(0<=x<W)) or (not(0<=y<H)) or (TILE[y][x]==0) or (used[y][x]==1):
        return 0
    else:
        used[y][x] = 1
        rec(y-1, x-1, used, TILE)
        rec(y-1, x, used, TILE)
        rec(y-1, x+1, used, TILE)
        rec(y, x-1, used, TILE)
        rec(y, x, used, TILE)
        rec(y, x+1, used, TILE)
        rec(y+1, x-1, used, TILE)
        rec(y+1, x, used, TILE)
        rec(y+1, x+1, used, TILE)
    return 1

(W, H) = map(int, raw_input().split())
while W!=0 :
    used = [[0]*W for i in range(H)]
    TILE = []
    stack = []
    for i in range(H):
        TILE.append(map(int, raw_input().split()))
    Sum = 0
    for i in range(H):
        for j in range(W):
            if used[i][j] == 0 and TILE[i][j] == 1:
                Sum += 1
                stack.append([i, j])
                while len(stack)>0:
                    cur = stack[len(stack)-1]
                    stack.pop()
                    for y in [-1, 0, 1]:
                        for x in [-1, 0, 1]:
                            if 0<=cur[0]+y<H and 0<=cur[1]+x<W and TILE[cur[0]+y][cur[1]+x]==1 \
                                    and used[cur[0]+y][cur[1]+x]==0:
                                stack.append([cur[0]+y, cur[1]+x])
                                used[cur[0]+y][cur[1]+x] = 1

    """for i in range(H):
        for j in range(W):
            if used[i][j] == 0 and TILE[i][j] == 1:
                Sum += rec(i, j, used, TILE)
    print Sum"""
    print Sum
    #print used.count(1)

    (W, H) = map(int, raw_input().split())

Measured memory_bytes: 4408
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>
#include<stack>
#include<set>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 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; }

#define keta setprecision(15) //15桁表示

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

	string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<s.size()/2;i++)
    {
        if(s[i]!=s[s.size()-1-i])
        {
            ans++;
        }
    }
    cout<<ans<<endl;
	return 0;
}

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

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C){
    if((A+B)>= C) cout << YES << endl;
    else cout << NO << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    solve(A, B, C);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
inline int read()
{
	int ret=0; char c=getchar();
	while(c<48||c>57)c=getchar();
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	return ret;
}
int ans,t;
long long i,a,b,u,c,d,e,f,g,h;
int main()
{
//	freopen("3.in","r",stdin);
//	freopen("4.out","w",stdout);
	t=read();
	while(t--){
		a=read(); b=read();
		if(a<b)swap(a,b);
		u=(a*b-1)/(b+1);
		if(u<=b+1)ans=u; else
		{
 
		h=u+b+1;
		if((h/2*(h-h/2))<=a*b-1)ans=u;else{
//			g=sqrt(a*b-0.9);


//tepan//da xiao// 0 1 2 ... //
            g=sqrtl((long double)a*b-0.9);
            //sqrt
            //(long double)
			
//二分套三分 

			ans=min(u-g+1,g-(b+1)+1);
			if(u-g+1>g-(b+1)+1 && g*(g+1)<=a*b-1)++ans;
            
//            int v=b+1;
//            for(long long i=u; i>=g; --i){
//            	if(i*v<=a*b-1)
//            	{
//            	    ++ans;
//            	    ++v;
//            	    if(v==292703660)
//					int hh=0; 
//                }
//			}
            
			ans+=g-1;
		}
		
	    }
		ans+=b-1;
		printf("%d\n",ans);
	} 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <stack>
#include <bitset>
#include <utility>
// #include <numeric>
using namespace std;



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector<vector<ll>> vvint;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define INT_MAX 2147483647
#define LLONG_MAX 9223372036854775807
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())


typedef struct{
  ll pos;
  ll depth;
} data;
//
// struct Node{
//
// }



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

// ll X,Y,Z,K;
// ll pmax = 30000000000;
// vint A,B,C;




// int binary_search(int key){
//  //isOKを満たす要素のうち最小のインデックスを返す。（要ソート）
//   int left = -1;
//   int right = N;
//
//   while(right - left > 1){
//     int mid = left + (right - left)/2;
//
//     if(isOK(mid, key)) right=mid;
//     else left=mid;
//   }
//
//   return right;
// }

// ll gcd(ll m, ll n){
//   if(m<n) swap(m,n);
//   if(n==0) return m;
//   return gcd(n, m%n);
// }



vint dp;
vvint path;

void set_path(ll node_index){
  if(dp[node_index]!=-1) return;
  if(path[node_index].size()==0) dp[node_index]=0;

  ll max_path = 0;

  for(ll i : path[node_index]){
    // if(dp[i]==-1){
    //   set_path(i);
    // }
    set_path(i);
    max_path = max(dp[i]+1, max_path);
  }

  dp[node_index] = max_path;
  return;

}

int main() {

  ll N,M;
  cin>>N>>M;

  dp.resize(N, -1);
  path.resize(N, vint());

  vint x(M),y(M);
  rep(i,M){
    cin>>x[i]>>y[i];
    path[x[i]-1].pb(y[i]-1);
  }

  rep(i, N){
    set_path(i);
  }

  // cout << dp[0] << endl;
  ll ans = vmax(dp);
  cout << ans << endl;

}

















//


Measured memory_bytes: 10112
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
 
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
int n,m,x,b;
b= 0;
ll ans,y;
cin>>n>>m>>x;
vector<ll> vec(m+1);
vector<ll> keep(m+1);
ans=10000000;
ll no[n][m+1];
fr(i,n){
  fr(l,m+1){
    cin>>no[i][l];
  }
}
y=pow(2,n);
for (int bit = 0; bit < y+1; ++bit){
b=1;
vec = keep;
fr(i,n){
if (bit & (1<<i)){
fr(l,m+1){
vec[l] += no[i][l];
}
}
}
Fr(i,m){
if(vec[i] < x){
b = 0;
}
}
if(b==1){
ans = min(ans,vec[0]);
}
}
if(ans==10000000){
cout<<-1;
}
else{
cout<<ans;
}
}

Measured memory_bytes: 4088
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


ll gcd(ll a,ll b){
    if(b == 0){
        return a;
    }else{
        return gcd(b, a%b);
    }
}

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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    string s;
    cin>>s;
    if(s == "ABC"){
        cout<<"ARC"<<endl;
    }else{
        cout<<"ABC"<<endl;
    }
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

// B解答例
int main() {
    int a,b,c,d; cin >> a >> b >> c >> d;
    /*
    2人ともスイッチを押している状況を考える．
    max(a,c)秒からmin(b,d)秒までの間，スイッチを押している．
    max(a,c) > min(b,d)となる場合は0
    これらのうち大きいほうを出力
    */
    cout << max(0, min(b,d)-max(a,c)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i=0;i<n;i++)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (b>a) { 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; }
//const long long INF = 2LL << 60;
using ll = long long;
using P = pair<ll, ll>;
int main(int argc, char const *argv[]){
    ll a, b, v, w, t;
    cin >> a >> v >> b >> w >> t;
    if(w>=v){
        cout << "NO" << endl;
        return 0;
    }
    if(t>=abs(a-b)/(double)abs(v-w)){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}




Measured memory_bytes: 3612
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A=sc.nextInt();
		String op = sc.next();
		int B=sc.nextInt();//入力する順番はA　演算子　B
		
		int ans = A+B;
		if(op.equals("-")){
			ans = A-B;
		}
		System.out.println(ans);
	}	
}

Measured memory_bytes: 23124
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
 	
		int N = sc.nextInt();

		int a[] = new int[N];
		long sum[] = new long[N];
		
		a[0] = sc.nextInt();
		sum[0] = a[0];

		for(int i=1;i<N;i++){
			a[i] = sc.nextInt();
			sum[i] = sum[i-1] + a[i];
		}

		int rcut1 = 0;
		int rcut3 = 2;
		long rdiff = Long.MAX_VALUE;

		for(int cut2=1;cut2 < N-2;cut2++){

			long dev1diff = Long.MAX_VALUE;

			for(int cut1 = rcut1;cut1 < cut2;cut1++){

				long diff = Math.abs(sum[cut1] - (sum[cut2] - sum[cut1]));

				if(dev1diff >= diff) {
					dev1diff = diff;
					rcut1 = cut1;
				} else {
					break;
				}
			}
			

			long dev2diff = Long.MAX_VALUE;
			
			for(int cut3 = cut2 + 1 < rcut3 ? rcut3 : cut2 + 1;cut3 < N-1;cut3++){

				long diff = Math.abs((sum[cut3] - sum[cut2]) - (sum[N-1] - sum[cut3]));

				if(dev2diff >= diff){
					dev2diff = diff;
					rcut3 = cut3;
				}else{
					break;
				}
			}

			long max = Math.max(Math.max(sum[rcut1],sum[cut2] - sum[rcut1]),Math.max(sum[rcut3] - sum[cut2],sum[N-1] - sum[rcut3]));
			long min = Math.min(Math.min(sum[rcut1],sum[cut2] - sum[rcut1]),Math.min(sum[rcut3] - sum[cut2],sum[N-1] - sum[rcut3]));
			rdiff = rdiff < max - min?rdiff:max-min;

		}

		System.out.println(rdiff);

	}
 
}

Measured memory_bytes: 85020
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

ll N;

int main() {

	scanf("%lld", &N);

	printf("%lld\n", N * (N - 1) / 2);

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,a[100005],pre[100005],bk[100005];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    pre[1]=a[1];
    bk[n]=a[n];
    for(int i=2;i<=n;i++)
        pre[i]=__gcd(pre[i-1],a[i]);
    for(int i=n-1;i>=1;i--)
        bk[i]=__gcd(bk[i+1],a[i]);
    int ans=pre[n];
    for(int i=2;i<n;i++)
        ans=max(ans,__gcd(pre[i-1],bk[i+1]));
    ans=max(ans,pre[n-1]);
    ans=max(ans,bk[2]);
    printf("%d\n",ans);
}


Measured memory_bytes: 1408
h,w=map(int,input().split())
a=[]
for i in range(h):
  temp=list(map(str,input()))
  a.append(temp)
temph=[]
tempw=[]
for i in range(h):
  for j in range(w):
    if a[i][j]!=".":
      break
  else:
    temph.append(i)
for i in range(w):
  for j in range(h):
    if a[j][i]!=".":
      break
  else:
    tempw.append(i)
import numpy as np
tempnp=np.array(a)
for i in range(len(temph)):
  tempnp=np.delete(tempnp, temph[i]-i, 0)
for i in range(len(tempw)):
  tempnp=np.delete(tempnp, tempw[i]-i, 1)
for i in range(h-len(temph)):
  print("".join(tempnp[i]))

Measured memory_bytes: 12484
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
typedef long long ll;
int main(){
	ll n,d;
	cin>>n>>d;
	d=d*d;
	int sum=0;
	for(int i=1;i<=n;i++){
		ll x,y;
		cin>>x>>y;
		if(x*x+y*y<=d)sum++;
	}	
	cout<<sum<<endl;
} 


Measured memory_bytes: 3636
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize, k: usize,
        a: [usize; n],
    }

    let mut dp = vec![vec![2; 2]; k + 1];
    for i in 0..k + 1 {
        for j in 0..2 {
            if dp[i][j] != 2 {
                continue;
            }
            dp[i][j] = 1 - j;
            for &ai in &a {
                if i >= ai && dp[i - ai][1 - j] == j {
                    dp[i][j] = j;
                    break;
                }
            }
        }
    }
    println!("{}", if dp[k][0] == 0 { "First" } else { "Second" });
}


Measured memory_bytes: 8444
// AtCoder Beginner Contest 127 - Problem B: Algae (https://abc127.contest.atcoder.jp/tasks/abc127_b?lang=en) 
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

vector<ll> solve(ll r, ll D, ll x2000)
{
    vector<ll> ans;
    ll x = x2000;

    for (int i = 1; i <= 10; ++i)
    {
        x = r*x - D;
        ans.push_back(x);
    }

    return ans;
}

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

    ll r, D, x2000;
    cin >> r >> D >> x2000;

    auto ans = solve(r, D, x2000);

    for (auto x : ans)
        cout << x << '\n';

    return 0;
}


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

int main()
{
  vector<int> v(12);

  for(int i = 0; i < 12; i++) cin >> v[i];

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

  int cnt = 0;

  if(v[0] == v[3] && v[4] == v[7] && v[8] == v[11]) cout << "yes" << endl;
  else cout << "no" << endl;

  return 0;

}



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

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()

typedef long long ll;

const char nl = '\n' ;


int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);
   int ans = 0;
   string s; cin >> s;
   int pos1, pos2;
   for(int i = 0; i < s.size(); i++)
   {
      if(s[i] == 'A')
      {
         pos1 = i;
         break;
      }
   }

   for(int i = s.size() - 1; i >= 0; i--)
   {
      if(s[i] == 'Z')
      {
         pos2 = i;
         break;
      }
   }
   cout << pos2 - pos1 +1 << nl;
}


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

class Program {
  static void Main() {
    Enumerable.Range(1, 9)
      .SelectMany(x => Enumerable.Range(1, 9)
      .Select(y => string.Format("{0}x{1}={2}", x, y, x * y)))
      .ToList().ForEach(Console.WriteLine);
  }
}


Measured memory_bytes: 14312
#include <assert.h>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>

using namespace std;
using ll = long long;
using ull = unsigned long long;

int main() {
    // make io faster https://gist.github.com/rigibun/7905920
	cin.tie(0);
   	ios::sync_with_stdio(false);
    const auto endl = "\n";

    ll x, a, b;
    cin >> x >>  a >> b;
    x -= a;
    x %= b;

    cout << x << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

const int MN = 531441, MM = 200005;

int N, M, c;
char T[MM];
int A[MN], B[MN], V[MM];

int main() {
	scanf("%d%s", &N, T + 1), M = strlen(T + 1), c = 1;
	for (int i = 1; i <= M; ++i) V[i] = 0;
	for (int i = 1; i <= N; ++i, c *= 3) {
		int rev = 0;
		for (int j = 0; j < c; ++j)
			for (int d = 0; d < 3; ++d)
				B[j + d * c] = d;
		for (int j = 1; j <= M; ++j) {
			if (T[j] == 'R') {
				int lst = V[j];
				for (int d = 0; d < 3; ++d) {
					int p = lst + d * c;
					if (B[p] + rev == 2) V[j] = p;
					B[p] = (B[p] + rev + 1) % 3;
				}
			} else rev ^= 1;
		}
		for (int j = 0; j < c; ++j) {
			int a = A[j];
			for (int d = 0; d < 3; ++d) {
				int p = j + d * c;
				A[p] = a + (rev ? 3 - B[p] : B[p]) % 3 * c;
			}
		}
	}
	for (int i = 0; i < c; ++i) printf("%d%c", A[i], " \n"[i == c - 1]);
	return 0;
}

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

N, M = map(int, input().split())
bridge_m = [list(map(int, input().split())) for _ in range(M)]

class UnionFind():
    def __init__(self, n):
        self.node = [-1] * n
    
    def is_root(self, nid):
        return self.node[nid] < 0

    def find(self, nid):
        # find group id
        if self.is_root(nid):
            return nid
        else:
            self.node[nid] = self.find(self.node[nid])
            return self.node[nid]

    def is_same_group(self, nid1, nid2):
        return self.find(nid1) == self.find(nid2)

    def size(self, nid):
        return - self.node[self.find(nid)]

    def union(self, nid1, nid2):
        if self.is_same_group(nid1, nid2):
            return

        g1 = self.find(nid1)
        g2 = self.find(nid2)
        if self.size(g1) < self.size(g2):
            self.node[g2] -= self.size(g1)
            self.node[g1] = g2
        else:
            self.node[g1] -= self.size(g2)
            self.node[g2] = g1

uf = UnionFind(N + 1)
ans = [0] * M
ans[M - 1] = int(N * (N - 1) / 2)
g_num = 0
for i in range(M - 1, 0, -1):
    a = bridge_m[i][0]
    b = bridge_m[i][1]

    if uf.is_same_group(a, b):
        ans[i - 1] = ans[i]
    else:
        ans[i - 1] = ans[i] - uf.size(a) * uf.size(b)
        uf.union(a, b)

print('\n'.join(map(str, ans)))



    

Measured memory_bytes: 40472
#include <stdio.h>

int main (void){
	int D;
	scanf("%d",&D);
	if (D==25) printf("Christmas");
	 else if (D==24) printf("Christmas Eve");
		else if (D==23) printf("Christmas Eve Eve");
			else if (D==22) printf("Christmas Eve Eve Eve");
				else return 0;
	return 0;
	
}

Measured memory_bytes: 128
#include <stdio.h>
#include <math.h>

int main()
{
    long long z=0, a[5], n, i, m;
    scanf("%lld",&n);
    for(i=0;i<5;i++)
    {
        scanf("%lld",&a[i]);
    }
    m=a[0];
    for(i=1;i<5;i++)
    {
        if(a[i]<m)
            m=a[i];
    }
    z=(n)/m+4;
    if(n%m==0)
        ;
    else
        z=z+1;
    printf("%lld\n",z);
    return 0;
}


Measured memory_bytes: 128
#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 gcd (int a, int b )
{
	if (a < b ) swap (a, b );
	if (a % b == 0 ){ return b; }
	return gcd (b, a%b );
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.GCD_and_LCM", "r", stdin );
	string str = "";
	while (getline (cin, str ) ){
		stringstream ss (str );
		int a, b;
		ss >> a >> b;
		int g = gcd (a, b );
		int l = a/g;
		l *= b;
		printf ("%d %d\n", g, l );
	} // end loop
		
	return 0;
}

Measured memory_bytes: 1232
n = int(input())
if 1 <= n <= 9:
	print(n)
elif 10 <= n <= 99:
	print(9)
elif 100 <= n <= 999:
	print(9 + n - 99)
elif 1000 <= n <= 9999:
	print(909)
elif 10000 <= n <= 99999:
	print(909 + n - 9999)
elif n == 100000:
	print(90909)

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

/*
例えば2 3 1 4をそれぞれ1 2 3 4で割り、割った余りの総和の最大値を計算する
2 3 4 ... n-1 n 1とすると、余りの総和は1+2+...+(n-1)となり、これが最大？
*/

void solve(){
    ll n;
    cin >> n;
    cout << (n*(n-1))/2 << endl;
}

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


Measured memory_bytes: 256
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

def ss?(s)
  n=s.size/2
  return true if s[..n-1]==s[n..]
  return false
end
s=get_nsp
s.pop
s.pop
until ss?(s)
  s.pop
  s.pop
end
puts s.size

Measured memory_bytes: 14348
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 101

void initialize(void);
void push(int);
int pop(void);
int isEmpty(void);
int isFull(void);

int S[MAX];
int top;

int main(){
  char s[100];
  int a, b, x;
  int i;

  while(scanf("%s", s) != EOF){
    
    if(s[0] == '+'){
      a = pop();
      b = pop();
      x = b + a;
      
      push(x);
    }

    else if(s[0] == '-'){
      a = pop();
      b = pop();
      x = b - a;

      push(x);      
    }

    else if(s[0] == '*'){
      a = pop();
      b = pop();
      x = b * a;
      
      push(x);
    }

    else {
      push(atoi(s));
    }
  }

  printf("%d\n", pop());
  
  return 0;
}


void initialize(void){
  top = 0;
}

void push(int x){
  if(isFull() == 1){
    printf("error(1)\n");
    exit(1);
  }
  
  top++;
  
  S[top] = x;
}

int pop(void){
  if(isEmpty() == 1){
    printf("error(2)\n");
    exit(2);
  }
  
  top--;

  return S[top + 1];
}

int isEmpty(void){
  int sta = 0;

  if(top == 0) sta = 1;

  return sta;
}

int isFull(void){
  int sta = 0;

  if(top >= MAX - 1) sta = 1;

  return sta;
}




Measured memory_bytes: 2104
#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 h,w;
    cin>>h>>w;
    string S[h];
    rep(i,0,h)cin>>S[i];
    vvi r(h,vi(w,0));
    vvi l(h,vi(w,0));
    vvi u(h,vi(w,0));
    vvi d(h,vi(w,0));
    rep(i,0,h){
        irep(j,0,w){
            if(j==w-1){
                if(S[i][j]=='.')r[i][j]=1;
            }
            else{
                if(S[i][j]=='.')r[i][j]=r[i][j+1]+1;
            }
        }
    }
    rep(i,0,h){
        rep(j,0,w){
            if(j==0){
                if(S[i][j]=='.')l[i][j]=1;
            }
            else{
                if(S[i][j]=='.')l[i][j]=l[i][j-1]+1;
            }
        }
    }
    rep(j,0,w){
        irep(i,0,h){
            if(i==h-1){
                if(S[i][j]=='.')d[i][j]=1;
            }
            else{
                if(S[i][j]=='.')d[i][j]=d[i+1][j]+1;
            }
        }
    }
    rep(j,0,w){
        rep(i,0,h){
            if(i==0){
                if(S[i][j]=='.')u[i][j]=1;
            }
            else{
                if(S[i][j]=='.')u[i][j]=u[i-1][j]+1;
            }
        }
    }
    int res=0;
    rep(i,0,h){
        rep(j,0,w){
            chmax(res,max(r[i][j]+l[i][j]+d[i][j]+u[i][j]-3,0));
        }
    }
    cout<<res<<endl;
    return 0;
}




Measured memory_bytes: 67200
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <numeric>
#include <string>
#include <functional>

using namespace std;

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

int main(void){
    string S;
    cin>>S;
    string ans[3];
    ans[0]="Sunny";
    ans[1]="Cloudy";
    ans[2]="Rainy";
    int a=0;
    rep(i,3){
        if(S==ans[i]){
            a=(i+1)%3;
            break;
        }
    }
    cout<<ans[a]<<endl;
    return 0;
}

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

int main(){
  int i,n,N,A[100],flag = 1,sum = 0;

  scanf("%d",&N);
  if(N < 1 || N > 100) exit(1);

  for(i = 0;i < N;i++){
    scanf("%d",&A[i]);
    if(A[i] < 0 || A[i] > 100) exit(2);
  }

  while(flag){
    flag = 0;
    for(i = N - 1;i > 0;i--){
      if(A[i] < A[i - 1]){
	n = A[i];
	A[i] = A[i - 1];
	A[i - 1] = n;
	sum++;
	flag = 1;
      }
    }
  }
  
  for(i = 0;i < N;i++){
    if(i == 0) printf("%d",A[i]);
    else printf(" %d",A[i]);
  }

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

  return 0;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define res(n) resize(n)
#define rev(v) reverse(v.begin(),v.end())
#define sor(v) sort(v.begin(),v.end())
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pq priority_queue
#define vi vector<int>
#define vl vector<long long>
#define vii vector<vector<int>>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;



int main()
{
    int N,K,S;cin >> N >> K >> S;

    
    
    rep(i,K){
        cout << S << " ";
        if(i == N-1) cout << endl;
    }
    rep(i,N-K){
        if(S == 1000000000) cout << 1 << " ";
        else cout << S+1 << " ";
        if(i==N-K-1) cout << endl;
    }
    


    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <string.h>

using namespace std;

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

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  char s[100000];
  scanf("%s", s);
  int N = strlen(s);

  REP(a, N) {
    if (a+1 < N && s[a] == s[a+1]) {
      printf("%d %d\n", a+1, a+2);
      return 0;
    } else if (a+2 < N && s[a] == s[a+2]) {
      printf("%d %d\n", a+1, a+3);
      return 0;
    }
  }
  printf("-1 -1\n");

  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
 
struct dice{
           int a[6];
       };
struct dice dice1;
struct dice dice2;
 
void tate(){
            int cmp=dice2.a[0];
            dice2.a[0]=dice2.a[4];
            dice2.a[4]=dice2.a[5];
            dice2.a[5]=dice2.a[1];
            dice2.a[1]=cmp;
             }
void yoko(){
            int cmp=dice2.a[1];
            dice2.a[1]=dice2.a[2];
            dice2.a[2]=dice2.a[4];
            dice2.a[4]=dice2.a[3];
            dice2.a[3]=cmp;
             }
 
 
int main(){
    int i,j;
    for(i=0;i<6;i++){
           scanf("%d",&dice1.a[i]);
                     }
for(i=0;i<6;i++){
           scanf("%d",&dice2.a[i]);
                     }
 
for(i=0;i<5;i++){
 
              for(j=0;j<5;j++){
                              if(dice1.a[0]==dice2.a[0])break;
                               tate();
                               }
              for(j=0;j<5;j++){
                                if(dice1.a[1]==dice2.a[1])break;
                                yoko();
                                }
                  }
 
if(dice1.a[0]==dice2.a[0]&&dice1.a[1]==dice2.a[1]&&dice1.a[2]==dice2.a[2])printf("Yes\n");
else printf("No\n");
  
return 0;
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  ll N,M,X,count=0,answer=0;
  cin>>N>>M>>X;
  vector<vector<ll>> vec(N,vector<ll>(M+1));
  for(ll i=0;i<N;i++){
    for(ll j=0;j<=M;j++){
      cin>>vec.at(i).at(j);
    }
    answer+=vec.at(i).at(0);
  }
  for(ll bit=0;bit<(1<<N);bit++){
    ll price=0;
    vector<ll> ans(M);
    for(ll i=0;i<N;++i){
      if(bit&(1<<i)){
        for(ll j=0;j<M;j++){
          ans.at(j)+=vec.at(i).at(j+1);
        }
        price+=vec.at(i).at(0);
      }
    }
    for(ll i=0;i<M;i++){
      if(ans.at(i)<X){count++;break;}
      if(i==M-1){if(answer>price){answer=price;}}
      ans.at(i)=0;
    }
  }
  if(count==1<<N){cout<<-1<<endl;return 0;}
  cout<<answer<<endl;
}

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

#define ll long long int
int main(){
	
	 ll a,b,c;
	 
	 cin>>a>>b>>c;
	 
	 ll m=max(a,max(b,c));
	 if(m==a)cout<<0.5*b*c;
	  if(m==b)cout<<0.5*c*a;
	  else cout<<0.5*a*b;
	  
	
	
}

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

using namespace std;


string s;

int counting(char c) { 
    int counter = 0;
    for(int i = 0; i < s.size(); i++) { 
        if(s[i] == c) {
            counter++;
        }
    }    
    return counter;
}

int main() {
    cin >> s;
    int n = s.size();
    if(n == 1) {
        puts("YES");
        return 0;
    }
    int a = counting('a');
    int b = counting('b');
    int c = counting('c');
    int diff1 = abs(a - b);
    int diff2 = abs(b - c);
    int diff3 = abs(a - c);
    if(diff1 > 1 || diff2 > 1 || diff3 > 1) {
        puts("NO");
    } else {
        puts("YES");
    }
    return 0;
}

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

int main() {
	int n,i;
	cin>>n;
	for(i=0;i<=n;i+=7)
	  {
	     if((n-i)%4==0)
	       {
	       	cout<<"Yes"<<'\n';
	       	return 0;
	       }
	  }
	cout<<"No"<<'\n';  
	return 0;
}

Measured memory_bytes: 256
n,m,l=map(int,input().split())
A=[]
for i in range(n):
    *Ai,=map(int,input().split())
    A.append(Ai)
B=[]
for i in range(m):
    *Bi,=map(int,input().split())
    B.append(Bi)
for i in range(n):
    Ci=[sum([A[i][j]*B[j][k] for j in range(m)]) for k in range(l)]
    print(*Ci)


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

using namespace std;
#define ll long long
#define ld long double

int grid[8][2];
int n;

double dist(int x1, int y1, int x2, int y2) {
    return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2) * 1.0);
}

double bfs(int idx, int x, int y, bool vis[]) {
    double res = 0;
    queue<pair<int, int> > que;
    que.push(pair<int, int>(x, y));
    vis[idx] = true;
    while(que.size()) {
        int nextX, nextY;
        pair<int, int> neighbor;
        neighbor = que.front();
        nextX = neighbor.first;
        nextY = neighbor.second;
        que.pop();
        for(int i=0;i<n;i++) {
            if(!vis[i]) {
                que.push(pair<int, int>(grid[i][0], grid[i][1]));
                vis[i] = true;
            }
        }
        res += dist(x, y, nextX, nextY);
    }
    return res;
}

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    cin >> n;
    for(int i=0;i<n;i++) {
        int x, y;
        cin >> x >> y;
        grid[i][0] = x;
        grid[i][1] = y;
    }
    double ans = 0;
    for(int i=0;i<n;i++) {
        bool vis[n];
        for(int j=0;j<n;j++) vis[j] = false;
        ans += bfs(i, grid[i][0], grid[i][1], vis);
    }
    printf("%.6f\n", ans / n);
    return 0;
}


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

using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;
//const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  vector< int64 > A(N);
  cin >> A;
  for(int i = 0; i < N; i++) {
    if(A[i] == 0) {
      cout << 0 << "\n";
      exit(0);
    }
  }
  __int128_t ret = 1, lim = 1000000000000000000;
  for(int i = 0; i < N; i++) {
    ret *= A[i];
    if(ret > lim) {
      cout << -1 << "\n";
      exit(0);
    }
  }
  cout << (int64) ret << "\n";
}




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

int main () {
  vector<int> check(26) ;
  string a ;
  cin >> a ;
  bool can = true ;
  for(int i = 0 ; i < a.length() ; i++ ) {
    if(check[ a[i] -'a' ] == 1 ) {
      can = false ;
      break ;
    }
    check[ a[i] -'a' ]++ ;
  }
  if(can) cout << "yes" << endl ;
  else cout << "no" << endl ;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cmath>

typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

using namespace std;

int main(void) {
    int n, m, c;
    cin >> n >> m >> c;
    int b[m];
    REP(i, m) cin >> b[i];

    int cnt = 0;
    REP(i, n) {
        int a = c;
        int input;
        REP(j, m) {
            cin >> input;
            a += input * b[j];
        }
        if (a > 0) {
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
	
	using namespace std;
	int main()
	{
		std::ios::sync_with_stdio(false);
		string s;
		cin>>s;
		int sum=0;
		for(int i=0;i<s.size();i++)
			sum+=(s[i]-'0');
		if(sum%9)
			cout<<"No";
		else
			cout<<"Yes";
		return 0;
	}


Measured memory_bytes: 3776
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
ll binpow(ll a, ll b) {      
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
int main()
{
	ll n = log((binpow(10,12)))/log(2);
	ll arr[n+1];
	arr[0] = 1;
	for(ll i=1;i<=n;i++)
	{
		arr[i] = (2*arr[i-1])+1;
	}
	ll h;
	cin>>h;
	
	ll x = log(h)/log(2);
	ll sum = arr[x];
	/*for(ll i=0;i<=x;i++)
	{
		sum += binpow(2,x-i)*arr[i];
	}
	*/
	cout<<sum<<endl;

	
}

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

int MS[300000];
int judge(int n)
{
  for(int i=0;MS[i]<=n/2;i++){
    if(n%MS[i]==0)return 0;
  }
  return 1;
}
int main()
{
  int n,b=0,a=0,sum;
  for(int i=7;i<300001;i+=7){
    MS[b++]=i-1;
    MS[b++]=i+1;
  }
  while(1){
    cin>>n;
    if(n==1)break;
    cout<<n<<":";
    for(int i=0;i<b;i++){
      if(n%MS[i]==0 && judge(MS[i]) )cout<<" "<<MS[i];
    }
    cout<<endl;
    }
  return 0;
}

Measured memory_bytes: 1496
#include <stdio.h>


int main(){
	
	int a,b,count=0;
	
	scanf("%d",&a);
	
	b = a;
	
	while( a > 0){
		count = count + a % 10;
		a = a / 10;
	}
	
	if( b % count == 0 ) printf("Yes\n");
	else printf("No\n");
	
	return 0;
}


Measured memory_bytes: 128
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S,T;
    cin >> S >> T;
    print(T+S);

    

}

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

public class Test
{
	public static void Main()
	{
		string line = System.Console.ReadLine();
		string[] ab = line.Split(' ');
		int a = int.Parse(ab[0]);
		int b = int.Parse(ab[1]);
		int c = int.Parse(ab[2]);
		
		int count = 0;
		
		for(int i = a; i <= b; i++){
			if(c%i==0){
				count++;
			}
		}
		Console.WriteLine(count);
		
	}
}

Measured memory_bytes: 9220
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;

int main() {
	int N, K;
	cin >> N >> K;
	ll ans = 0;
	for (int i = 1; i <= K; i++) {
		if (i > N) break;
		if (i * 2 % K == 0) {
			ll x = (N - i) / K + 1;
			ans += x * x * x;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#define f(i,a,b) for(register int i=(a),i##end=(b);i<=i##end;i=-(~i))
#define rf(i,a,b) for(register int i=(a),i##end=(b);i>=i##end;i=~(-i))
const int mod=1e9+7,neko=300010;
int ans,now,res,n,m,k;
typedef int arr[neko*3];
arr fac,ifac,pow3;
int spow(int m,int n)
{
	int b=1;
	for(;n;n>>=1,m=1ll*m*m%mod)if(n&1)b=1ll*b*m%mod;
	return b;
}
int C(int n,int m)
{return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;}
void initM(int n)
{
	fac[0]=ifac[0]=pow3[0]=1;
	f(i,1,n)fac[i]=1ll*fac[i-1]*i%mod,pow3[i]=3ll*pow3[i-1]%mod;
	ifac[n]=spow(fac[n],mod-2);
	rf(i,n-1,1)ifac[i]=1ll*ifac[i+1]*(i+1)%mod;
}
int ADD(int x,int y){return (x+=y)>=mod?x-mod:x;}
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	if(m<k)std::swap(m,k);
	initM(n+m+k+5),res=1;
	f(i,0,m+k)
	{
		now=1ll*C(n-1+i,i)*pow3[m+k-i]%mod*res%mod;
		if(i+1<=k)res=2ll*res%mod;
		else if(i+1<=m)res=ADD(2ll*res%mod,mod-C(i,k));
		else res=ADD(2ll*res%mod,ADD(mod-C(i,k),mod-C(i,m))); 
		ans=ADD(ans,now%mod);
	}printf("%d\n",ADD(ans,mod));
	return 0;
}


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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = int(1e9) + 1;
const LL LLINF = LL(1e18) + 1;
long double eps = 1.0E-14;
#define pow10(n) int(1e##n + n)

long long modpow(long long a, long long b, long long mod)
{  // a^b % mod を log(b) で計算する
    if (b == 0)
        return 1;

    if (b % 2 == 0)
    {
        long long d = modpow(a, b / 2, mod) % mod;
        return (d * d) % mod;
    }

    return (a * modpow(a, b - 1, mod)) % mod;
}
const LL mod = 998244353;

int argD[pow10(5)];

void solve()
{
    int N;
    cin >> N;
    LL max_D = 0;
    REP0 (i, N)
    {
        LL D;
        cin >> D;

        if ((i == 0 and D != 0) or (i != 0 and D == 0))
        {
            cout << 0 << endl;
            return;
        }

        argD[D]++;
        max_D = max(max_D, D);
    }

    LL ans = 1;
    REP0 (i, max_D)
    {
        ans *= modpow(argD[i], argD[i + 1], mod);
        ans %= mod;
    }
    cout << ans << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>

int main(){
  int i,j,n,number,k,c;
  scanf("%d",&n);
  int array[n+1][n+1];
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      array[i][j]=0;
    }
  }

  for(i=1;i<=n;i++){
    scanf("%d%d",&number,&k);
    for(j=1;j<=k;j++){
      scanf("%d",&c);
      array[i][c]=1;
    }
  }

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      printf("%d",array[i][j]);
      if(j!=n) printf(" ");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 640
n, m, x = map(int, input().split())
l = [list(map(int, input().split())) for i in range(n)]
bi_list = [bin(i)[2:] for i in range(2**n)] 
comb = [0] * (m+1)
comb[0] = 10**7
for i in bi_list:#本の選択パターン選択
    dig = len(i) 
    state = [0] * (m+1)
    for j in range(dig):#iから本の選択
        if i[dig-1-j] == '1':
            for k in range(m+1):#本の数値入力
                state[k] += l[n-1-j][k]
    for p in range(m):
        if state[m - p] < x:
            break
    else:
        if state[0] < comb[0]:
            comb = state
if comb[m] == 0:
    print(-1)
else:
    print(comb[0])

Measured memory_bytes: 9360
#include <iostream>
#include<string>
#include<algorithm>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
ll a[334];
	ll gcd(ll a, ll b) {
		if (b == 0) { return a; }
		return gcd(b, a%b);
	}
	ll lcm(ll a, ll b) {
	  ll g = gcd(a, b);
      return a / g * b; 
	}
	int main(void) {
		int n;
		cin >> n;
		ll ans = 1;
		rep(i, n) { cin >> a[i]; ans = lcm(a[i], ans); }
		cout << ans << endl;
	}
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n%2==0)
		cout<<"0.5000000000"<<endl;
	else
	{
		float odd = (n + 1)/2;
		double rez = odd/float(n);
		cout<<fixed;
		cout<<setprecision(10);
		cout<<rez<<endl;
	}
	return 0;
}

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


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

	return 0;
}

Measured memory_bytes: 3124
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define uniq(x) (x).erase(unique(all(x)),(x).end())

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<31-1;
const int MOD = 1000000007;

vector <ll> v;

void solve(void){
    int N;
    cin >> N;
    ll sum = 0LL;
    rep(N, i) {
        int A; cin >> A;
        v.pb(A);
        sum += A;
    }
    sort(all(v));
    cout << v[0] << ' ' << v[N-1] << ' ' << sum << '\n';
}

int main(void){
  solve();
  return 0;
}



Measured memory_bytes: 3268
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

n,m,q = map(int,input().split())
d = [{} for _ in range(n)]
for i in range(m):
    l,r = map(int,input().split())
    l -= 1
    r -= 1
    if r not in d[l].keys():
        d[l][r] = 0
    d[l][r] += 1
for i in range(n-1)[::-1]:
    for k,v in d[i+1].items():
        if k not in d[i]:d[i][k] = 0
        d[i][k] += v
ans = [0]*q
for i in range(q):
    P,Q = map(int,input().split())
    P -= 1
    Q -= 1
    for k,v in d[P].items():
        if k <= Q:
            ans[i] += v
print('\n'.join(str(i) for i in ans))


Measured memory_bytes: 87132