akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

class point {
   public:
    int id;
    int x, y;
    point() : id(-1), x(), y() {}
    point(int id, int x, int y) : id(id), x(x), y(y) {}
};

bool compare_x(const point& p1, const point& p2) { return p1.x < p2.x; }
bool compare_y(const point& p1, const point& p2) { return p1.y < p2.y; }

class edge {
   public:
    int u, v, c;
    edge() : u(), v(), c() {}
    edge(int u, int v, int c) : u(u), v(v), c(c) {}

    bool operator<(const edge& e) const { return c < e.c; }
};

class unionfind {
   private:
    vector<int> a;
    vector<int> h;

   public:
    unionfind(int n) : a(n, -1), h(n) {}

    int find(int v) {
        if (a[v] < 0) {
            return v;
        }
        return a[v] = find(a[v]);
    }

    bool same(int u, int v) { return find(u) == find(v); }

    void unite(int u, int v) {
        const int urt = find(u);
        const int vrt = find(v);

        if (urt == vrt) {
            return;
        }

        if (h[urt] > h[vrt]) {
            a[vrt] = urt;
        } else if (h[urt] < h[vrt]) {
            a[urt] = vrt;
        } else {
            a[vrt] = urt;
            h[urt]++;
        }
    }
};

int eval(const point& p1, const point& p2) {
    return min(abs(p1.x - p2.x), abs(p1.y - p2.y));
}

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

    vector<point> p(n);
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        p[i] = point(i, x, y);
    }

    vector<edge> es;

    sort(p.begin(), p.end(), compare_x);
    for (int i = 0; i < n - 1; i++) {
        es.push_back(edge(p[i].id, p[i + 1].id, eval(p[i], p[i + 1])));
    }

    sort(p.begin(), p.end(), compare_y);
    for (int i = 0; i < n - 1; i++) {
        es.push_back(edge(p[i].id, p[i + 1].id, eval(p[i], p[i + 1])));
    }

    unionfind uf(n);
    sort(es.begin(), es.end());

    int ans = 0;
    int cnt = 0;
    for (const edge& e : es) {
        if (cnt >= n - 1) {
            break;
        }
        if (uf.same(e.u, e.v)) {
            continue;
        }
        uf.unite(e.u, e.v);
        ans += e.c;
        cnt++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6132
#include <iostream>
#include <cstdio>


void counting_sort(int A[], int B[], int C[], int k, int n);
int main()
{
	using namespace std;
	int n;
	cin >> n;
	int *A = new int[n];
	int *B = new int[n];
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &A[i]);
	}
	int k = A[0];
	for (int i = 0; i < n; i++)
	{
		k = k >= A[i] ? k : A[i];
	}
	int *C = new int[k + 1];
	counting_sort(A, B, C, k, n);
	for (int i = 0; i < n - 1; i++)
	{
		printf("%d ", B[i]);
	}
	printf("%d\n", B[n - 1]);
	delete[] A;
	delete[] B;
	delete[] C;
	return 0;
}

void counting_sort(int A[], int B[], int C[], int k, int n)
{
	for (int i = 0; i <= k; i++)
	{
		C[i] = 0;
	}
	for (int i = 0; i < n; i++)
	{
		C[A[i]]++;
	}
	for (int i = 1; i <= k; i++)
	{
		C[i] += C[i - 1];
	}
	for (int j = n - 1; j >= 0; j--)
	{
		B[C[A[j]] - 1] = A[j];
		C[A[j]]--;
	}
}


Measured memory_bytes: 18388
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
int main() {
	int N, K;
	cin >> N >> K;
	map<int, int> cnt;
	for (int i = 0; i < N; i++) {
		int A;
		cin >> A;
		cnt[A]++;
	}
	vector<int> v;
	for (auto i : cnt) {
		v.push_back(i.second);
	}
	sort(v.begin(), v.end());
	N = v.size();
	int ans = 0;
	for (int i = 0; i < N - K; i++) {
		ans += v[i];
	}
	cout << ans << endl;
}


Measured memory_bytes: 10748
using System;

public class Program {
  public static void Main(string[] args) {
    var str = Console.ReadLine().Split();
    int a = int.Parse(str[0]);
    int b = int.Parse(str[1]);
    int c = int.Parse(str[2]);
    
    if (Check(a, b, c)) {
      Console.WriteLine("Yes");
    }else {
      Console.WriteLine("No");
    }
  }
  
  public static Boolean Check(int a, int b, int c) {
    if ((a == b && b != c) || (b == c && a != b) || (a == c && a != b)) {
      return true;
    }else {
      return false;
    }
  }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	double d;
	cin >> d;
	d/=3;
	cout << setprecision(13) << fixed;
	cout << d * d * d << '\n';
}


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

const int maxn = 1e5+10;
long long a[maxn],sum,t,n;

int main(){
	// cin >> n;
	// for(int i=0; i<n; i++) {
	// 	cin>>a[i];
	// 	sum += a[i];
	// }
	// t = n*(n+1)/2;
	// long long k = sum/t;

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

    t += n;
	int flag = 1;
	if(sum%t) flag = 0;
	else{
		// long long tmp,tt=a[0];
		// a[0] = a[0]-a[n-1]-k;
		// for(int i=1; i<n; i++){
		// 	tmp = a[i];
		//  	a[i] = a[i]-tt;
		//  	a[i] -= k;
		//  	tt = tmp;
		// }
		// for(int i=0; i<n; i++){
		// 	if(a[i]>0 || a[i]%n)
		// 		flag = 0;
		// }
		long long tmp=a[0], k = sum/t;
        for(int i=0;i<n-1;i++) a[i]=a[i+1]-a[i];
        a[n-1]=tmp-a[n-1];
        for(int i=0; i<n&&flag; i++){
            a[i] -= k;
            if(a[i]%n||a[i]>0) flag=0;
        }
	}


	if(flag) puts("YES");
	else puts("NO");
}


Measured memory_bytes: 1024
import sys

input = sys.stdin.readline
H, N = map(int, input().split())
magic = [list(map(int, input().split())) for _ in range(N)]

max_damage = max(damage for damage, cost in magic)
dp = [0] * (H + max_damage)

for x in range(1, H + max_damage):
    dp[x] = min(dp[x - damage] + cost for damage, cost in magic)

ans = min(dp[H:])

print(ans)

Measured memory_bytes: 3668
#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    string dni[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string s;
    cin >> s;
    if (s == "SUN")
        cout << 7;
    else
    {
        int nr = 0;
        while (dni[nr] != s)
            ++nr;
        cout << 7 - nr;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
const ll MOD = 1e9+7;
const int MAX = 2002002;
ll fac[MAX],finv[MAX],inv[MAX];
void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i % MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i) % MOD;
        finv[i]=finv[i-1]*inv[i] % MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;
}
ll powmod(ll x, ll n){
    ll ret=1;
    while(n>0){
        if(n&1){
            ret*=x;
            ret%=MOD;
            n-=1;
        }
        else{
            x*=x;
            x%=MOD;
            n>>=1;
        }
    }
    return ret;
}
signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    COMinit();
    ll k; cin >> k;
    string s; cin >> s;
    ll sz=s.size();
    ll ans=0;
    for(ll i=sz;i<=sz+k;i++){
        ll res=COM(sz+k,i)*powmod(25LL,k+sz-i);
        res%=MOD;
        ans+=res; ans%=MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 51184
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define REP(i,n)    for(int i = 0; i < (int)n; i++)
#define MAX_N   100000
typedef long long ll;

void solve(){
    int r;
    cin >> r;
    cout << 3 * r * r << endl;

}

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

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long k = sc.nextLong();
    long ans = k;
    ans = (ans * (long)Math.pow(k - 1, n - 1));
    System.out.println(ans);
  }
}


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

#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define INF  (1<<30)
#define INFL (1LL<<60)
#define MOD 1000000007
#define EPS ((ld)(1e-9))

#define sz(x) ((int)(x).size())
#define setz(x) memset(x, 0, sizeof(x))
#define rep(i, x)  for (int i = 0, _##i = (x); i < _##i; i++)
#define repp(i, x) for (int i = 1, _##i = (x); i <= _##i; i++)
#define repr(i, s, e) for (int i = (s), _##i = (e); i < _##i; i++)

#define L(x) ((x)*2)
#define R(x) ((x)*2+1)

#ifndef __SOULTCH
#define endl '\n'
#define debug(...) 
#else
#define __debug_a(v) cout << " [+] " << #v << " = " << (v) << endl
#define __debug_b(v) cout << "     " << #v << " = " << (v) << endl
#define debug1(v1) __debug_a(v1);
#define debug2(v1, v2) __debug_a(v1), __debug_b(v2);
#define debug3(v1, v2, v3) __debug_a(v1), __debug_b(v2), __debug_b(v3);
#define GET_MACRO(_1,_2,_3,NAME,...) NAME
#define debug(...) GET_MACRO(__VA_ARGS__, debug3, debug2, debug1)(__VA_ARGS__)
#endif

using namespace std;

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

template<typename T, typename V>
ostream &operator<<(ostream &os, const pair<T, V> pai) { 
    return os << pai.first << ' ' << pai.second;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> v) {
    rep(i, sz(v)) cout << v[i] << ' ';
    return os;
}

template<typename T>
ostream &operator<<(ostream &os, const set<T> s) {
    for (T p : s) cout << p << ' ';
    return os;
}

template<typename T, typename V>
ostream &operator<<(ostream &os, const map<T, V> s) {
    for (auto p : s) cout << '(' << p << ") ";
    return os;
}

template<typename T, typename V>
istream &operator>>(istream &is, pair<T, V> &pai) {
	is >> pai.first >> pai.second;
	return is;
}

ll a[6];

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

    rep(i, 6) cin >> a[i];
    ll m = *min_element(a+1, a+6);
    debug(m);
    cout << 5+(a[0]-1)/m << endl;
    debug(1);
}








Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def renketu(n , k , l , pqli , rsli):

    from collections import defaultdict

    ans = []
    pquf = UnionFind(n)
    rsuf = UnionFind(n)

    [pquf.unite(p - 1 , q - 1) for q , p in pqli]
    [rsuf.unite(r - 1 , s - 1) for r , s in rsli]

    ansdict = defaultdict(int)

    for i in range(n):
        ansdict[(pquf.find(i) , rsuf.find(i))] += 1

    for i in range(n):
        ans.append(ansdict[(pquf.find(i) , rsuf.find(i))])

    return ans

def main():
    n, k, l = map(int, input().split())
    pqli = [list(map(int , input().split())) for i in range(k)]
    rsli = [list(map(int , input().split())) for i in range(l)]
    ans = renketu(n , k , l , pqli , rsli)

    print(*ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 87080
#include <stdio.h>

char A[6]={'a','e','i','o','u'};

int main()
{
    int flag=0;
    char x;
    scanf("%c", &x);

    for(int i=0; i<5; i++)
        if(x==A[i])
            flag = 1;

    if(flag) printf("vowel\n");
    else printf("consonant\n");

    return 0;

}


Measured memory_bytes: 128
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower, islower
#include <stdio.h>

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

int main() {
  int dh[] = {1,0,-1, 0,1,-1,-1, 1};
  int dw[] = {0,1, 0,-1,1, 1,-1,-1};
  int H,W;
  cin >> H >> W;
  string a[H];
  rep(i,H)cin >> a[i];
 
  rep(i,H)rep(j,W) {
    if(a[i][j] == '#') continue;
    int num = 0;
    rep(k,8) {
      int ni = i+dh[k];
      int nj = j+dw[k];
      if(ni >= H || ni< 0) continue;
      if(nj >= W || nj < 0) continue;
      if(a[ni][nj] == '#') num++;
    }
    a[i][j] = char(num + '0');
  }
   rep(i,H) cout << a[i] << endl;
}

Measured memory_bytes: 3628
ABC = input().split()
list_ABC = list(ABC)
A = int(list_ABC[0])
B = int(list_ABC[1])
C = int(list_ABC[2])
 
if A < C and C < B:
    print('Yes')
elif B < C and C < A:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
from collections import deque


def main():
    K = int(input())
    queue = deque([i + 1 for i in range(9)])
    cnt = 1

    if K < 13:
        print(K)
        return

    while cnt < K:
        cnt += 1
        x = queue.popleft()
        r = x % 10

        if r != 0:
            queue.append(x*10 + r - 1)
        queue.append(x*10 + r)
        if r != 9:
            queue.append(x*10 + r + 1)

    print(queue.popleft())


if __name__ == "__main__":
    main()


Measured memory_bytes: 11964
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  string s; cin >> s;
  for(int i = 0; i < s.size(); i++){
    char a = s.at(i);
    if(char(a + n) <= 'Z')
      cout << char(a+n);
    else
      cout << char(a+n-26);
  }
}

Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <string>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cfloat>
#include <algorithm>
#include <memory>
using namespace std; 

typedef long long ll; 
typedef unsigned long long ull;
typedef unsigned uint; 
typedef long double l_double;

#define vtr vector
#define PB push_back
#define EB emplace_back
#define gcd __gcd
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define type(var) static_cast<type>(var)
#define TEST uint _ {}; cin >> _; while (_--)
#define PI (3.1415926535897932384626433832795)
#define MOD 1'00'00'00'007
#define EPS 1e-9
#define deb(x) cout<< #x << " --> " << x << endl;

template<typename T>
void vtrS(const vector<T> &ARR) 
{ for (T const &val: ARR) cout<<val<<" "; cout<<endl; }

template<typename T>
void vtrV(const vector<T> &ARR) 
{ for (T const &val: ARR) cout<<val<<endl; }

template<typename T>
void read_vvtr(vector<vector<T>> &ARR) 
{ for (vector<T> &i: ARR) for (T &j: i) cin >> j; }

template<typename T>
void vvtrS(const vector<vector<T>> &ARR) 
{ for (vector<T> const &i: ARR) { for (T const &j: i) cout<<j<<" "; cout<<endl; } }

template<typename T>
void vvtrNS(const vector<vector<T>> &ARR) 
{ for (vector<T> const &i: ARR) { for (T const &j: i) cout<<j; cout<<endl; } }

template<typename T>
T cntDigits(const T &N) { return (floor(log10(N)) + 1); }

template<typename T>
bool isPowOfTwo(const T &N) { return (N && (!(N&(N-1)))); }

template<typename T>
T lcm(T a, T b) { return ((a*b)/gcd(a, b)); }
// --------------------------------------------------------------------------------

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout<<boolalpha;
    cout<<fixed<<setprecision(3); 
    // --------------------------------------
    
    int x {}, a {};
    cin >> x >> a;

    cout<<((x < a) ? 0: 10)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

ll gcd(ll a, ll b) {return (!b ? a : gcd(b, a % b));}
bool cmp(int a,int b){return a>b;}
const ll N = 5e5 + 10;
const ll mod = 1e9 + 7;

ll fac[N];

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1) res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

void init() {
    fac[0] = 1;
    for (ll i = 1; i < N; i++)
        fac[i] = fac[i - 1] * i % mod;
}

ll inv(ll a) {
	return binpow(a, mod - 2);
}

ll A(ll n, ll m) {
	return fac[n] * inv(fac[n - m]) % mod;
}

ll C(ll n, ll m) {
    return fac[n] * inv(fac[m]) % mod * inv(fac[n - m]) % mod;
}

//const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;

void solve(){
     ll n,k;cin >> n >> k;
     init();
     for(ll i = 1;i<=k;i++){
     if(n-k+1<i){cout << 0 <<endl;continue;}
     ll ans = C(n-k+1,i)*C(k-1,i-1);
     ans %= mod;
     cout << ans <<endl;
     }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 7524
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
#define P pair<int,int>
#define Sort(a) sort((a).begin(),(a).end())
#define Reverse(a) reverse((a).begin(),(a).end())
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
using namespace std;

signed main(){
    int n;
    vec(a,100005);
    cin >> n;
    REP(i,n){
        int t;
        cin >> t;
        a[t]++;
    }
    int ans = 0;
    FOR(i,2,100005){
        int tmp = a[i] + a[i-1] + a[i-2];
        ans = max(ans,tmp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, s, n) for(int i = s; i < n; i++)
using namespace std;

int main(){
  int n;
  cin >> n;
  int now = 0;
  bool flag = true;
  rep(i, n){
    int h;
    cin >> h;
    if (h == now) now = h;
    else if (h > now) now = h - 1;
    else{
      flag = false;
      break;
    }
  }
  if (flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s, t;
  cin >> s >> t;
  
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i]) ans++;
  }
  
  cout << ans << '\n';
}

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

int main(){

  int N;
  cin >> N;

  ll ans=0;
  repf(i,N){
    if(i%3!=0 && i%5!=0) ans+=i;
  }

  cout<<ans;

  return 0;
}


Measured memory_bytes: 3624
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"

string st;

int getnum( int l) {
	int num = 0;
	while (isdigit(st[l])) {
		num = num * 10 + st[l] - '0';
		l++;
	}
	return num;

}
int calc(const int a,const int b,const char type) {
	if (type == '+')return a + b;
	else if (type == '-')return a - b;
	else if (type == '*')return a*b;
	else {
		if (b)return a / b;
		else {
			throw(false);
		}
	}
}

set<int> getexpr(const int l,const int r) {
	set <int>aset;
	if (l > r)assert(false);
	if (st[l] == '('&&st[r] == ')') {
		int depth = 0;
		bool kakko = true;
		for (int x = l; x <= r; ++x) {
			if (st[x] == '(') {
				depth++;
			}
			else if (st[x] == ')') {
				depth--;
			}
			if (!depth&&x != r)kakko = false;
		}
		if (kakko) {

			return getexpr(l + 1, r - 1);
		}
	}
	int depth = 0;
	bool flag = false;
	for (int x = l; x <= r; ++x) {
		if (st[x] == '(') {
			depth++;
		}
		else if (st[x] == ')') {
			depth--;
		}
		else if (st[x] == '+' || st[x] == '-' || st[x] == '*' || st[x] == '/') {
			if (!depth) {
				flag = true;
				const set<int> lset = getexpr(l, x - 1);
				const set<int> rset = getexpr(x + 1, r);
				for (auto a : lset) {
					for (auto b : rset) {
						if (st[x] == '/'&&!b)continue;
						else {
							aset.emplace(calc(a, b, st[x]));
						}
					}
				}
			}
		}
	}
	if (!flag) {
		if (st[l] == '(')return getexpr(l + 1, r - 1);
		aset.emplace(getnum(l));
	}
	return aset;
}

int main() {
	while (1) {
		cin >> st;
		if (st == "#")break;
		set<int>aset;
		bool ok = true;
		try {
			aset=getexpr(0,st.size()-1);
		}
		catch (...) {
			assert(false);
			ok = false;
		}
		
		cout << aset.size() << endl;
	}

	return 0;
}

Measured memory_bytes: 3140
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long answer = 0;

		for (long i = 1; i < (long) Math.sqrt(N) + 1; i++) {
			if (N % i == 0) {
				long m1 = i - 1;
				//System.out.println("m1:"+m1);
				if (m1 != 0) {
					if (N / m1 == N % m1) {
						answer += m1;
					}
				}
				if (i != N / i) {
					long m2 = N / i - 1;
					//System.out.println("m2:"+m2);
					if (N / m2 == N % m2) {
						answer += m2;
					}
				}
			}
		}
		sc.close();
		System.out.println(answer);
	}
}

Measured memory_bytes: 23380
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ld long double
#define F first
#define S second

using namespace :: std;

const ll maxn=2e5+500;
const ll mod=1e9+7;
const ll inf=1e9+500;


pair<ll,ll>  seg[maxn*4][2];
ll a[maxn];
map<pair<ll,ll> ,ll> ml;
pair<ll,ll> d[maxn];
ll p=0;
ll n;


vector<ll> out[maxn];
ll cnt[maxn];




void yal(ll a,ll b){
	out[a].pb(b);
	cnt[b]++;
}

void bild(ll l,ll r,ll node){
	if(l+1==r){
		seg[node][l&1]=mp(a[l],l);
		seg[node][!(l&1)]=mp(inf,l);
		return ;
	}
	ll mid=(l+r)/2;
	bild(l,mid,2*node);
	bild(mid,r,2*node+1);
	seg[node][0]=min(seg[2*node][0],seg[2*node+1][0]);
	seg[node][1]=min(seg[2*node][1],seg[2*node+1][1]);
}
pair<ll,ll>  find_min(ll L,ll R,ll node,ll l,ll r,bool b){
	if(R<=l || r<=L){
		return mp(inf,inf);
	}
	if(l<=L && R<=r){
		return seg[node][b];
	}
	ll mid=(L+R)/2;
	return min(find_min(L,mid,2*node,l,r,b),find_min(mid,R,2*node+1,l,r,b));
}
void solv(ll l,ll r){
	if(l>=r){
		return;
	}
	if(l+2==r){
		d[p]=mp(a[l],a[l+1]);
		p++;
		return;
	}
	ll v=find_min(0,n,1,l,r,l&1).S;
	ll u=find_min(0,n,1,v+1,r,!(l&1)).S;
	d[p]=mp(a[v],a[u]);
	p++;
	solv(l,v);
	solv(v+1,u);
	solv(u+1,r);
}
ll  solvv(ll l,ll r){
	if(l>=r){
		return maxn-1;
	}
	if(l+2==r){
		ll o=ml[mp(a[l],a[l+1])];
		return o;
	}
	ll v=find_min(0,n,1,l,r,l&1).S;
	ll u=find_min(0,n,1,v+1,r,!(l&1)).S;
	ll o=ml[mp(a[v],a[u])];
	yal(o,solvv(l,v));
	yal(o,solvv(v+1,u));
	yal(o,solvv(u+1,r));
	return o;
}
vector<ll> topol;


int main(){
	cin>>n;
	for(ll i=0;i<n;i++){
		cin>>a[i];
	}
	bild(0,n,1);
	solv(0,n);
	sort(d,d+p);
	for(ll i=0;i<p;i++){
		ml[d[i]]=i;
	}
	solvv(0,n);
	set<pair<ll,ll> > st;
	for(ll i=0;i<p;i++){
		st.insert(mp(cnt[i],i));
	}
	ll co=0;
	while(co<n){
		pair<ll,ll> e= (*(st.begin()));
		ll v=e.S;
		st.erase(e);
		cout<<d[v].F<<' '<<d[v].S<<' ';
		co+=2;
		for(ll i=0;i<out[v].size();i++){
			ll u=out[v][i];
			st.erase(mp(cnt[u],u));
			cnt[u]--;
			st.insert(mp(cnt[u],u));
		}
	}
}


Measured memory_bytes: 57472
import math

n, k = map(int, input().split())
ans = []
for i in range(1, n+1):
    wins = 0
    score = i
    while True:
        if score >= k:
            break
        score *= 2
        wins += 1
    ans.append(pow(0.5, wins))
print(sum(ans)/len(ans))

Measured memory_bytes: 6296
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;


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

  cout << (n == m ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	unordered_map<int,int> mp;
	for(int i=0;i<N;i++){
		int a;
		cin >> a;
		mp[a+1]++;
		mp[a]++;
		mp[a-1]++;
	}
	
                 int ma =0;
                 for(auto x : mp) ma = max(ma,x.second);
                 cout << ma << endl;
}

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

#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

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

int main() {
    lli n;
    cin >> n;
    lli p[n];
    REP(i, 0, n) {
        cin >> p[i];
    }
    lli ans = 0;
    REPE(i, 1, n-2) {
        if ((p[i-1] < p[i] && p[i+1] > p[i]) ||
            (p[i-1] > p[i] && p[i+1] < p[i])) {
            ans++;
        }
    }
    cout << ans << endl;
}


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

#define ll long long

int main(){

    int N,M,K;
    int i,j,k,l;
    int count=0,count_n=0,count_m=0;
    bool flag = false;
    int ans=0;
    string S;

    cin >> N;
    cin >> S;

   int min = 1000000;
   vector<int> wcost_int(N);
   vector<int> ecost_int(N);
   int count_e = 0;
   int count_w = 0;

    for(i=0;i<N;i++){
        if(S.at(i)=='W')count_w ++;
        wcost_int.at(i) = count_w;
        if(S.at(N-1-i)=='E')count_e ++;
        ecost_int.at(N-1-i) = count_e;
    }

    for(i=0;i<N;i++){
        int cost;
        if(i==0)cost = ecost_int.at(1);
        else if(i == N-1)cost = wcost_int.at(N-2);
        else cost = wcost_int.at(i-1) + ecost_int.at(i+1);
        if(min > cost)min = cost;
    }

    cout << min << endl;

    return 0;

}

Measured memory_bytes: 3076
def solve():
    C = [[int(c) for c in input().split()] for _ in range(3)]
    diffr1 = C[0][1] - C[0][0]
    diffr2 = C[0][2] - C[0][1]
    diffc1 = C[1][0] - C[0][0]
    diffc2 = C[2][0] - C[1][0]
    if C[1][1] - C[1][0] == C[2][1] - C[2][0] == diffr1:
        if C[1][2] - C[1][1] == C[2][2] - C[2][1] == diffr2:
            if C[1][1]  - C[0][1] == C[1][2] - C[0][2] == diffc1:
                if C[2][1] - C[1][1] == C[2][2] - C[1][2] == diffc2:
                    return "Yes"
    return "No"

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

Measured memory_bytes: 3064
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  ll A[N];
  for(int i=0;i<N;++i){
    cin>>A[i];
  }
  ll ans = 0;
  ll tmp = 0;
  ll l=0, r=0;
  bool go = true;
  ll kakor = -1;
  while(r<N){
    if((tmp^A[r]) == tmp+A[r]){
      if(!go) go = true;
      tmp += A[r];
      r++;
    }
    else{
      if(go){
        go = false;
        if(kakor==-1) ans += (r-l-1)*(r-l)/2;
        else if(l<kakor) ans += (r-l-1)*(r-l)/2 - (kakor-l-1)*(kakor-l)/2;
        else ans += (r-l-1)*(r-l)/2;
        kakor = r;
      }
      tmp -= A[l];
      l++;
    }
  }
  if(kakor==-1) ans += (r-l-1)*(r-l)/2;
  else if(l<kakor) ans += (r-l-1)*(r-l)/2 - (kakor-l-1)*(kakor-l)/2;
  else ans += (r-l-1)*(r-l)/2;
  cout<<ans+N<<endl;
}




Measured memory_bytes: 1792
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.stream.IntStream;

/**
 * 解説通りに実装したソースコード
 * 
 * https://atcoder.jp/contests/abc175/submissions/15991728 にも参考
 */
public class Main {

	/** 文字列の最大長さ+1 */
	private static final int MAX_LENGTH = 21;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			String[][] s = new String[n][2];
			long[] c = new long[n];
			IntStream.range(0, n).forEach(i -> {
				s[i][0] = scanner.next();
				s[i][1] = new StringBuilder(s[i][0]).reverse().toString();
				c[i] = scanner.nextLong();
			});
			long answer = Long.MAX_VALUE;
			for (int i = 0; i < n; i++) {
				long[][][] d = new long[n][2][MAX_LENGTH];
				IntStream.range(0, n)
						.forEach(j -> IntStream.range(0, 2).forEach(k -> Arrays.fill(d[j][k], Long.MAX_VALUE)));
				d[i][0][0] = c[i];
				Queue<Node> queue = new PriorityQueue<>();
				queue.add(new Node(i, 0, 0, c[i]));
				while (!queue.isEmpty()) {
					Node node = queue.poll();
					String string = s[node.i][node.j].substring(node.index);
					if (isPalindrome(string)) {
						answer = Math.min(answer, node.cost);
						break;
					}
					if (node.cost <= d[node.i][node.j][node.index]) {
						int j2 = 1 - node.j;
						for (int i2 = 0; i2 < n; i2++) {
							int ni = -1, nj = -1, nIndex = -1;
							if (s[i2][j2].startsWith(string)) {
								ni = i2;
								nj = j2;
								nIndex = string.length();
							}
							if (string.startsWith(s[i2][j2])) {
								ni = node.i;
								nj = node.j;
								nIndex = node.index + s[i2][j2].length();
							}
							if (-1 != ni) {
								long nCost = node.cost + c[i2];
								if (nCost < d[ni][nj][nIndex]) {
									d[ni][nj][nIndex] = nCost;
									queue.add(new Node(ni, nj, nIndex, nCost));
								}
							}
						}
					}
				}
			}
			System.out.println((Long.MAX_VALUE == answer) ? -1 : answer);
		}
	}

	/**
	 * 文字列が回文かどうかを計算する
	 * 
	 * @param string 文字列
	 * @return 文字列が回文かどうか
	 */
	private static boolean isPalindrome(String string) {
		int left = 0, right = string.length() - 1;
		char[] cs = string.toCharArray();
		while (left < right) {
			if (cs[left++] != cs[right--]) {
				return false;
			}
		}
		return true;
	}

	private static class Node implements Comparable<Node> {
		int i, j, index;
		long cost;

		Node(int i, int j, int index, long cost) {
			super();
			this.i = i;
			this.j = j;
			this.index = index;
			this.cost = cost;
		}

		@Override
		public int compareTo(Node node) {
			return Long.compare(cost, node.cost);
		}
	}
}


Measured memory_bytes: 37680
#include<stdio.h>
#include<string.h>

int N = 200001;
int main(void){
    char s[N], t[N];
    int i=0, x=0;

    scanf("%s%s",s ,t);

    while(s[i] != '\0'){
        if(t[i] != s[i]){
            x++;
        }
        i++;
    }
    printf("%d\n", x);
    return 0;
}

Measured memory_bytes: 2068
#include <iostream>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
int main(void) {
  int n, d;
  cin >> n >> d;
  cout << (n + (2 * d + 1) - 1) / (2 * d + 1) << endl;
  return 0;
}

Measured memory_bytes: 256
x = int(input())
a = 0
while True:
    for b in range(a):
        if abs(a ** 5 - b ** 5) == abs(x):
            if a ** 5 - b ** 5 == x:
                print(a, b)
                exit()
            else:
                print(-a, -b)
                exit()
        elif abs(a ** 5 + b ** 5) == abs(x):
            if a ** 5 + b ** 5 == x:
                print(a, -b)
                exit()
            else:
                print(-a, b)
                exit()
    a += 1

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



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

    string s; cin >> s;
    rep(i,s.size()){
        if(s[i] == '7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,a;
  cin >> N >> A;
  a = N % 500;
  if(A>=a){
  	cout << "Yes" << endl;
  }
  if(A<a){
  	cout << "No" << endl;
  }
  
}

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

using namespace std;

void make_div(vector<int>& divs, int n){
  for(int i = 1; i * i <= n; i++)
  {
    if (n % i == 0)
    {
      divs.push_back(i);
      if (i * i != n)
        divs.push_back(n / i);
    }
  }
}

int main(void) {
  int N;
  cin >> N;
  vector<int> as;
  
  for(int i = 0; i < N; i++)
  {
    int t; cin >> t;
    as.push_back(t);
  }

  vector<int> cs; 
  vector<int> ds;
  make_div(cs, as[0]);
  make_div(ds, as[1]);

  // for (int i = 0; i < cs.size(); i++)
  //   cout << cs[i] << endl;  

  int maxd = 1;
  for (int i = 0; i < cs.size(); i++)
  {
    int cnt = 0;
    for(int j = 0; j < N; j++)
    {
      if (as[j] % cs[i] == 0)
        cnt++;
    }
    if (N - 1 <= cnt)
      maxd = max(maxd, cs[i]);
  }

  for (int i = 0; i < ds.size(); i++) {
    int cnt = 0;
    for(int j = 0; j < N; j++)
    {
      if (as[j] % ds[i] == 0)
        cnt++;
    }
    if (N - 1 <= cnt)
      maxd = max(maxd, ds[i]);
  }

  cout << maxd << endl;

  return 0;
}

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

int main(){
  string s1,s2,s3;
  cin >> s1 >> s2 >> s3;
  int diff = 'A' - 'a';
  printf("%c%c%c\n",s1[0]+diff,s2[0]+diff,s3[0]+diff);
}

Measured memory_bytes: 256
// ------------------------------------
// Date:2018/ 3/30
// Problem:- Unplanned Queries b.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "YES" : "NO") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

int N, M;

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

  cin >> N >> M;
  
  map< int, int > m;
  REP(i, M) {
    CIN(a, b);
    m[a]++;
    m[b]++;
  }

  bool ok = true;
  FOR(i, 1, N + 1) {
    if (m[i] & 1) ok = false;
  }

  OK(ok);

  return 0;
}



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

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

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  int N; cin >> N;
  string S; cin >> S;
  vector<int> W(N,0);
  vector<int> R(N,0);

  for(int i = 0; i < N; i++){
    if(S[i] == 'R'){
      R[i]++;
    } else {
      W[i]++;
    }

    if(i==0){

    } else {
      W[i] += W[i-1];
      R[i] += R[i-1];
    }
  }

  int ans = N;
  for(int i = 0; i <= N; i++){
    int  tmp = 0;
    if(i==0){
      // すべてをWにする
      tmp = R[N-1];
    } else if(i==N){
      // すべてをRにする
      tmp = W[N-1];
    } else { 
      // i-1までをRにする, i-N-1をWにする
      // 交換できるなら交換する
      tmp += max(W[i], R[N-1] - R[i]);
    }

    ans = min(tmp, ans);
  }
  cout << ans << endl;

}




Measured memory_bytes: 5224
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n + 1); ++i)
using namespace std;
using ll = long long;
const int INF = +100100100;
// typedef pair<int,int> P;
const int MAX = 1000000;

int main(){
    int r;
    cin >> r;
    printf("%.3f\n",r*2*M_PI);
    return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

typedef struct{
  int a,b,c;
}T;

int gcd(int a,int b){
  if(a<b)swap(a,b);
  if(b==0)return a;
  return gcd(b,a%b);
}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,Ma,Mb;cin >> N >> Ma >> Mb;
  vector<T> v(N);
  rep(i,N) cin >> v[i].a >> v[i].b >> v[i].c;
  // dp[i+1][j][k]:i番目までを見て，j,kになる最小コスト
  const int L = 410;
  vector<vector<int> > dp[2];
  vector<vector<int> > &prev = dp[0], &next = dp[1];
  prev = vector<vector<int> >(L,vector<int> (L,MAX_I));
  next = vector<vector<int> >(L,vector<int> (L,MAX_I));
  prev[0][0] = 0;
  int maxX=1,maxY=1;
  rep(i,N){
    rep(j,maxX)rep(k,maxY){
      next[j][k] = min(next[j][k],prev[j][k]);
      if(prev[j][k] == MAX_I)continue;
      next[j+v[i].a][k+v[i].b] = min(prev[j][k]+v[i].c, next[j+v[i].a][k+v[i].b]);
      maxX = max(maxX,j+v[i].a+1);
      maxY = max(maxY,k+v[i].b+1);
    }
    swap(prev,next);
  }
  swap(prev,next);
  int mincost = MAX_I;
// rep(j,maxX){
//   rep(k,maxY)cout << next[j][k] SPF;
//   cout << endl;
// }

  repp(j,1,maxX)repp(k,1,maxY){
    if(next[j][k] == MAX_I)continue;
    int g = gcd(j,k);
    if(j/g == Ma && k/g == Mb) mincost = min(mincost, next[j][k]);
  }

  if(mincost == MAX_I)cout << -1 << endl;
  else cout << mincost << endl;
  return 0;
}


Measured memory_bytes: 1664
// 2014/07/14 Tazoe

#include <iostream>
#include <cmath>
using namespace std;

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

	for(int i=0; i<n; i++){
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		double a1 = 2*(x2-x1);
		double b1 = 2*(y2-y1);
		double c1 = x1*x1-x2*x2+y1*y1-y2*y2;

		double a2 = 2*(x3-x1);
		double b2 = 2*(y3-y1);
		double c2 = x1*x1-x3*x3+y1*y1-y3*y3;

		double px = (b1*c2-b2*c1)/(a1*b2-a2*b1);
		double py = (c1*a2-c2*a1)/(a1*b2-a2*b1);

		double r = sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));

		cout.precision(3);
		cout << fixed << px << ' ' << fixed << py << ' ' << fixed << r << endl;
	}

	return 0;
}

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

int main(){
	unsigned long long a,b,c;
	cin >> a >> b >> c;
	if(c < a+b){
		cout << "No" << endl;
		return 0;
	}
	if((c-a-b)*(c-a-b) > 4*a*b){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define clr(a, b) memset(a, b, sizeof(a))
#define Error(x) cout << #x << " = " << x << endl
#define iDEBUG freopen("in.txt", "r", stdin)
#define oDEBUG freopen("output.txt","w",stdout)
#define pb push_back
#define x first
#define y second
typedef long long ll;

using namespace std;


int main()
{_
    int n, num;
    set<int> st;
    cin >> n;
    for(int i=0; i<n; i++)
    {
        cin >> num;
        st.insert(num);
    }
    cout << st.size();
    return 0;
}

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

using namespace std;
using ll = long long int;

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

  //可能性の判定
  ll rest = 0;
  ll lack = 0;
  vector<ll> rest_sub;
  int lack_count = 0;
  for(int i = 0; i < n; i++)
  {
    if(a[i] >= b[i])
    {
      rest += a[i] - b[i];
      rest_sub.push_back(a[i] - b[i]);
    }else{
      lack += b[i] - a[i];
      lack_count++;
    }
  }
  if(rest - lack < 0)
  {
    cout << -1 << endl;
    return 0;
  }
  if(lack == 0)
  {
    cout << 0 << endl;
    return 0;
  }

  //最小を計算
  sort(rest_sub.begin(), rest_sub.end());
  reverse(rest_sub.begin(), rest_sub.end());
  vector<ll> sum(rest_sub.size(), 0);
  sum[0] = rest_sub[0];
  for(int i = 1; i < rest_sub.size(); i++)
  {
    sum[i] = sum[i - 1] + rest_sub[i];
  }
  for(int i = 0; i < rest_sub.size(); i++)
  {
    if(lack <= sum[i])
    {
      cout << lack_count + i + 1 << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 3184
/*
ID: wangjun30
LANG: C++11
TASK:
*/
#include<iostream>
#include<algorithm>
#include<array>
#include<unordered_map>
#include<map>
#include<set>
#include<list>
#include<unordered_set>
#include<vector>
#include<bitset>
#include<queue>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
//#include<fstream>
#define int long long
using namespace std;
//ifstream cin(".in");
//ofstream cout(".out");
int Rf[4010];
int Gf[4010];
int Bf[4010];
int Rb[4010];
int Gb[4010];
int Bb[4010];
char ch[4010];
int ans=0;
int Subans=0;
int n;
void init(){
	cin>>n;
	int R=0,G=0,B=0;
	for(int i=1;i<=n;i++){
		cin>>ch[i];
		Rf[i]=R;
		Gf[i]=G;
		Bf[i]=B;
		switch(ch[i]){
			case 'R':{
				R++;
				break;
			}
			case 'G':{
				G++;
				break;
			}
			case 'B':{
				B++;
				break;
			}
		}
	}
	R=0;
	G=0;
	B=0;
	for(int i=n;i>=1;i--){
		Rb[i]=R;
		Gb[i]=G;
		Bb[i]=B;
		switch(ch[i]){
			case 'R':{
				R++;
				break;
			}
			case 'G':{
				G++;
				break;
			}
			case 'B':{
				B++;
				break;
			}
		}
	}
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	init();
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			int Length=j-i;
			int PlaceA=i-Length;
			int PlaceB=i;
			int PlaceC=i+Length;
			if(PlaceC<=n && PlaceA>=1 && ch[PlaceA]!=ch[PlaceB] && ch[PlaceA]!=ch[PlaceC] && ch[PlaceB]!=ch[PlaceC])
				Subans++;
		}
	}
	for(int i=1;i<=n;i++){
		switch(ch[i]){
			case 'R':{
				ans+=Gf[i]*Bb[i]+Gb[i]*Bf[i];
				break;
			}
			case 'G':{
				ans+=Rf[i]*Bb[i]+Rb[i]*Bf[i];
				break;
			}
			case 'B':{
				ans+=Rf[i]*Gb[i]+Rb[i]*Gf[i];
				break;
			}
		}
	}
	cout<<ans-Subans;
	return 0;
}

Measured memory_bytes: 3824
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

#define INF 1000000007 //1000000000000000003
#define MOD 1000000007
#define MAX 2000005

#define ll long long

//printf("%.10f", );
//cout << fixed << setprecision(10) << heikin << endl;
//vector<vector<int>> data(3, vector<int>(4, -1));
//left + 1 < top

using namespace std;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct { int to; long long dist; };
const double PI = 3.141592653589793;
long long fact[MAX], inv[MAX];
int dx[] = { -1,0,1,0 };
int dy[] = { 0,-1,0,1 };

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

vector<vector<int>> tree(100005);
int color[100005];
map<P, int>colorMap;
int m = 0;

struct BridgeInfo {
	int town1;
	int town2;
	int year;
	BridgeInfo(int t1, int t2, int y) {
		town1 = t1;
		town2 = t2;
		year = y;
	}
};

struct People {
	int index;
	int town;
	int year;
	People(int i, int t, int y) {
		index = i;
		town = t;
		year = y;
	}
};

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

struct UnionFind {
	vector<int>uf;
	
	UnionFind(int size) :uf(size, -1) {};

	int root(int target) {
		if (uf[target] < 0)return target;
		else return uf[target] = root(uf[target]);
	}

	void merge(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b)return;
		if (uf[b] < uf[a])swap(a, b);
		uf[a] += uf[b];
		uf[b] = a;
	}
};

ll CalcPow(ll num, ll power) {
	if (power == 0)return 1;
	if (power % 2 == 0) {
		ll half = CalcPow(num, power / 2);
		return (half * half) % MOD;
	}
	else return (num * CalcPow(num, power - 1)) % MOD;
}

ll combination(ll all, ll select) {
	if (all < select) return 0;
	if (all < 0 || select < 0) return 0;
	return fact[all] * (inv[select] * inv[all - select] % MOD) % MOD;
}

void initCombination(int max) {
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= max; ++i) {
		fact[i] = fact[i-1] * i % MOD;
	}

	inv[max] = CalcPow(fact[max], MOD - 2);
	for (int i = max - 1; 0 <= i; --i) {
		inv[i] = (inv[i + 1] * (i + 1)) % MOD;
	}
}

void dfs(int from) {
	int c = 1;
	for (auto t : tree[from]) {
		c = c != color[from] ? c : c + 1;
		color[t] = c;
		colorMap[make_pair(from, t)] = c;
		m = max(c, m);
		dfs(t);
		c++;
	}
}

int main() {
	int N, M;
	cin >> N >> M;

	string ans = N <= M ? "Yes" : "No";
	cout << ans << endl;
}

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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    ll n, k;
    cin >> n >> k;

    ll ans = k;
    rep(i, n-1){
        ans *= (k - 1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256