akhauriyash/Code-Regression huggingface dataset:
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define ll long long
#define ull unsigned long long
#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10
#define P pair<int, int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }

int main() {
	int k, s, ans = 0;
	cin >> k >> s;
	for (int i = 0; i <= k; ++i) {
		for (int j = 0; j <= k; ++j) {
			int t = s - i - j;
			if (0 <= t && t <= k) {
				ans++;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
include Math
EPS = 1e-10

class AngleInterval
	def initialize(x0, y0, x1, y1, x2, y2)
		t1 = atan2(y1 - y0, x1 - x0)
		t2 = atan2(y2 - y0, x2 - x0)
		t1, t2 = t2, t1 if t2 < t1
		if t2 - t1 >= PI
			t1, t2 = t2, t1 + 2 * PI
		end
		@min, @max = t1, t2
	end

	def &(other)
		r = self.class.new(0, 1, 3, 2, 4, 5)	
		if empty? || other.empty?
			r.min = Float::INFINITY
			r.max = -Float::INFINITY
			return r
		end
		a = other.min
		b = other.max
		until b <= @max
			a -= 2 * PI
			b -= 2 * PI
		end
		until b >= @min
			a += 2 * PI
			b += 2 * PI
		end
		if a <= @min && @min <= b && b <= @max
			r.min = @min
			r.max = b
		elsif @min <= a && a <= @max && @max <= b
			r.min = a
			r.max = @max
		elsif @min <= a && b <= @max
			r.min = a
			r.max = b
		elsif a <= @min && @max <= b
			r.min = @min
			r.max = @max
		else
			r.min = Float::INFINITY
			r.max = -Float::INFINITY
		end
		r
	end

	def empty?
		@max - @min < EPS
	end

	attr_accessor :min, :max
end

def f(x0, y0, lines, interval = nil)
	return 1 if lines.empty? && interval && !interval.empty?		
	sum = 0
	lines.each do |l|
		x1, y1, x2, y2 = l
		r = AngleInterval.new(x0, y0, x1, y1, x2, y2)
		
		new_interval = (interval ? interval & r : r)
		next if new_interval.empty?

		t1 = atan2(y2 - y1, x2 - x1)
		new_lines = lines - [l]
		raise if new_lines.size != lines.size - 1
		new_lines.map! do |x3, y3, x4, y4|
			dx = x3 - x1
			dy = y3 - y1
			t2 = atan2(dy, dx)
			dt = -2 * (t2 - t1)
			x = [x1 + cos(dt) * dx - sin(dt) * dy, y1 + sin(dt) * dx + cos(dt) * dy]

			dx = x4 - x1
			dy = y4 - y1
			t2 = atan2(dy, dx)
			dt = -2 * (t2 - t1)
			y = [x1 + cos(dt) * dx - sin(dt) * dy, y1 + sin(dt) * dx + cos(dt) * dy]

			[*x, *y]
		end
		sum += f(x0, y0, new_lines, new_interval)
	end
	sum
end

loop do
	n = gets.to_i
	break if n == 0
	count = 0
	sx, sy = gets.split.map(&:to_i)
	points = (1..n).map { gets.split.map(&:to_i) }
	orig_lines = (points + [points[0]]).each_cons(2).to_a.map(&:flatten)
	p f(sx, sy, orig_lines)
end

Measured memory_bytes: 9476
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <stdio.h>

int main()
{
  long h,n=0,sum,k=1,i;
  scanf("%ld",&h);
  while(h!=0)
  {
      h=h/2;
      n=n+1;
      
  }
  for(i=0;i<n;i++)
  {
      k=k*2;
  }
  sum=(k-1);
  printf("%ld",sum);
  
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long
using namespace std;
int Read() {
	int x = 0, f = 1; char ch = getchar();
	while(!isdigit(ch)) {if(ch == '-')  f = -1; ch = getchar();}
	while(isdigit(ch)) {x = (x << 3) + (x << 1) + ch - '0'; ch = getchar();}
	return x * f;
}
signed main() {
	int x = Read(), y = Read();
	int cnt = 0;
	while(x <= y) {
		++cnt;
		x = x * 2;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3636
# coding :utf-8
N=int(input())

F=[]
P=[]

table = [2**i for i in range(10)]

for i in range(N):
    lis = list(map(int, input().split()))
    F.append(lis)
#print(F)
for i in range(N):
    lis = list(map(int, input().split()))
    P.append(lis)
#print(P)

maxx=-1000000000001


for i in range(1,1024):
    total=0
    for j in range(N):
        n=0
        for k in range(10):
            n +=(1 if i&table[k] !=0 else 0)*F[j][k]
        total += P[j][n]
    if total >maxx:
        maxx= total
print(maxx)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    static Scanner s = new Scanner(System.in);

    public static void main(String[] args) {
        int Q =s.nextInt();
        while (Q>0){
            Q--;

            int N =s.nextInt();
            int num=0;

            while(N>9){
                num++;
                int max=0;

                for(int i=1;i<String.valueOf(N).length();i++) {
                    int div1 = N/(int)(Math.pow(10,i));
                    int div2 = N%(int)(Math.pow(10,i));
                    if(max<div1*div2){
                        max=div1*div2;
                    }
                }
                N=max;
            }
            System.out.println(num);
        }
    }
}

Measured memory_bytes: 24552
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N; cin>>N;
	vector<int> A(N);
	for (int i=0; i<N; i++)
		cin>>A[i];
	map<int,int> ct;
	for (int i=0; i<N; i++)
		ct[A[i]-i]++;
	ll ret=0;
	for (int i=0; i<N; i++) {
		ret+=ct[-(A[i]+i)];
//		cout<<i<<" "<<ct[-(A[i]+i)]<<endl;
	}
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 21080
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;

typedef unsigned int uint;
typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18
// cout << fixed << setprecision(10);

int main() {
    string S, T;
    cin >> S;
    cin >> T;

    if (T.size() != (S.size() + 1)) {
        cout << "No" << endl;
        return 0;
    }
    for (size_t i=0; i<S.size(); i++) {
        if (S[i] != T[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3620
##### ABC103-D-Islands War
n,m = map(int,input().split())
l = [list(map(int,input().split())) for _ in range(m)]

l.sort(key=lambda x:x[1])


#c -> 区切り
c = 0

ans = 0

for a,b in l:
    if a >= c:
        c = b
        ans += 1

print(ans)

Measured memory_bytes: 29084
#include<stdio.h>
#include <stdbool.h>
int main(){
   int n;
   bool judge = false;
   scanf("%d", &n);
   int a[1000];
   for(int i=0;i<n;i++){
      scanf("%d", &a[i]);
   }
   for(int i=0;i<n;i++){
      if(a[i]%2==0){
         if( a[i]%5!=0 && a[i]%3!=0 ){
            judge = true;
         }
      }
   }
   if(judge){
      printf("DENIED\n");
   }else{
      printf("APPROVED\n");
   }
   return 0;
}


Measured memory_bytes: 1640
// D - joisino's travel
#include <bits/stdc++.h>
using namespace std;
// using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)
#define all(x) (x).begin(),(x).end()

#define DIST_MAX 1000000000

// ワーシャルフロイド法
// 複数経路の最短距離を求めるのに有効
// 重みが負のときは使えない
void warshall_floyd(vvi &D){//D: distance
	rpz(relay,D.size()) rpz(from,D.size()) rpz(to,D.size())
		D[from][to] = min(D[from][to], D[from][relay] + D[relay][to]);
}

int main(){
	int N,M,R; cin>>N>>M>>R;
	vi RR(R);
	rpz(i, R){ cin>>RR[i]; RR[i]--; }

	// for(auto e:RR){printf("%d ",e);}puts("\n--");///

	vvi D(N, vi(N, DIST_MAX));
	rpz(i, N) D[i][i] = 0;
	rpz(i, M) rpz(j, 3){ int a,b,c; cin>>a>>b>>c; D[a-1][b-1] = D[b-1][a-1] = c; }

	// for(auto v:D){for(auto e:v){printf("%d ",e);}puts("");}puts("---");//
	warshall_floyd(D);
	// for(auto v:D){for(auto e:v){printf("%d ",e);}puts("");}puts("---");//

	int ans = DIST_MAX;
	sort(all(RR));
	do{
		// rpz(i,R){printf("%d ",RR[i]);}puts("");//
		int d = 0;
		rpz(i, R-1) d += D[RR[i]][RR[i+1]];
		ans = min(ans, d);
	}while(next_permutation(all(RR)));//順列生成

	cout<< ans <<endl;
}


Measured memory_bytes: 384
/*

This question is nice application of Matrix Chain Multiplication.
because here we have to partition the range into two parts like we do in MCM
and after that calculate the answer on those parts which will be furthur used 
to find the answer.

created by sanyam singhal
*/

#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long int
#define mod 1000000007
#define w(t) int t;	cin>>t while(t--)
#define triplet pair<int,pair<int,int>>
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define fastIO ios_base::sync_with_stdio(0);	cin.tie(0);	cout.tie(0);
#define loop(i, k, n) for(ll i=k; i<n; i+=1)
#define loop2(i, k, n) for(ll i=k; i>=n; i--)

const ll inf = 1e18;
const int N = 500;

ll dp[N][N];
ll sumij[N][N];

// void take_fileIO(){
//   #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
//   #endif
//   return;
// }

ll solve_by_dp(vector<ll> &a, ll i, ll j){
  if(j==i){ // if the size is 1 then we dont need to combine it with anything
    return 0;
  }
  else if(dp[i][j]!=-1)
    return dp[i][j];
  else{
    ll ans = LLONG_MAX;
    for(ll k=i+1; k<=j; k++){
      ll part1 = solve_by_dp(a, i, k-1);  //solving for range (i, k-1)
      ll part2 = solve_by_dp(a, k, j);    //solving for range (k, j)

      //after we have calculated cost for combining the slimes in separate parts
      //then our answer will be sum of cost for those parts and
      //cost which will be incurred when we combine these two slimes which is nothing but sum of elements in this range.
      ll curr_ans = part1 + part2 + sumij[i][j];
      // cout<<curr_ans<<endl;
      if(curr_ans < ans){
        ans = curr_ans;
      }
    }
    return dp[i][j] = ans;
  }
}

void solve(){
  ll n; cin>>n;
  vector<ll>a(n);
  loop(i, 0, n) 
    cin>>a[i];

  memset(dp, -1, sizeof(dp));
  // loop(i, 0, n)
  //   cout<<a[i]<<" ";

  for(int i=0; i<n; i++){
    for(int j=i; j<n; j++){
      if(i==j){
        sumij[i][j] = a[j];
        continue;
      }
      sumij[i][j] = a[j] + sumij[i][j-1];
    }
  }

  // for(int i=0; i<n; i++){
  //   for(int j=0; j<n; j++){
  //     cout<<sumij[i][j]<<" ";
  //   }
  //   cout<<endl;
  // }

  cout<<solve_by_dp(a, 0, n-1)<<endl;
  return;
}

int main(){

  fastIO;
  // take_fileIO();
  solve();
  return 0;
}

Measured memory_bytes: 3840
n = gets.to_i
as = gets.chomp.split.map(&:to_i)
q = gets.to_i
hash = Hash.new(0)
sum = as.inject(:+)
as.each do |a|
  hash[a] += 1
end

ans = []

q.times do
  b,c = gets.chomp.split.map(&:to_i)
  cnt_b = hash[b]
  cnt_c = hash[c]
  sum += cnt_b * (c - b)
  ans << sum
  hash[c] += hash[b]
  hash[b] = 0
end

ans.each{|k| puts k}


Measured memory_bytes: 26620
/*================================================
# ~  file:B.cpp
# ~~ date:2020-02-22
# ~~~author: SoMnus_L
#        |everybody finds love,in the end|
#   人の運命か,人の希望は悲しみにつづられているね
=================================================*/

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#define ll long long
const int N=1e6+10;
using namespace std;
typedef pair<int,int>PII;

int n,k;
int ans=0;
int main(){
 ios::sync_with_stdio(false);
   cin>>n>>k;
   while(n){
    n/=k;
     ans++;    
   }
    cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<60;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    string s;cin>>s;
    int n=s.size();
    if(n%2==1){if(s[0]==s[n-1])cout<<"Second"<<endl;
    else cout<<"First"<<endl;
              }
  else{
    if(s[0]!=s[n-1])cout<<"Second"<<endl;
    else cout<<"First"<<endl;
              }
}






Measured memory_bytes: 512
n,x,y = map(int,input().split())

l= [0]*n

for i in range(1,n+1):
    for j in range(i+1,n+1):
        k = min(abs(j-i),abs(x-i)+1+abs(j-y))
        l[k] += 1

for k in range(1,n):
    print(l[k])

Measured memory_bytes: 73884
#include "bits/stdc++.h"
using namespace std;
int d;
int dd[50];
int fib(int a){
	if(a==0||a==1)return dd[a]=1;
	if(dd[a]!=-1)return dd[a];
	return dd[a]=fib(a-1)+fib(a-2);
}

int main() {
int c;
cin>>c;
for (int i = 0; i < 50; ++i) {
	dd[i]=-1;
}

cout<<fib(c)<<endl;
	return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

ll calc(ll n, ll x){
    if(n==0) return 1;
    ll b = (1LL<<(n+1))-3;
    ll p = (1LL<<n) - 1;
    if(x==1) return 0;
    if(x<=1+b) return calc(n-1, x-1);
    if(x==2+b)   return p+1;
    if(x<=2+2*b) return   p + 1 + calc(n-1, x-2-b);
    return 2*p+1;

}


int main(){
    ll n, x;   cin >> n >> x;

    cout << calc(n, x) << endl;
}

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

long calc(long x, long y);

int main() {
    int a, b;
    cin >> a >> b;
    if(a + b >= 10) cout << "error" << endl;
    else cout << a + b << endl;
}


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

using namespace std;
using llong = long long;

int main(){
  int A,B,C,X,Y;
  int na,nb,nc;
  cin >> A >> B >> C >> X >> Y;
  if(X>Y) {
    swap(A,B);
    swap(X,Y);
  }

  if(A+B > 2*C) {
    cout << min(X*2*C+(Y-X)*B,Y*2*C) << endl;
  }else{
    cout << A*X+B*Y << endl;
  }
  return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val s = readLine() ?: return
    val mod = 1000000000 + 7
    val n = s.length

    var dp = listOf(1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L)

    for (i in 0 until n) {
        val c = s[i]
        val ndp = mutableListOf(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L)
        if (c != '?') {
            val num = c.toString().toInt()
            for (m in 0 until 13) {
                ndp[(m * 10 + num) % 13] += dp[m]
            }
        } else {
            for (num in 0 until 10) {
                for (m in 0 until 13) {
                    ndp[(m * 10 + num) % 13] += dp[m]
                }
            }
        }
      
        dp = ndp.map { it % mod }
    }

    println(dp[5])
}

Measured memory_bytes: 118928
M, D = map(int, input().split())

count = 0
for m in range(1, M + 1):
    for d in range(1, D + 1):
        d10, d1 = divmod(d, 10)
        if d1 >= 2 and d10 >= 2 and d1 * d10 == m:
            count += 1
print(count)


Measured memory_bytes: 2940
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#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 rep(i,n) for(int i=0;i<(n); i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define WHITE 0
#define GRAY 1
#define BLACK 2

using namespace std;
typedef long long ll;
const int NMAX = 100000;
const int k = 200000;
static const int INF = 1<<21;
static const int NIL = -1;

int dp[3001][3001];
ll gcd(ll a, ll b){
if(a<b) swap(a,b);
    if(b==0) return a;
    return gcd(b, a%b);
}

int n,color[NMAX];
vector<int> G[NMAX];

void dfs(int r,int c){
    stack<int> S;
    S.push(r);
    color[r] = c;
    while(!S.empty()){
        int u=S.top();
        S.pop();
        rep(i,G[u].size()){
            int v=G[u][i];
            if(color[v]==NIL){
                color[v]=c;
                S.push(v);
            }
        }
    }
}

void assignColor(){
    int id=1;
    rep(i,n) color[i]=NIL;
    rep(u,n){
        if(color[u]==NIL){
            dfs(u,id++);
        }
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0); //この2行はより速度を向上させる
    // 追加２, 以降 cin の入力元が 'input.txt' になる


    int m,s,t,q;
    cin >> n >> m;
    rep(i,m){
        cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s); //無向グラフなので双方に格納する
    }
    assignColor(); //色塗り

    cin >> q;

    rep(i,q){
        cin >> s >> t;
        if(color[s]==color[t]){
            cout << "yes" << endl;
        }else{
            cout << "no" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 8996
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define mod ((ull)(1e9)+7)
#define MAX ((ull)(1e9)+1)

int main(){
	string s;
	cin >> s;
	if(s=="A") cout << "T" << endl;
	if(s=="T") cout << "A" << endl;
	if(s=="C") cout << "G" << endl;
	if(s=="G") cout << "C" << endl;
	return 0;
}

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

#define INF 100100100

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

  int a, b, h, m;
  cin >> a >> b >> h >> m;
  double alpha = (h * 60 + m) * M_PI / 360;
  double beta = M_PI * m / 30;
  double ans = sqrt(a*a + b*b - 2*a*b*cos(beta - alpha));
  printf("%.9lf\n", ans);

  return 0;
}


Measured memory_bytes: 4156
object Main{
  def main(args: Array[String]){
    if (sys.env.getOrElse("TEST", "")=="1"){
      println(test());
    }else{
      val input=io.Source.stdin.getLines().mkString("\n");
      println(solve(input).trim());
    }
  }

  def solve(input:String):String={
    val List(n,a,b)=input.split(" ").map(_.toInt).toList;
    (1 to n).filter(x=>bitween(x.toString().split("").filter(_.length!=0).map(_.toInt).sum,a,b)).sum.toString()
  }

  def bitween(x:Int,min:Int,max:Int)=min<=x&&x<=max;

  val tests=List("""20 2 5""" -> """84""",
    """10 1 2""" -> """13""",
"""100 4 16"""->"""4554""");

  def test():String= {
    return tests.map{case (i,o)=>(i.trim(),o.trim())}.zipWithIndex.map{case ((input,outputExpect),i)=>{
      val output=solve(input).trim();
      s"test${i+1}:"+(if(output==outputExpect){
        "Passed"
      }else{
        s"Failed\nexpect:\n${outputExpect}\noutput:\n${output}"
      })
    }}.mkString("\n");
  }
}

Measured memory_bytes: 39256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a[100005],n,h,ans=0;
	cin>>n;
	for(int i=1;i<=100000;i++)
		a[i]=0;
	for(int i=1;i<=n;i++)
	{
		cin>>h;
		if(h<=100000)
		{
			a[h]++;
			ans++;
			if(a[h]==h)
				ans-=h;
		}
		else
			ans++;	
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>

#include <iomanip>
#include <list>
#define fo(i,n) for(int i=0;i<n;i++)
#define ll long long


using namespace std;
int main(){
int n,k;
cin>>n;
cin>>k;
int cnt=0;
fo(i,n){
    int a;
    cin>>a;
    if(a>=k) cnt++;
}
cout<<cnt;

}

Measured memory_bytes: 384
N = int(input())
xyh = [list(map(int,input().split())) for i in range(N)]

xyh_hNonzero = sorted(xyh, reverse=True, key=lambda x:x[2])[0]

for cx in range(101):
  for cy in range(101):
    h = abs(xyh_hNonzero[0] - cx) + abs(xyh_hNonzero[1] - cy) + xyh_hNonzero[2]
    for i in range(N):
      if xyh[i][2] == 0:
        if abs(xyh[i][0] - cx) + abs(xyh[i][1] - cy) < h:
          break
      elif abs(xyh[i][0] - cx) + abs(xyh[i][1] - cy) + xyh[i][2] != h:
        break
    else:
      print(' '.join(map(str, [cx,cy,h])))
      exit()
else:
  raise Exception('aaa!!!')

Measured memory_bytes: 3064
#include <stdio.h>
typedef long long ll;
#define rep(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
ll gcd(ll a, ll b){if(a%b==0)return b;else gcd(b,a%b);}


int main(void){
    ll N;
    scanf("%lld",&N);
    ll A[N+1];
    rep(i,0,N,1){
        scanf("%lld",&A[i]);
    }
    ll ans=gcd(A[0],A[1]);
    rep(i,2,N,1){
        ans=gcd(ans,A[i]);
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 2512
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
 
/*---------------------------------------------------*/

struct edge{int to;int cost;};
vector<edge> g[100005];
ll d[100005];
 
void dijkstra(int s){
  priority_queue<pi,vector<pi> ,greater<pi> >que;
  fill(d,d+100005,LINF);
  d[s]=0;
  que.push(mp(0,s));
  while(!que.empty()){
    pi p=que.top();que.pop();
    int v=p.second;
    if(d[v]<p.first)continue;
    for(int i=0;i<int(g[v].size());i++){
      edge e=g[v][i];
      if(d[e.to]>d[v]+e.cost){
	d[e.to]=d[v]+e.cost;
	que.push(mp(d[e.to],e.to));
      }
    }
  }
}

int main(){
    int n, a, b, c, q, k, x, y;
    cin >> n;
    rep(i, n - 1){
        cin >> a >> b >> c;
        edge e = {b, c};
        g[a].pb(e);
        e = {a, c};
        g[b].pb(e);
    }
    cin >> q >> k;
    dijkstra(k);
    rep(i, q){
        cin >> x >> y;
        cout << d[x] + d[y] << endl;;
    }
    return 0;
}


Measured memory_bytes: 8820
#include <iostream>
#include <climits>
#include <vector>

const long long INF = 1LL << 60; //e+9を足してもオーバーフローしないサイズをINFとする

using namespace std;

template <class T>
bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;

        return true;
    }

    return false;
}

int main(void)
{
    long long N, W;

    cin >> N >> W;

    vector<long long> w(N), v(N);

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

    vector<vector<long long>> dp(N + 1, vector<long long>(100001, INF));

    dp[0][0] = 0;

    for (int i = 0; i < N; i++)
    {
        for (int v_i = 0; v_i < 100002; v_i++)
        {
            if (v_i - v[i] >= 0)
            {
                chmin(dp[i + 1][v_i], dp[i][v_i - v[i]] + w[i]);
            }
            chmin(dp[i + 1][v_i], dp[i][v_i]);
        }
    }

    int ans = -1;

    for (int i = 100000; i >= 0; i--)
    {
        if (dp[N][i] <= W && i > ans)
        {
            ans = i;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 80256
n = int(input())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))

def calc(X, Y, p):
    count = 0
    for x, y in zip(X, Y):
        a = abs(x - y)
        count += a ** p
    return count ** (1 / p)

print(calc(X, Y, 1))
print(calc(X, Y, 2))
print(calc(X, Y, 3))
print(max(abs(x - y) for x, y in zip(X, Y)))



Measured memory_bytes: 5644
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    ll a,b;
    cin >> a >> b;
    int k;
    cin >> k;
    for(int i=a;i<b+1;i++){
        if(i<a+k)cout << i << endl;
        else if(i>b-k) cout << i << endl;
    }
}


Measured memory_bytes: 256
n,K=[int(x) for x in input().split()]
ans=0
from collections import defaultdict
d=defaultdict(int)
for i in [0]*n:
    d[input()[0]]+=1
while True:
    for j,_ in zip(sorted(d.items(),key=lambda x:x[1],reverse=True),[0]*K):
        k,v=j
        if v==0 or len(d)<K:
            print(ans//K)
            import sys
            sys.exit()
        ans+=1
        d[k]-=1

Measured memory_bytes: 46424
from collections import deque
h,w,k=map(int,input().split())
x1,y1,x2,y2=map(lambda x:int(x)-1,input().split())
cmap=[input() for _ in range(h)]
inf=float('inf')
seen=[[[(inf,inf)]*4 for _ in range(w)] for _ in range(h)]
D=[(-1,0),(0,1),(1,0),(0,-1)]# 上:0, 右:1, 下:2, 左:3
q=deque()
for d in range(4):
  seen[x1][y1][d]=(1,0)
  q.append((x1, y1, d, 1, 0)) # (x, y, 進行方向[d], 移動回数[c], 進行済マス数[k])
while q:
  x,y,d,c,k_=q.popleft()
  # nx, ny: 次の座標
  # nd: 次の進行方向
  # nc: 次の移動回数
  # nk: 次の進行済マス数
  for nd in range(4):
    if nd==d:
      dx,dy=D[nd]
      nk=1 if k_==k else k_+1
      nc=c+1 if k_==k else c
    else:
      dx,dy=0,0
      nk=0
      nc=c+1
    nx=x+dx;ny=y+dy
    if 0<=nx<h and 0<=ny<w and cmap[nx][ny]!='@' and seen[nx][ny][nd]>(nc,nk):
      seen[nx][ny][nd]=(nc,nk)
      if nc==c: # 同一方向に進むケースは次のループで一番はじめに処理する。
        q.appendleft((nx,ny,nd,nc,nk))
      else:
        q.append((nx,ny,nd,nc,nk))
ans=inf
for d in range(4):
  ans=min(ans,seen[x2][y2][d][0])
ans=-1 if ans==inf else ans
print(ans)

Measured memory_bytes: 400412
#include <stdio.h>

int main ( )
{
    long long s,c;
    while (scanf("%lld %lld",&s,&c)!=EOF)
    {
        if (c<2*s)
            printf("%lld\n",c/2);
        else
            printf("%lld\n",s+(c-2*s)/4);
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

#define N 26
#define MAX_T 1.9

const int INF = 1 << 30;
const double mean = 0.0;
const double stddev = 1.0;

int c[N];
int s[365][N];
int last[N];

std::chrono::time_point<std::chrono::steady_clock> start, endt;

random_device rd;
mt19937 generator(rd());
uniform_real_distribution<> dist_real(0.0, 1.0);
uniform_int_distribution<> dist_int(0, RAND_MAX);

struct ContestInfo {
	int D;
	long score;
	long best_score;
	vector<int> t;
	vector<int> best_t;
	set<int> held[N];
	ContestInfo(int dd) : D(dd), score(0) {
		t.resize(D, -1);
		for (int i = 0; i < N; i++) {
			held[i].insert(-1);
			held[i].insert(D);
			score -= c[i] * D * (D + 1) / 2;
		}
	}

	void add(int dd, int qq) {
		if (t[dd] != -1) {
			cout << "Add faild!" << endl;
			exit(1);
		}

		t[dd] = qq;
		score += s[dd][qq];
		held[qq].insert(dd);
		auto itr = held[qq].find(dd);
		auto ritr = next(itr);
		auto litr = prev(itr);
		auto range = [](int l, int r) {
			int k = r - l - 1;
			return -k * (k + 1) / 2;
		};
		score -= c[qq] * range(*litr, *ritr);
		score += c[qq] * (range(*litr, *itr) + range(*itr, *ritr));
	}

	void erase(int dd) {
		if (t[dd] == -1) {
			cout << "Erase faild!" << endl;
			exit(1);
		}
		int qq = t[dd];
		t[dd] = -1;
		score -= s[dd][qq];
		auto itr = held[qq].find(dd);
		auto ritr = next(itr);
		auto litr = prev(itr);
		auto range = [](int l, int r) {
			int k = r - l - 1;
			return -k * (k + 1) / 2;
		};
		score += c[qq] * range(*litr, *ritr);
		score -= c[qq] * (range(*litr, *itr) + range(*itr, *ritr));
		held[qq].erase(itr);
	}

	void change(int dd, int qq) {
		erase(dd);
		add(dd, qq);
	}

	void save() {
		best_t = t;
		best_score = score;
	}

	void output(bool show = false) {
		for (int i = 0; i < D; i++)
			cout << best_t[i] + 1 << endl;
		if (show) cout << best_score << endl;
	}
};

double dice() {
	return dist_real(generator);
}

double prob(double rem) {
	return 1.0 / exp(rem) / 2;
}

void tic() {
	start = std::chrono::steady_clock::now();
}

double toc() {
	endt = std::chrono::steady_clock::now();
	std::chrono::duration<double> elapsed_seconds = endt - start;
	return elapsed_seconds.count();
}

int main() {
	int d;
	cin >> d;
	for (int i = 0; i < N; i++)
		cin >> c[i];
	for (int i = 0; i < d; i++) {
		for (int j = 0; j < N; j++) {
			cin >> s[i][j];
		}
	}

	tic();
	int t;
	ContestInfo ci(d);
	for (int i = 0; i < d; i++) {
		t = max_element(s[i], s[i] + N) - s[i];
		ci.add(i, t);
	}

	int current_score = ci.score;
	int best_score = current_score;
	ci.save();

	int dd, qq;
	while (toc() < MAX_T) {
		dd = dist_int(generator) % d;
		qq = dist_int(generator) % N;
		int old_q = ci.t[dd];
		ci.change(dd, qq);
		long new_score = ci.score;
		if (new_score < current_score && prob(MAX_T - toc()) < dice()) {
			ci.change(dd, old_q);
		} else {
			current_score = new_score;
			if (best_score < current_score) {
				best_score = current_score;
				ci.save();
			}
		}
	}
	ci.output();
}

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

using namespace std;

using int64 = long long;

struct WeightedEdge {
  int from, to;
  int64 weight;
};

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

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

  int n, m;
  int64 p;
  cin >> n >> m >> p;

  vector<vector<WeightedEdge>> graph(n);
  for (int i = 0; i < m; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    graph[a].push_back(WeightedEdge{a, b, p - c});
  }

  vector<int64> distances(n, INT64_MAX);
  distances[0] = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int v = 0; v < n; v++) {
      for (const auto& e : graph[v]) {
        if (distances[e.from] == INT64_MAX) continue;
        UpdateMin(distances[e.to], distances[e.from] + e.weight);
      }
    }
  }
  int64 ans = distances[n - 1];

  for (int i = 0; i < n - 1; i++) {
    for (int v = 0; v < n; v++) {
      for (const auto& e : graph[v]) {
        if (distances[e.from] == INT64_MAX) continue;
        UpdateMin(distances[e.to], distances[e.from] + e.weight);
      }
    }
  }

  if (distances[n - 1] < ans) {
    cout << -1 << endl;
  } else {
    cout << max(-distances[n - 1], 0LL) << endl;
  }
}


Measured memory_bytes: 512
package main

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

func main() {
	var scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	var nextInt = func() int {
		scanner.Scan()
		n, _ := strconv.Atoi(scanner.Text())
		return n
	}

	n := nextInt()
	q := nextInt()

	graph := make([][]int, n)
	for i := 1; i < n; i += 1 {
		a := nextInt() - 1
		b := nextInt() - 1
		graph[a] = append(graph[a], b)
		graph[b] = append(graph[b], a)
	}
	p := make([]int, n)
	for i := 0; i < q; i += 1 {
		v := nextInt() - 1
		x := nextInt()
		p[v] += x
	}

	ans := make([]int, n)
	ans[0] = p[0]
	Dfs(0, 0, graph, p, ans)
	for i, a := range ans {
		if i > 0 {
			fmt.Print(" ")
		}
		fmt.Print(a)
	}
	fmt.Println()
}

func Dfs(v int, p int, graph [][]int, point []int, ans []int) {
	for _, next := range graph[v] {
		if next == p {
			continue
		}
		ans[next] += ans[v]
		ans[next] += point[next]
		Dfs(next, v, graph, point, ans)
	}
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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(){
    char a, b;
    cin >> a >> b;
    if(a < b) cout << '<' << endl;
    if(a == b) cout << '=' << endl;
    if(a > b) cout << '>' << endl;
}

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

using namespace std;

const int MOD = 1000 * 1000 * 1000 + 7;

int mul(int a, int b)
{
	return (1LL * a * b) % MOD;
}

int fact(int n)
{
	int ans = 1;
	for (int i = 1; i <= n; ++i) {
		ans = mul(ans, i);
	}
	return ans;
}


int solve(int N, int M)
{
	switch (abs(N - M)) {
	case 0:
		return mul(2, mul(fact(N), fact(M)));
	case 1:
		return mul(fact(N), fact(M));
	default:
		return 0;
	}
}

int main()
{
	int N, M;
	cin >> N >> M;
	cout << solve(N, M) << endl;
}


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

int main()
{
  int n,k;
  cin >> n >> k;
  int x[n];
  for(int i=0;i<n;++i){
    cin >> x[i];
  }
  
  int ans=300000000;
  for(int i=0;i<=n-k;++i){
    ans=min(min(abs(x[i])+abs(x[i+k-1]-x[i]),abs(x[i+k-1])+abs(x[i+k-1]-x[i])),ans);
  }
  cout << ans;
  return 0;
}

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

int main() {
  int A, B; cin >> A >> B;

  int sum = 1;
  int count = 0;
  while (true) {
    if (sum >= B) {
      break;
    }
    sum += A - 1;
    count++;

  }
  cout << count << endl;
}

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

int main() {
    int n, m; cin >> n >> m;
    vector<string> data(n); rep(i,n) cin >> data[i];

    rep(i,n) {
        rep(j,m) {
            if (data[i][j] == '#') cout << '#';
            else if (j == 0) cout << '#';
            else if (j == m - 1) cout << '.';
            else if (i % 2 == 0) cout << '#';
            else cout << '.';
        }
        cout << endl;
    }

    cout << endl;

    rep(i,n) {
        rep(j,m) {
            if (data[i][j] == '#') cout << '#';
            else if (j == m - 1) cout << '#';
            else if (j == 0) cout << '.';
            else if (i % 2 == 1) cout << '#';
            else cout << '.';
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int a,b; cin>>a>>b;
    if(a>b) a--;
    cout<<a<<endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
  set<int> product;
  for(int i=1;i<=9;i++)
    for(int j=1;j<=9;j++){
      product.insert(i*j);
    }
  int n;cin>>n;
  cout<<(product.find(n)!=product.end()?"Yes":"No")<<endl;
  
}


Measured memory_bytes: 256
k, t = map(int, input().split())
a = [int(x) for x in input().split()]

if t == 1:
  ans = k-1
else:
  key = max(a)
  if key <= (k+1)//2:
    ans = 0
  else:
    ans = 2*key-k-1

print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int yi,ling,fuyi,sum,ans=0;
	cin>>yi>>ling>>fuyi>>sum;
	while(yi>0&&sum>0)
	{
		yi--;
		sum--;
		ans++;
	}
	while(ling>0&&sum>0)
	{
		ling--;
		sum--;
		ans;
	}
	while(fuyi>0&&sum>0)
	{
		fuyi--;
		sum--;
		ans--;
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
    long long N, res;
    res = 0;

    cin >> N;

    for(int i = 1; i <= N; i++){
        if(i % 3 != 0 && i % 5 != 0){
            res += i;
        }
    }

    cout << res << endl;

    return 0;
}

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

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

  int count = 0;
  for(int i = 0;i < N;i++){
    bool flag = true;
    for(int j = 0;j < i;j++){
      if(a[i] < a[j])flag = false;
    }

    if(flag)count++;
  }

  cout << count << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <ctime>
#include <map>
#include <stack>
#include <sstream>

using namespace std;

int main(void)
{
	int count[26] = { 0, };
	char temp;

	while (1)
	{
		scanf("%c", &temp);
		if (temp == '\n')
		{
			break;
		}
		count[temp - 'a'] += 1;
	}

	for (int i = 0; i < 26; i++)
	{
		if (count[i] % 2 == 1)
		{
			cout << "No" << endl;
			return 0;
		}
	}

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

Measured memory_bytes: 256
using System;

namespace ABC152B
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] str = Console.ReadLine().Split(' ');
			int a = int.Parse(str[0]);
			int b = int.Parse(str[1]);
			int c;
			int d;
			double ans = 0;
			if (a < b)
			{
				c = a; d = b;
			}
			else 
			{
				c = b; d = a;
			}

			for(int i = 0; i < d; i++)
			{
				ans += c * Math.Pow(10, i);
				
			}
			Console.WriteLine(ans);
		}
	}
}


Measured memory_bytes: 13140
#include<iostream>
#include<vector>
#include <cassert>
#include<algorithm>
#include <tuple>
#include <utility>
#include<string>
#include <cmath>
#include <functional>
#include<set>
#define ll long long
using namespace std;

ll v[100005];

int main(){
    ll x,y,N,Q,ans=0;
    cin >> N;
    vector<ll>A,B,C;
    for(int i = 0; i < N; i++){
        cin >> x;
        A.push_back(x);
        v[x]++;
        ans += x;
    }
    cin >> Q;
    for(int i = 0; i < Q; i++){
        cin >> x >> y;
        B.push_back(x);
        C.push_back(y);
    }
    for(int i = 0; i < Q; i++){
        x = B[i];
        y = C[i];
        ans -= x*v[x];
        ans += y*v[x];
        v[y] += v[x];
        v[x] = 0;
        cout << ans << endl;
    }
    sort(A.begin(),A.end());
}


Measured memory_bytes: 7112
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define len length
#define mp make_pair
#define pq priority_queue
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define forn(i,n) for (int i = 0; i < int(n); ++i)
#define take(v) for(int i=0;i<(int)v.size();i++){cin>>v[i];}
#define printvec(v) for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define printds(x) while(!x.empty()){cout<<x.top()<<" ";x.pop();}
#define input(n) int n;cin>>n;
#define PI 3.141592653589793238463
#define lnput(n) long long int n;cin>>n;
#define fr(i,s,e) for(int i=s;i<e;i++)
#define ms(arr,val) memset(arr,val,sizeof(arr))
using namespace std;
vector<ll> v;
vector<ll> w;
vector<vector<ll>> dp;
int main()
{
  speed;
  input(n)input(wt)
  v.resize(n);
  w.resize(n);
  dp.resize(n+1,vector<ll>(wt+1));
  for(int i = 0;i<n;i++) {
    cin>>w[i]>>v[i];
  }
  for(int i = 0;i<=wt;i++) {
    dp[0][i] = 0;
  }
  for(int i = 1;i<=n;i++) {
    for(int j = 0;j<=wt;j++) {
      if(w[i-1] > j) {
        dp[i][j] = dp[i-1][j];
      } else {
        dp[i][j] = max(dp[i-1][j],dp[i-1][j-w[i-1]] + v[i-1]);
      }
    }
  }
  cout<<dp[n][wt];
  return 0;
}


Measured memory_bytes: 83204
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <cmath>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()
#define mkpr(x1,x2) make_pair(x1,x2)
typedef long long int ll;


//stack<char> stk;
//set<ll> sll;
//set<pair<ll,ll>> spll;
//map<string,ll> mp;
//map<pair<ll,ll>,ll>::iterator iter;
//map<ll,ll> mp;
//deque<ll> deq;
//vector<ll> vll;
ll num[ten5];
//priority_queue<ll> pq;          //decreasing

int main(void)
{
    ll m,n,i,j,k=0;
    string s;
    cin>>s;
    for(i=0;i<s.size();i++)
        if(s[i]=='R')
            k++;
    if(k<2) cout<<k;
    else
    {
        if(s[1]=='R') cout<<k;
        else cout<<1;
    }
    return 0;
}





Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
static const int inf = 1 << 30;

int main(void) {
  long long N, M;
  cin >> N >> M;
  cout << abs((N - 2) * (M - 2)) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x,y;
  cin >> x >> y;
  if( x%y==0){
    cout << -1;
  }
  else{
    for(long i =x;;i++){
    if(i%y!=0){
      cout << i;
      break;
    }
  }
  }
}


Measured memory_bytes: 764
import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char

main = do
  [n, m, x] <- map (read::String -> Int) . words <$> getLine
  arr <- map (read::String -> Int) . words <$> getLine
  let cost1 = foldl (\acc i -> if i < x then acc + 1 else acc) 0 arr
      cost2 = m - cost1
  print $ min cost1 cost2

Measured memory_bytes: 892
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

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

int bfs(vector<string> &v){
    int H = v.size();
    int W = v[0].size();

    vector<vector<int>> dist(H,vector<int>(W,-1));
    queue<pair<int,int>> que;
    que.push(pair<int,int>(0,0));
    dist[0][0] = 1;

    while(!que.empty()){
        int x = que.front().first;
        int y = que.front().second;
        que.pop();
        for(int dir=0;dir<4;dir++){
            int nx = x+dx[dir] , ny = y+dy[dir];
            if(nx<0 or nx>=H or ny<0 or ny>=W) continue;
            if(v[nx][ny] == '#') continue;
            if(dist[nx][ny] == -1){
                dist[nx][ny] = dist[x][y] + 1;
                que.push(pair<int,int>(nx,ny));
            }
        }
    }

    return dist[H-1][W-1];
}


int main(){
    FIN;
    int H,W;
    cin >> H >> W;
    vector<string> v(H);
    int black = 0;
    for(int i=0;i<H;i++){
        cin >> v[i];
        for(int j=0;j<W;j++){
            if(v[i][j] == '#') black++;
        }
    }

    int dist = bfs(v);
    if(dist == -1) cout << -1 << endl;
    else cout << H*W - dist - black << endl;

    return 0;
}



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

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define read()          freopen("fibsubseq.in","r",stdin)
#define write()         freopen("fibsubseq.out","w",stdout)
#define sf(n)           scanf("%d",&n)
#define sfd(n)          scanf("%lf",&n)
#define sl(x)           scanf("%I64d",&x)
#define sfl(n)          scanf("%lld", &n)
#define sfc(n)          scanf(" %c",&n)
#define sful(n)         scanf("%llu",&n)
#define ull             unsigned long long int
#define endll           printf("\n")
#define pf              printf
#define pi              acos(-1.0)
#define eps             1e-10
#define mem(a,b)        memset(a,b,sizeof(a))
#define pb              push_back
#define xx              first
#define yy              second
#define pii             pair<int, int>
#define pll             pair<ll, ll>
#define MP make_pair
#define ll              long long
#define uniq(a)      a.erase(unique(a.begin(), a.end()), a.end())

bool Check(unsigned int  N,int pos){return (bool)(N & (1LL<<pos));}
ll  Set(unsigned int N,int pos){    return N=N | (1LL<<pos);}
#define cnd tree[idx]
#define lnd tree[idx<<1]
#define rnd tree[(idx<<1)+1]
#define lndp (idx<<1),(b),((b+e)>>1)
#define rndp ((idx<<1)+1),(((b+e)>>1)+1),(e)
#define inf 1999999999
#define MX 100005
#define mod  1000000007
#define mod1 1000000009
#define var    int ii,i,j,k,z=0,c=0,t,x,y,l,r,mid
//int dx[8]={0,0,1,1,-1,-1,1,-1};  //8 direction
//int dy[8]={1,-1,1,-1,1,-1,0,0};

bool chk(int x,int pos){return (bool)(x&(1<<pos));}
int Set(int x,int pos){return x=x|(1<<pos);}
int clr(int x,int pos){return x=x&~(1<<pos);}

int n,m,a[25][25],dp[(1<<21)];

int fn(int pos,int mask)
{
    if(pos==n)return 1;
    int &z=dp[mask];
    if(z!=-1)return z;
    z=0;
    for(int i=0;i<n;i++)
    {
        if(a[pos][i] && chk(mask,i)==0)
        {
            z+=fn(pos+1,Set(mask,i));
            if(z>mod)z%=mod;
        }
    }
    return z;
}

int main()
{
    var;
    sf(n);
    mem(dp,-1);
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
        {
            sf(a[i][j]);
        }
    }
    z=fn(0,0);
    cout<<z<<endl;
}


Measured memory_bytes: 8448
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();

		long g = gcd(A, B);
		int count = 1;

		if(g%2 == 0) {
			count++;
			while(g%2 == 0)g/=2;
		}
		if(g%3 == 0) {
			count++;
			while(g%3 == 0)g/=3;
		}

		boolean b = false;
		for(int i = 5; i <= Math.sqrt(g); i += (b = !b) ? 2 : 4) {
			if(g%i == 0) {
				count++;
				while(g%i == 0)g/=i;
			}
		}
		if(g != 1)count++;

		System.out.println(count);
	}
	static long gcd(long n, long m) {
		if(n>m)return gcd(m,n);
		if(n == 0)return m;
		return gcd(n, m%n);
	}
}

Measured memory_bytes: 22868