akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.lang.*;
import java.io.*;
 
public final class Main
{
    public static void main (String[] args) throws java.lang.Exception {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
      int k = in.nextInt();
        int[] arr = new int[n];
      for(int i =0; i< n; i++)
        arr[i]= in.nextInt();
        
        int[] dp = new int[n];
        dp[0] = 0;
        for(int i=1 ; i<n ; i++)
        {
            int min = Integer.MAX_VALUE;
            for(int j=1 ; j<=k && (i-j)>= 0; j++)
            {   
               
                min = Math.min(dp[i-j] + Math.abs(arr[i] - arr[i-j]), min);
            }
 
            dp[i] = min;
        }
      System.out.println(dp[n-1]);
    }
}


Measured memory_bytes: 50572
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scanner = new Scanner(System.in);
		
		long x = scanner.nextInt();
		long y = scanner.nextInt();
		
		long a;
		while (x % y != 0) {
			a = x;
			x = y;
			y = a % y;
			
		}
		System.out.println(y);
		
	}
}


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

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define INF 1e9

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll dp[3][100001], n, x, pos, ans;
vector <ll> a, b, c;

void binary_search_a(int x){
	pos=-1;
	int lo, hi, mid;
	lo = 0;
	hi = n-1;
	while(lo<=hi){
		mid=lo+(hi-lo)/2;
		if(a[mid]<x){
			pos=mid;
			lo=mid+1;
		}
		else{
			hi=mid-1;
		}
	}
}

void binary_search_b(int x){
	pos=-1;
	int lo, hi, mid;
	lo = 0;
	hi = n-1;
	while(lo<=hi){
		mid=lo+(hi-lo)/2;
		if(b[mid]<x){
			pos=mid;
			lo=mid+1;
		}
		else{
			hi=mid-1;
		}
	}
}

int main()
{
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> x;
		a.pb(x);
	}
	for(int i = 0; i < n; i++){
		cin >> x;
		b.pb(x);
	}
	for(int i = 0; i < n; i++){
		cin >> x;
		c.pb(x);
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	sort(c.begin(),c.end());
	for(int i = 0; i < n; i++){
		binary_search_a(b[i]);
		if(i==0){
			dp[1][i]=pos+1;
		}
		else{
			dp[1][i]=pos+1+dp[1][i-1];
		}
	}
	for(int i = 0; i < n; i++){
		binary_search_b(c[i]);
		if(pos>-1){
			ans+=dp[1][pos];
		}
	}
	cout << ans;
	
	
	return 0;
}


Measured memory_bytes: 3444
#include<bits/stdc++.h>
#define LL long long
using namespace std;
#define G(x,y,z,t) ((x)*1LL*1000000000+(y)*1000000+(z)*1000+(t))
unordered_map<LL,int> number;
struct sqare{
	int x0,x1,x2,x3;
	LL key[5];
	void ini(int a,int b,int c,int d){
		x0=a,x1=b,x2=c,x3=d;
		key[1]=G(a,b,c,d);
		key[2]=G(b,c,d,a);
		key[3]=G(c,d,a,b);
		key[4]=G(d,a,b,c);
	}
	void add(){
		for(int i=1;i<=4;i++) number[key[i]]++;
	}
	void dec(){
		for(int i=1;i<=4;i++) number[key[i]]--;
	}
}p[505];
LL calc(sqare fr,sqare bk){
	fr.dec();bk.dec();
	LL ret=0;
	for(int i=1;i<=4;i++){
		int t=bk.x0;bk.x0=bk.x1;bk.x1=bk.x2;bk.x2=bk.x3;bk.x3=t;
		LL ans=1;sqare key[5];
		key[1].ini(fr.x1,fr.x0,bk.x1,bk.x0);
		ans*=number[G(fr.x1,fr.x0,bk.x1,bk.x0)];key[1].dec();
		key[2].ini(fr.x2,fr.x1,bk.x0,bk.x3);
		ans*=number[G(fr.x2,fr.x1,bk.x0,bk.x3)];key[2].dec();
		key[3].ini(fr.x3,fr.x2,bk.x3,bk.x2);
		ans*=number[G(fr.x3,fr.x2,bk.x3,bk.x2)];key[3].dec();
		key[4].ini(fr.x0,fr.x3,bk.x2,bk.x1);
		ans*=number[G(fr.x0,fr.x3,bk.x2,bk.x1)];key[4].dec();
		ret+=ans;
		for(int j=1;j<=4;j++) key[j].add();
	}
	fr.add();bk.add();
	return ret;
}
int n;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int a,b,c,d;
		scanf("%d%d%d%d",&a,&b,&c,&d);
		p[i].ini(a,b,c,d);
		p[i].add();
	}
	LL ans=0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if(i!=j)
				ans+=calc(p[i],p[j]);
	cout<<ans/6<<endl;
	return 0;
}

Measured memory_bytes: 239576
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <stack>
#include <queue>
#include <math.h>
#include <bitset>

using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;

#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
#define rep_r(i,s,n)for(int i = n-1;i>=s;i--)
#define repe_r(i,s,n)for(int i = n;i>=s;i--)

ll a[200001];
ll b[200001];
vector<pair<ll, ll>> p;
int main() {
	ll n; cin >> n;
	repe(i, 1, n) {
		cin >> a[i] >> b[i];
		if (a[i] > b[i]) {
			cout << "No" << endl;
			return 0;
		}
		p.push_back({ b[i],a[i] });
	}

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

	ll t = 0;
	for (vector<pair<ll, ll>>::iterator it = p.begin(); it != p.end(); it++) {
		t += it->second;
		if (t > it->first) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 8432
#include<bits/stdc++.h>
using namespace std;
static const int64_t mod=1000000007;
int64_t f(int64_t x,int64_t y){
if(y==0)
  return 1;
  else if(y%2==0)
    return (f(x,y/2)*f(x,y/2))%mod;
  else
    return (x*((f(x,y/2)*f(x,y/2))%mod))%mod;
}
int main(){
  int64_t N;
  cin>>N;
  int64_t ans=0;
  for(int64_t i=1;i<=N;i++){
  int64_t a=N/i;
    ans+=i*((a*(a+1))/2);
  }cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3628
import itertools

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

nP = 0
nQ = 0
for i, p in enumerate(itertools.permutations(list(range(1, N+1)))):
  if p == P:
    nP = i
  if p == Q:
    nQ = i
    
print(abs(nP - nQ))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std ;
#define ll long long int 
#define pb push_back 
#define mp make_pair 
priority_queue < ll > pq ;
queue < ll > q ;
vector < int > adj[100005] ;
ll sum = 0 , ans[100005] , vis[100005];
void dfs(int i){
	vis[i] = 1 ;
	for(auto it : adj[i]){
		if(vis[it] == 0){
			// cout << it << " " ;
			sum += min(ans[it ] , ans[i]) ;
			dfs(it) ;
		}
	}
}
int main(){
	ios_base::sync_with_stdio(false) ;
	cin.tie(NULL) ;
	int n ;
	cin >> n; 
	for(int i = 1 ; i < n ; i++){
		int a , b ;
		cin >> a >> b ;
		adj[a].pb(b) ;
		adj[b].pb(a) ;
	}
	for(int i = 0 ; i < n ; i++){
		int a ;
		cin >> a ;
		pq.push(a) ;
	}
	q.push(1) ;
	while(!pq.empty()) {
		while(!q.empty()){
			int i= q.front() ;
			vis[i] = 1 ;
			q.pop() ;
			ans[i] = pq.top() ;
			pq.pop() ; 
			for(auto it : adj[i]){
				if(vis[it] == 0)
					q.push(it) ;
			}
		}
	}
	memset( vis, 0 , sizeof(vis)) ;
	dfs(1) ;
	cout << sum << '\n' ;
	for(int i = 1 ; i<= n ; i++){
		cout << ans[i] << " " ;
	}
}

Measured memory_bytes: 4352
import java.util.Scanner;

class Main
{
    public static void main(String[] args)
    {
      //入力
      Scanner sc = new Scanner(System.in);
      String s = sc.next();
      String[] s1 = s.split("");
      String t = sc.next();
      String[] t1 = t.split(""); 
      
      int count = 0;
      for (int i=0; i<3; i++) {
        if (s1[i].equals(t1[i])) count ++;
      }
      
      System.out.println(count);
      
    }
      
}



Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int n;
    cin >> n;
    string ans = "No";
    int f = 0;
    int v = n;
    while (v) {
        f += (v%10);
        v /= 10;
    }
    if (n%f==0) ans = "Yes";
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3572
def solve
  k = gets.to_i
  q = [1, 2, 3, 4, 5, 6, 7, 8, 9]
  cnt = 0
  loop do
    return q[k - 1] if k <= q.length

    x = q[cnt]
    3.times do |i|
      return q.last if q.length == k

      d = x % 10 + (i - 1)
      next if d < 0 || d > 9

      q.push(x * 10 + d)
    end
    cnt += 1
  end
end
print solve

Measured memory_bytes: 2684
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

void solve(){
	int H,W;
	cin>>H>>W;
	vector<string>v(H);
	map<char,int>sheets;
	map<char,pair<int,int>>ma;
	map<char,pair<int,int>>mi;
	for(int i=0;i<H;i++){
		cin>>v[i];
		for(int j=0;j<W;j++)if(v[i][j]!='.'){
			sheets[v[i][j]]++;
			if(ma.find(v[i][j])==ma.end())ma[v[i][j]]={i,j};
			if(mi.find(v[i][j])==mi.end())mi[v[i][j]]={i,j};
			ma[v[i][j]].first=max(ma[v[i][j]].first,i);
			ma[v[i][j]].second=max(ma[v[i][j]].second,j);
			mi[v[i][j]].first=min(mi[v[i][j]].first,i);
			mi[v[i][j]].second=min(mi[v[i][j]].second,j);
		}
	}
	for(;!sheets.empty();){
		bool f=false;
		for(auto &e:sheets){
			int hs=mi[e.first].first,ws=mi[e.first].second;
			int he=ma[e.first].first+1,we=ma[e.first].second+1;
			int h=hs,z=0;
			for(;h<he;h++){int w=ws;for(;w<we;w++){
				if(v[h][w]==e.first)z++;
				else if(v[h][w]-'0')break;
			}if(w<we)break;}
			if(h==he && z==e.second){
				for(int h=hs;h<he;h++)for(int w=ws;w<we;w++)v[h][w]='0';
				sheets.erase(e.first);
				f=true;break;
			}
		}
		if(!f)break;
	}
	cout<<(sheets.empty()?"SAFE":"SUSPICIOUS")<<endl;
}
int main(){int T;for(cin>>T;T--;)solve();}


Measured memory_bytes: 3196
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
const vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
template<class T>void debag(const vector<T> &a){cerr<<"debag :";for(auto v:a)cerr<<v<<" ";cerr<<"\n";}
template<class T>void print(const vector<T> &a){for(auto v:a)cout<<v<<" ";cout<<"\n";}
std::ostream &operator<<(std::ostream &dest, __int128_t value) {
  std::ostream::sentry s(dest);
  if (s) {
    __uint128_t tmp = value < 0 ? -value : value;
    char buffer[128];
    char *d = std::end(buffer);
    do {
      --d;
      *d = "0123456789"[tmp % 10];
      tmp /= 10;
    } while (tmp != 0);
    if (value < 0) {
      --d;
      *d = '-';
    }
    int len = std::end(buffer) - d;
    if (dest.rdbuf()->sputn(d, len) != len) {
      dest.setstate(std::ios_base::badbit);
    }
  }
  return dest;
}
using LL=__int128;

LL extgcd(LL a,LL b,LL &x,LL &y){
    if(b==0){
        x=1;y=0;
        return a;
    }
    LL d=extgcd(b,a%b,y,x);
    y-=a/b*x;
    return d;
}
pair<LL,LL> ChineseRem(LL b1,LL m1,LL b2,LL m2){
    LL p,q;
    LL d=extgcd(m1,m2,p,q);
    if((b2-b1)%d!=0){
        return make_pair(0,-1);
    }
    LL m=m1*(m2/d);
    LL tmp=(b2-b1)/d*p%(m2/d);
    LL r=((b1+m1*tmp)%m+m)%m;
    return make_pair(r,m);
}
vector<ll> divisor(ll n){
	vector<ll> ret;
	for(ll i=1;i*i<=n;i++){
		if(n%i==0){
			ret.push_back(i);
            if(i*i!=n)ret.push_back(n/i);
		}
	}
	sort(ret.begin(),ret.end());
	return(ret);
}
int main(){
    ll n;
    cin>>n;
    n*=2;
    V<ll> d=divisor(n);
    LL ans=inf;
    for(ll v:d){
        pair<LL,LL> p=ChineseRem(0,v,n/v-1,n/v);
        if(p.fi!=0){
            if(ans>p.fi){
                ans=p.fi;
            }
        }
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 3732
#include <bits/stdc++.h>
typedef long long ll;

bool find(std::vector<std::string> words, std::string w) {
    for (size_t i = 0; i < words.size(); i++) {
        if (words[i] == w) {
            return true;
        }
    }
    return false;
}

int main(int argc, char const *argv[]) {
    int N;
    std::cin >> N;
    std::string W[N];
    for (size_t i = 0; i < N; i++) {
        std::cin >> W[i];
    }
    std::vector<std::string> words;
    words.push_back(W[0]);
    for (size_t i = 1; i < N; i++) {
        if (find(words, W[i]) || W[i][0] != W[i - 1][W[i - 1].size() - 1]) {
            std::cout << "No" << '\n';
            return 0;
        }
        words.push_back(W[i]);
    }
    std::cout << "Yes" << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
#define ld long double
 
#define endl '\n'
#define FAST                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int MAXN = 1e5 + 5;

int main() {
  double x;
  cin>>x;
  cout<<ceil(x/2.0)<<endl;
    return 0;
}

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

using namespace std;

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false); cin.tie(0);
	set<int> s;
	for (int i = 1; i <= 9; i++)
		for (int j = 1; j <= 9; j++) s.insert(i * j);
	int n;
	cin >> n;
	cout << (s.count(n) ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 256
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
ans=0
for i in range(N):
    b=B[i]
    if A[i]>b:
        ans+=b
        continue
    ans+=A[i]
    b-=A[i]
    if A[i+1]>b:
        ans+=b
        A[i+1]-=b
        continue
    ans+=A[i+1]
    A[i+1]=0
print(ans)

Measured memory_bytes: 81892
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>

using namespace std;

int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}

int main(){
  int n;
  cin >> n;
  int s[n][n],d[n][n];
  for(int i=0;i<n;i++){
    string st;
    cin>>st;
    for(int j=0;j<n;j++){
      s[i][j]=ctoi(st[j]);
      if(s[i][j]==0)d[i][j]=(1<<20);
      else d[i][j]=s[i][j];
    }
  }

  for (int k = 0; k < n; k++){       // 経由する頂点
    for (int i = 0; i < n; i++) {    // 始点
      for (int j = 0; j < n; j++) {  // 終点
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }

  int max=-2;
  for(int i=0;i<n;i++){
    int tmp=-2;
    bool flg=true;
    for(int j=0;j<n;j++){


      if(i!=j){
        if(tmp<=d[i][j]) tmp=d[i][j];
      for(int k=j+1;k<n;k++){
        if(i!=k){
        if(d[i][j]==d[i][k]){
          if(s[j][k]==1){
            flg=false;
          }
        }
      }
      }
      }
    }
    if(flg){
      if(max<=tmp){
        max=tmp;
      }
    }
  }

cout<<max+1<<endl;


}

Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  string S[N];
  for(int i=0;i<N;i++) cin >> S[i];

  int cnt[26];
  fill(cnt,cnt+26,100);
  for(int i=0;i<N;i++){
    int cnttmp[26];
    fill(cnttmp,cnttmp+26,0);
    for(int j=0;j<S[i].size();j++){
      int ind = S[i][j] - 'a';
      cnttmp[ind]++;
    }
    for(int j=0;j<26;j++){
      cnt[j] = min(cnt[j] , cnttmp[j]);
    }
  }

  for(int i=0;i<26;i++){
    for(int j=0;j<cnt[i];j++){
      cout << (char)('a' + i);
    }
  }
  cout << endl;
  return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    ll ans = 0;
    for(int i=0;i<n;i++) {
        ll l, r;
        cin >> l >> r;
        ans += (r-l) + 1;
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    string s;
    cin >> s;
    int n = s.length();
    ll ans = 0;
    ll cnt = 0;
    REP(i,n) {
        if (s[i] == 'A') {
            ++cnt;
        }
        else if (s[i] == 'B' and i+1 < n) {
            if (s[i+1] == 'C') {
                ans += cnt;
                ++i;
            }
            else cnt = 0;
        }
        else cnt = 0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
double w,h,x,y;
const double eps=1e-8;
int main(){
	scanf("%lf%lf%lf%lf",&w,&h,&x,&y);
	double s=w*h/2;
	int cnt=0;
	if(fabs(x*2-w)<eps && fabs(y*2-h)<eps){
		cnt=1;
	}
	printf("%lf %d\n",s,cnt);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a[200005],b[200005]={0},c[200005]={0};
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		b[a[i]]++;
		if(b[a[i]]==2){
			c[++c[0]]=a[i];
		}
	}
	double m=0;
	for(int j=1;j<=c[0];j++){
		m+=b[c[j]]*(b[c[j]]-1)/2;
	}
//	printf("w %lld\n",m);
	for(int i=0;i<n;i++){
		double k=0;
		if(b[a[i]]>1){
			k=-b[a[i]]*(b[a[i]]-1)/2+(b[a[i]]-1)*(b[a[i]]-2)/2;
		}
		printf("%.0lf\n",m+k);
	}
	
	return 0;
}


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

using namespace std;

const int N = 1e5 + 5;
int n, A[N], ans;

vector<int> v;
int main()
{
	cin >> n;
	for(int i = 0 ; i < n; ++i)
		cin >> A[i];
	for(int i = 1 ; i < n - 1; ++i)
	{
		v.push_back(A[i - 1]);
		v.push_back(A[i]);
		v.push_back(A[i + 1]);
		sort(v.begin(), v.end());
		if(A[i] == v[1])
			++ans;
		v.clear();
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
from fractions import gcd

def yakusuu(a):
    yakusuu = list()
    for i in range(1,a+1):
        if a % i == 0:
            yakusuu.append(i)
    return yakusuu

A, B, K = map(int, input().split())

ans = yakusuu(gcd(A,B))[-K]
print(ans)



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

#define int long long




signed main(void){
    int MOD = 1e9+7;
    int n; cin >> n;
    vector<string>s(2);
    cin >> s[0] >> s[1];

    int ans = 3;
    int i;
    if(s[0][0]==s[1][0]){
        i=1;
    }else{
        i=2;
        ans*=2;
    }
    while(i<s[0].length()){
        if(s[0][i]==s[1][i]){
            if(s[0][i-1]==s[1][i-1]){
                ans = (ans*2);
            }
            i+=1;
        }else{
            if(s[0][i-1]==s[1][i-1]){
                ans = (ans*2);
            }else{
                ans = (ans*3);
            }
            i+=2;
        }
        ans = ans%MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define FOR(i,n,a) for(int i = a;i<n;i++)
#define rep(i,n) FOR(i,n,0)
#define UNFOR(i,n,a) for(int i = a;i>n;i--)
#define unrep(i,n) UNFOR(i,0.n)
typedef long long ll;
using namespace std;
string s;
int K;
int main() {
	cin >> s >>K;
	vector<string> v;
	char oldmoji='a'-1;
	while(v.size() < K) {
		char mini = 'z';
		rep(j, s.size()) {
			if (s[j] <= oldmoji)continue;
			mini = min(mini, s[j]);
		}
		oldmoji = mini;
		char minmoji = mini;
		vector<string> v2;
		rep(j, s.size()) {
			if (s[j] == minmoji) {
				rep(k, 5) {
					v2.push_back(s.substr(j, k + 1));
				}
			}
		}
		sort(v2.begin(),v2.end());
		rep(k, v2.size()) {
			bool flg = true;
			rep(l, v.size()) {
				if (v2[k] == v[l])flg = false;
			}
			if (flg)v.push_back(v2[k]);
		}
	}
	cout << v[K-1] << endl;
	return 0;
}


Measured memory_bytes: 1660
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll p, n;std::cin >> n;
  deque<ll> h;
  re(i, n){
    std::cin >> p;
    h.push_back(p);
  }
  ll c = 0, now = 0;
  while(!h.empty()){
    if(h.front()<=now+1) {
      if(h.front()==now+1) now++;
      h.pop_front();
    }else{
      if(h.front()<=2*(now+1)){
        h.front()=1, c++;
      }else{
        c+=2*(h.front()/(2*(now+1))), h.front()%=(2*(now+1));
        if(h.front()<=(now+1)) c--, h.front()+=now+1;
        if(h.front()<=(now+1)) c--, h.front()+=now+1;
      }
    }
  }
  std::cout << c << '\n';
  return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

int main() {

    int X;
    cin >> X;

    long long ans = 0;
    ans += (X / 500) * 1000;
    X -= (X / 500) * 500;
    ans += (X / 5) * 5;

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

Measured memory_bytes: 256
n, k = map(int, input().split())
P = list(map(int, input().split()))
A = [0] * n
A[0] = P[0]
for i in range(1, n):
  A[i] = P[i] + A[i-1]
A = [0] + A
#print(A)

max = 0
max_i = 0
for i in range(n - k + 1):
  total = A[i+k] - A[i]
  if max < total:
    max = total
    max_i = i
#print(max, max_i)
print((max + k) / 2)

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

using ll = long long;

const int MAXN = 1.1e5;
int N, H, W;
pair<int, pair<int, int>> E[MAXN];

const int MAXV = 2.1e5;
int V;
int par[MAXV];
int cnt[MAXV];
int sz[MAXV];

int getpar(int a) {
	return par[a] == -1 ? a : (par[a] = getpar(par[a]));
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N >> H >> W;
	for (int e = 0; e < N; e++) {
		int r, c, a; cin >> r >> c >> a; r--, c--;
		E[e] = {a, {r, H+c}};
	}
	sort(E, E + N);
	reverse(E, E + N);

	V = H + W;
	for (int v = 0; v < V; v++) {
		par[v] = -1;
		cnt[v] = 0;
		sz[v] = 1;
	}
	ll ans = 0;
	auto isGood = [&](int a, int b) -> bool {
		a = getpar(a);
		b = getpar(b);
		if (a == b) {
			if (cnt[a] == sz[a]) return false;
			cnt[a]++;
			return true;
		}
		if (sz[a] + sz[b] == cnt[a] + cnt[b]) return false;
		if (sz[a] > sz[b]) swap(a, b);
		sz[b] += sz[a];
		cnt[b] += cnt[a] + 1;
		par[a] = b;
		return true;
	};
	for (int e = 0; e < N; e++) {
		if (isGood(E[e].second.first, E[e].second.second)) {
			ans += E[e].first;
		}
	}

	cout << ans << '\n';

	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

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

	return 0;
}

Measured memory_bytes: 19236
package main

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

func main() {
	log.SetFlags(log.Lshortfile)
	nextReader = NewScanner()
	n := nextInt()
	m := nextInt()
	b := true
	g := make([][]int, n)
	color := make([]int, n)
	for i := 0; i < m; i++ {
		a := nextInt() - 1
		b := nextInt() - 1
		g[a] = append(g[a], b)
		g[b] = append(g[b], a)
	}
	var dfs func(int, int) bool
	dfs = func(v, c int) bool {
		color[v] = c
		for i := 0; i < len(g[v]); i++ {
			if color[g[v][i]] == c {
				return false
			}
			if color[g[v][i]] == 0 && !dfs(g[v][i], -c) {
				return false
			}
		}
		return true
	}
	for i := 0; i < n; i++ {
		if color[i] == 0 {
			if !dfs(i, 1) {
				b = false
			}
		}
	}

	if b {
		cnt := 0
		for i := 0; i < n; i++ {
			if color[i] == 1 {
				cnt++
			}
		}
		fmt.Println(cnt*(n-cnt) - m)
	} else {
		fmt.Println(n*(n-1)/2 - m)
	}
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func minmax(a, b int) (int, int) {
	if a > b {
		return b, a
	}
	return a, b
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	return p[i].b < p[i].b
}

var nextReader func() string

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}


Measured memory_bytes: 10368
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <atcoder/all>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N, M;

int main() {
  std::cin >> N >> M;

  atcoder::scc_graph G(N);

  rep( i, M ) {
    ll a, b;
    std::cin >> a >> b;

    G.add_edge( a, b );
  }

  auto scc = G.scc();

  std::cout << scc.size() << endl;

  for( auto vs : scc ) {
    std::cout << vs.size();

    for( auto v : vs )
      std::cout << " " << v;

    std::cout << endl;
  }

  return 0;
}

Measured memory_bytes: 40072
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

	static Scanner scanner;

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

	    int N=gi();
	    int[] A=new int[N+1];
	   
	    int c=0;
	    for(int i=1; i<=N;i++) {
	    	A[i]=gi();
	    	if (i%2==1 && A[i]%2==1) {
	    		c++;
	    	}
	    }

	    
        System.out.print(c);

//        if (m%2==0) {
//        	System.out.println(m/2);
//        }else{
//        	System.out.println((m+1)/2);
//        }
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35628
#include <bits/stdc++.h>
 
using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i< (int) n; i++)
 
 
int main () {
    int A,B;

    cin >> A >> B;

    int ans = 0;
    for(int i = A; i< B+1; i++){
        int s = i%10, t  = i/ 10000 ;
        int u = i /10 %10, v = i/1000 %10;
        if (s == t && u ==v) ans ++;
            
        }
    cout << ans << endl;

}


Measured memory_bytes: 256
from collections import Counter

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

if N % 2 == 0:
    expected = [i // 2 * 2  + 1 for i in range(N)]
    dims = N // 2
else:
    expected = [(i + 1) // 2 * 2 for i in range(N)]
    dims = (N - 1) // 2

if sorted(abs_diffs) == expected:
    print(2 ** dims % (10 ** 9 + 7))

else:
    print(0)


Measured memory_bytes: 24592
#include <algorithm>
// #include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <bitset>
using namespace std;
typedef long long LL;
typedef double db;
const int oo=2139063143;
const int N=1010000;
const int P=1000000007;
const db eps=1e-7;
#define pritnf printf
//char buf[1<<22],*p1=buf,*p2=buf,obuf[1<<22],*O=obuf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <typename T>
inline void sc (T &x)
{
    x=0; static int p; p=1; static char c; c=getchar();
    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }
    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }
    x*=p;
}
template <typename T>
inline void print (T x)
{
    if (x< 0) putchar('-'),x=-x;
    if (x>=10) print(x/10);
    putchar(x%10+'0');
}
template <typename T>
inline void pr (T x) { print(x),putchar('\n'); }
template <typename T1,typename T2>
void chkmax (T1 &A,T2 B) { A=A>=B?A:B; }
template <typename T1,typename T2>
void chkmin (T1 &A,T2 B) { A=A<=B?A:B; }
int up (int x,int y) { return x/y+(x%y> 0); }
int get (int A,int B) { return A>=B?up (A,B+1):up (B,A+1); }
int main ()
{
    // freopen (".in","r",stdin);
    // freopen (".out","w",stdout);
	int T; sc(T);
	while (T--)
	{
		int A,B,l,r; sc(A),sc(B),sc(l),sc(r);
		int x=get (A,B);
		int L=0,R=A+1;
		while (L+1< R)
		{
			int mid=(L+R)>>1;
			if (get (B-(up (mid,x)-1),A-mid)<=x) L=mid;
			else R=mid;
		}
		int us=L?up (L,x)-1:0,len=L+us,las=(B-us)%x; if (!las) las=x;
		for (int i=l; i<=r; i++)
		{
			if (i<=len) putchar(i%(x+1)?'A':'B');
			else if (i-len<=las) putchar('B');
			else putchar((i-len-las)%(x+1)==1?'A':'B');
		}
		putchar('\n');
	}

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(void){
    int n,X,Y,i=0,p,max=0;
    double x[1000]={},y[1000]={},D;
    scanf("%d",&n);
    while(scanf("%d",&X)==1){
        x[i]=X;
        if(i==n-1){ break;}
        i++;
    }
    i=0;
    while(scanf("%d",&Y)==1){
        y[i]=Y;
        if(i==n-1){ break;}
        i++;
    }
    //p=1
    for(i=0;i<n;i++){
        D+=fabs(x[i]-y[i]);
    }
    printf("%f\n",D);
    D=0;
    //p=2
    for(i=0;i<n;i++){
        D+=pow(fabs(x[i]-y[i]),2);
    }
    D=pow(D,0.5);
    printf("%f\n",D);
    D=0;
    //p=3
    long double d;
    for(i=0;i<n;i++){
    d+=pow(fabs(x[i]-y[i]),3);
    }
     d=pow(d,0.3333333333);
    
    printf("%Lf\n",d);
    d=0;
    //p=∞ 
    for(i=0;i<n;i++){
        if(max<fabs(x[i]-y[i])){
            max=fabs(x[i]-y[i]);
        }
    }
    printf("%f\n",(double)max);
        max=0;
    d=0;
    return 0;
}


Measured memory_bytes: 2112
/* 
 * Created by solzard on 2020-03-05.
 * B - Bingo
 */
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

bool IsBingo(int player) {
  const std::unordered_set<int> winnable_conditions
      {0b111000000, 0b000111000, 0b000000111, 0b100100100, 0b010010010, 0b001001001, 0b100010001, 0b001010100};
  for (const auto &condition : winnable_conditions) {
    if ((player & condition) == condition) return true;
  }
  return false;
}

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

  std::vector<int> sheet(9);
  std::unordered_set<int> bingo;
  int n, b;
  rep(i, 9) {
    std::cin >> sheet[i];
  }
  std::cin >> n;
  rep(i, n) {
    std::cin >> b;
    bingo.emplace(b);
  }
  int player = 0;
  rep(i, 9) {
    if (bingo.find(sheet[i]) != std::end(bingo)) {
      player |= 1 << i;
    }
  }
  std::cout << (IsBingo(player) ? "Yes" : "No") << "\n";
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
	string s;
	cin >> s;
	int n = s.size();
	int p = 0;
	int cnt = 0;
	rep(i,n) {
		if (s[i] == 'S') p++;
		else {
			if (p == 0) continue;
			else {
				cnt++;
				p--;
			}
		}
	}
	cout << n - cnt * 2 << endl;
}

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

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

const int MOD = 1000000007;

bool isInside(int n, int m, int r, int c) {
  return 0 <= r && r < n && 0 <= c && c < m;
}

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

  int n, m; cin >> n >> m;
  vector<string> mp(n);
  for(int i=0; i<n; i++) cin >> mp[i];

  vector<vector<int>> rs(n, vector<int>(m, -1));
  vector<vector<int>> cs(n, vector<int>(m, -1));

  for(int i=0; i<n; i++) {
    for(int j=0; j<m; j++) {
      if(mp[i][j] == '#') continue;

      if(rs[i][j] == -1) {
        int r = i;
        while(isInside(n, m, r, j) && mp[r][j] == '.') r--;
        int ur = r+1;
        r = i;
        while(isInside(n, m, r, j) && mp[r][j] == '.') r++;
        int lr = r-1;

        for(int k=ur; k<=lr; k++) rs[k][j] = lr - ur + 1;
      }

      if(cs[i][j] == -1) {
        int c = j;
        while(isInside(n, m, i, c) && mp[i][c] == '.') c--;
        int uc = c+1;
        c = j;
        while(isInside(n, m, i, c) && mp[i][c] == '.') c++;
        int lc = c-1;

        for(int k=uc; k<=lc; k++) cs[i][k] = lc - uc + 1;
      }
    }
  }

  int res = 0;
  for(int i=0; i<n; i++) {
    for(int j=0; j<m; j++) {
      res = max(res, rs[i][j] + cs[i][j] - 1);
    }
  }

  cout << res << endl;

  return 0;
}


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

int main() {
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  double x = x2 - x1;
  double y = y2 - y1;
  double ans = sqrt(x * x + y * y);

  printf("%.9f\n", ans);
}


Measured memory_bytes: 3216
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,a) for(int i=start[(a)];i;i=e[i].next)
inline int read()
{
	int sum=0,p=1;char ch=getchar();
	while(!(('0'<=ch && ch<='9') || ch=='-'))ch=getchar();
	if(ch=='-')p=-1,ch=getchar();
	while('0'<=ch && ch<='9')sum=sum*10+ch-48,ch=getchar();
	return sum*p;
}

int main()
{
	int n=read(),k=read();
	int x=1;
	REP(i,1,n)if(read()==1){x=i;break;}
	int ans=n+1;
	REP(i,1,k)
	{
		int r=x+i-1;
		int l=r-k+1;
		if(l<1 ||r>n)continue;
		ans=min(ans,(l-1+k-2)/(k-1)+(n-r+k-2)/(k-1));
	}
	printf("%d\n",ans+1);
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll inf=1e18;
ll a[1010],t[1010],ans1,ans2,ans,l,r,mid;
int n;
int main()
{
	ios::sync_with_stdio(0);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>t[i]>>a[i];
	ans1=t[1],ans2=a[1];
	for(int i=2;i<=n;i++)
	{
		if(ans1*a[i]==ans2*t[i])continue;
		else 
		{
			l=1;r=inf/max(a[i],t[i])+1;
			ans=r;
			while(l<=r)
			{
				mid=(l+r)>>1;
				if(mid*t[i]>=ans1&&mid*a[i]>=ans2)ans=mid,r=mid-1;
				else l=mid+1;
			}
			ans1=ans*t[i],ans2=ans*a[i];
		}
	}
	cout<<ans1+ans2<<endl;	
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import deque

def main():
    n,m=map(int,input().split())
    g1=[[] for _ in range(n+1)]
    g2=[0]*(n+1)
    for i in range(m):
        a,b=map(int,input().split())
        g1[a].append(b)
        g2[b]+=1
    st=deque([])
    for i in range(n+1):
        if g2[i]==0:
            st.append(i)
    d=[10**5+1]*(n+1)
    for i in st:
        d[i]=0
    while st:
        a=st.popleft()
        for b in g1[a]:
            g2[b]-=1
            if g2[b]==0:
                st.append(b)
                d[b]=d[a]+1
    print(max(d[1:]))


if __name__ == '__main__':
    main()

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

int main(void){
    
    string W;
    cin >> W;
    map<char,int> mp;
    
    for(int i = 0; i < W.size();i++){
        mp[W[i]]++;
    }
    string ans = "Yes";
    
    for(char i = 'a'; i <= 'z';i++){
        if(mp[i]%2!=0)ans = "No";
    }
    cout << ans << endl;
    
    
}


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

typedef long long ll;
const int N=100010;

int pos[N];
ll cnt[N];
int n,S;
ll ans;

int lst;

void solve(int L,int R)
{
	if(pos[L]>=S)return void(ans+=pos[R]-S);
	if(pos[R]<=S)return void(ans+=S-pos[L]);

	if(cnt[L]>=cnt[R])
	{
		if(lst!=pos[L])ans+=pos[R]-pos[L];
		lst=pos[L];

		cnt[L]+=cnt[R];
		solve(L,R-1);
	}
	else 
	{
		if(lst!=pos[R])ans+=pos[R]-pos[L];
		lst=pos[R];

		cnt[R]+=cnt[L];
		solve(L+1,R);
	}
}

int main()
{
	scanf("%d%d",&n,&S);
	for(int i=1;i<=n;i++)
		scanf("%d%lld",pos+i,cnt+i);

	lst=-1;ans=0,solve(1,n);
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 1408
import java.util.Scanner;

public class Main{
	

	public static void main(String[] args){
	    Scanner sc = new Scanner(System.in);
	    int n = sc.nextInt();
	    int[] R = new int [n];
	    
	    for(int i = 0; i < n; i++) {
	    	R[i] = sc.nextInt();
	       
	    }//for
	    System.out.println(compute_maxprofit(n,R));
	    
	}//main
	
	 public static int compute_maxprofit(int n, int[] R) {
	     int max_profit = -999999999;
	     int m = R[0];
	      for(int i = 1; i < n ; i ++) {
	    	  if(R[i] - m > max_profit) {
	    		 max_profit = R[i] - m;
	    		  
	    	  }//if
	    	  if(R[i] < m) {
	    		  m = R[i];
	    	  }//if
		 
		  
	      }//for
	      return max_profit;
	 }
}


Measured memory_bytes: 101156
#include <iostream>
#include <string>

const int N = (int) (2e5 + 10);

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);

#if DEBUG_ON
    freopen("input", "r", stdin);
#endif

    std::string str;
    std::cin >> str;
    int l = -1, r = -1;
    for (int i = 2; i < str.length(); ++i) {
        if (str[i] == str[i - 1] || str[i] == str[i - 2]) {
            l = i - 1;
            r = i + 1;
            break;
        }
    }
    if (str[0] == str[1]) {
        l = 1;
        r = 2;
    }
    std::cout << l << ' ' << r << '\n';
    return 0;
}

Measured memory_bytes: 512
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	xs, ys := make([]int, n), make([]int, n)
	for i := 0; i < n; i++ {
		xs[i], ys[i] = iScan(), iScan()
	}
	z := make([]int, n)
	for i := 0; i < n; i++ {
		z[i] = i
	}
	perm := Permute(z)
	ans := 0.
	for _, v := range perm {
		x, y := xs[v[0]], ys[v[0]]
		for _, idx := range v[1:] {
			ans += math.Pow(float64((xs[idx]-x)*(xs[idx]-x)+(ys[idx]-y)*(ys[idx]-y)), 0.5)
			x, y = xs[idx], ys[idx]
		}
	}
	fmt.Println(ans / float64(len(perm)))
}
func Permute(nums []int) [][]int {
	n := factorial(len(nums))
	ret := make([][]int, 0, n)
	permute(nums, &ret)
	return ret
}
func permute(nums []int, ret *[][]int) {
	*ret = append(*ret, makeCopy(nums))
	n := len(nums)
	p := make([]int, n+1)
	for i := 0; i < n+1; i++ {
		p[i] = i
	}
	for i := 1; i < n; {
		p[i]--
		j := 0
		if i%2 == 1 {
			j = p[i]
		}

		nums[i], nums[j] = nums[j], nums[i]
		*ret = append(*ret, makeCopy(nums))
		for i = 1; p[i] == 0; i++ {
			p[i] = i
		}
	}
}
func factorial(n int) int {
	ret := 1
	for i := 2; i <= n; i++ {
		ret *= i
	}
	return ret
}
func makeCopy(nums []int) []int {
	return append([]int{}, nums...)
}


Measured memory_bytes: 5404
n = int(input())
dc = {}

xy = [list(map(int, input().split())) for _ in range(n)]

for i in range(n):
    for j in range(n):
        if i == j:
            continue
        key = (xy[i][0] - xy[j][0], xy[i][1] - xy[j][1])
        if key in dc:
            dc[key] += 1
        else:
            dc[key] = 1

mxv = 0
mxk = None
for key, value in dc.items():
    if value > mxv:
        mxv = value
        mxk = key
# print(mxk)
print(n - mxv)


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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++ i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define pb push_back

template<typename T> T DUP(T x, T y) { return (x + y - 1) / y; };
template <typename A, size_t N, typename T>
void arrayFill(A(&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using setint = unordered_set<int32_t>;
using setstr = unordered_set<string>;
using qint = queue<int32_t>;

constexpr std::int32_t INF = 1001001001;

void Main() {
    int h, w;
    cin >> h >> w;
    vstr a(h);
    rep(i, h)cin >> a[i];

    setint remove_row;
    setint remove_col;

    rep(i, h) {
        bool flag = true;
        rep(j, w) {
            if (a[i][j] == '#')flag = false;
        }
        if (flag)remove_row.insert(i);
    }

    rep(j, w) {
        bool flag = true;
        rep(i, h) {
            if (a[i][j] == '#')flag = false;
        }
        if (flag)remove_col.insert(j);
    }

    vstr ans;
    rep(i, h) {
        if (remove_row.count(i) == 1)continue;
        ans.push_back("");
        rep(j, w) {
            if (remove_col.count(j) == 1)continue;
            ans.back().push_back(a[i][j]);
        }
    }

    rep(i, ans.size()) {
        cout << ans[i] << endl;
    }

}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            int[] r_c = Stream.of(sc.nextLine().split(" "))
                    .mapToInt(Integer::parseInt)
                    .toArray();
            int i = 0;
            int ta = 0;
            int[] tr = new int[r_c[1]];
            while (sc.hasNext()) {
                int[] es = Stream.of(sc.nextLine().split(" "))
                        .mapToInt(Integer::parseInt)
                        .toArray();
                if (es.length != r_c[1]) {
                    System.out.println("Condition is invalid.");
                    return;
                }
                es = Arrays.copyOf(es, es.length + 1);
                int tl = 0;
                for (int j = 0; j < es.length; j++) {
                    if (j == es.length - 1) {
                        es[j] = tl;
                        System.out.printf("%d\n", es[j]);
                        break;
                    }
                    System.out.printf("%d ", es[j]);
                    tl += es[j];
                    ta += es[j];
                    tr[j] += es[j];
                }
                ++i;
            }
            for (int r: tr) {
                System.out.printf("%d ", r);
            }
            System.out.printf("%d\n", ta);
            if (i != r_c[0]) {
                System.out.println("Condition is invalid.");
                return;
            }
        } catch (NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }
}



Measured memory_bytes: 48712
n = gets.to_i
g = []
h = []
a = gets.split.map(&:to_i)
a.each_with_index do |ai, idx|
  g[idx] = idx + 1 - ai
  h[idx] = idx + 1 + ai
end
g_hash = g.group_by{_1}
h_hash = h.group_by{_1}
count = 0
g_hash.each do |k, v|
  count += v.size * h_hash[k]&.size.to_i
end
puts count

Measured memory_bytes: 60600
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int r = 2*(a+b);
        int s = a*b;
        System.out.println(s+" "+r);
    }
}


Measured memory_bytes: 26188
#include <iostream>
#include <stack>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <numeric>
#include <vector>
using namespace std;
#define endl "\n"

int main() {
    ios::sync_with_stdio(false);
    int H,W,h,w;
    cin>>H>>W;
    cin>>h>>w;
    cout<<(H-h)*(W-w)<<endl;
}

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

    typedef long long ll;
    const long long LINF = 1LL << 60;
    const long long LMINF = 1LL << 63;
    const int INF = 1 << 30;

    #define REP(i,n) for(int i = 0;i < n;++i)
    #define REPS(i,x) for(int i = 1;i <= (int)(x);i++)
    #define RREP(i,x) for(int i=((int)(x)-1);i >= 0;i--)
    #define RREPS(i,x) for(int i=((int)(x));i > 0;i--)
    #define PB push_back
    #define F first
    #define S second
    #define MP make_pair
    #define ALL(obj) (obj).begin(),(obj).end()
    #define debug(x) cerr << #x << ": " << x << "\n"

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



    int main(){

        int a,b;
        cin >> a >> b;
        int cnt = 0;
        int aa = 1;

        while(aa < b){
            --aa;
            aa += a;
            cnt++;
        }
        cout << cnt << endl;
            
        return 0;
    }

Measured memory_bytes: 3596