akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define bit(k) (1LL<<(k))
#define SUM(v) accumulate(all(v), 0LL)

typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
struct fast_ios{ fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; }fast_ios_;

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

#define TOSTRING(x) string(#x)
template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; }
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os  << "["; for(auto _: v) os << _ << ", "; os << "]" << endl; return os; };
template <typename T> ostream &operator<<(ostream &os, set<T> &st) { os << "("; for(auto _: st) { os << _ << ", "; } os << ")";return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair< T, U >& p){os << "{" <<p.first << ", " << p.second << "}";return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &mp){ os << "["; for(auto _: mp){ os << _ << ", "; } os << "]" << endl; return os; }

#define DUMPOUT cerr
void dump_func(){ DUMPOUT << endl; }
template <class Head, class... Tail> void dump_func(Head &&head, Tail &&... tail) { DUMPOUT << head; if (sizeof...(Tail) > 0) { DUMPOUT << ", "; } dump_func(std::move(tail)...); }

#ifdef DEBUG
#define dbg(...) dump_func(__VA_ARGS__)
#define dump(...) DUMPOUT << string(#__VA_ARGS__) << ": "; dump_func(__VA_ARGS__)
#else
#define dbg(...)
#define dump(...)
#endif

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const long double PI = acos(-1.0);

/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/


ll dp[200010][3];
int main() {
    string S;
    cin >> S;
    int N = S.size();
    rep(i,N+1)rep(j,3)dp[i][j] = 0;
    rep(i,N){
        if(i == 0){
            chmax(dp[i+1][1], dp[i][0]+1);
            chmax(dp[i+2][2], dp[i][0]+1);
            continue;
        }
        rep1(j,3)rep1(k,3){
            if(i - j < 0)continue;
            if(i + k > N)continue;
            string pre = S.substr(i-j, j);
            string nxt = S.substr(i, k);
            if(pre == nxt)continue;
            chmax(dp[i+k][k], dp[i][j]+1);
        }
    }
    cout << max(dp[N][1], dp[N][2]) << endl;
}


Measured memory_bytes: 8436
import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int h = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int r = sc.nextInt();

        if (x < 0 || y < 0) System.out.println("No");
        else if (x + r <= w && y + r <= h) System.out.println("Yes");
        else System.out.println("No");
    }
}




Measured memory_bytes: 26376
#include <stdio.h>
int ARR[20][20];
int main(){

	int x,y,size;
	int i,j;
	int xofs=10;
	int yofs=10;
	int empty,max;
	
	for(i=0;i<399;i++)ARR[i/20][i%20]=0;	
	while(scanf("%d,%d,%d",&x,&y,&size)!=EOF){
		
		if(size>=1){
			ARR[x  +xofs][y  +xofs]++;
			ARR[x+1+xofs][y  +xofs]++;
			ARR[x  +xofs][y+1+xofs]++;
			ARR[x-1+xofs][y  +xofs]++;
			ARR[x  +xofs][y-1+xofs]++;
		}
		if(size>=2){
			ARR[x+1+xofs][y+1+xofs]++;
			ARR[x+1+xofs][y-1+xofs]++;
			ARR[x-1+xofs][y+1+xofs]++;
			ARR[x-1+xofs][y-1+xofs]++;
		}
		if(size>=3){
			ARR[x+2+xofs][y  +xofs]++;
			ARR[x  +xofs][y+2+xofs]++;
			ARR[x-2+xofs][y  +xofs]++;
			ARR[x  +xofs][y-2+xofs]++;
		}
		
	}

	max=0;
	empty=0;
	for(i=0;i<10;i++){
		for(j=0;j<10;j++){
		if(ARR[i+xofs][j+xofs]==0)empty++;
		if(ARR[i+xofs][j+xofs]>=max)max=ARR[i+xofs][y+xofs];
		}
	}
	printf("%d\n%d\n",empty,max);

	return 0;
}

Measured memory_bytes: 600
using System;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(" ");
        var N = int.Parse(input[0]);
        var X = int.Parse(input[1]);
        var T = int.Parse(input[2]);

        var time = 0;
        var total = 0;
        while(total < N)
        {
            time += T;
            total += X;
        }

        Console.WriteLine(time);
    }
}


Measured memory_bytes: 27512
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n) ; i++)
#define rrep(i,n) for(int i = n-1; i >= 0 ; i--)
constexpr auto INF = 2147483647;
typedef long long ll;

int main(){

  int q;
  cin >> q;
  string x, y;
  int len_x, len_y;
  rep(i,q){
    cin >> x >> y;
    len_x = x.size()+1; len_y = y.size()+1;
    vector<vector<int>> lscDP(len_x, vector<int>(len_y));
    rep(i,len_x)rep(j,len_y){
      if(i==0 || j == 0) lscDP[i][j] = 0;
      else if(x[i-1] == y[j-1]) lscDP[i][j] = max(lscDP[i-1][j-1] +1, max(lscDP[i-1][j], lscDP[i][j-1]));
      else lscDP[i][j] = max(lscDP[i-1][j], lscDP[i][j-1]);
    }

    cout << lscDP[len_x-1][len_y-1] << endl;
  }


  return 0;
}


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

int gcd(int a,int b){
	if(a==0)
	return b;
	if(b==0)
	return a;
	if(a==b)
	return a;
	if(a>b)
	return gcd(a-b,b);
	return gcd(a,b-a);
}

int GCD(int a,int b){
	if(a==0)
	return b;
	if(b==0)
	return a;
	if(a==b)
	return a;
	return GCD(b,a%b);
}

int main(){
	ll t;
	cin>>t;
	if(t%1000==0)
	cout<<"0"<<endl;
	else{
		ll x=t%1000;
		cout<<1000-x<<endl;
	}
}

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

int main(){
	long long W,H,x,y;
	cin >> W >> H >> x >> y;
	cout << W*H/2;
	if(W*H%2==1)cout << ".5";
	cout << " ";
	if(x*2==W && y*2==H)cout << "1" << endl;
	else cout << "0" << endl;
	return 0;
}

Measured memory_bytes: 256
D=int(input())
clist=list(map(int,input().split()))
smat=[[int(x) for x in input().split()] for _ in range(D)]
#print(clist)
#print(smat)

index_set=set(range(26))
for d in range(D):
  max_index=-1
  max_sd=-1
  for i in index_set:
    if max_sd<smat[d][i]:
      max_index=i
      max_sd=smat[d][i]
      
  print(max_index+1)
  index_set.remove(max_index)
  if not index_set:
    index_set=set(range(26))
  else:
    sum_c=0
    for i in index_set:
      sum_c+=clist[i]
    if sum_c==0:
      index_set=set(range(26))

Measured memory_bytes: 68556
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>

typedef long double ld;
typedef long long ll;

using namespace std;

#define MOD 1000000007

ll mypow(ll n, ll k) {
	ll ret = 1;
	ll cur = n;
	while (k) {
		if (k & 1) {
			ret *= cur;
			ret %= MOD;
		}
		cur *= cur;
		cur %= MOD;
		k >>= 1;
	}
	return ret;
}

ll inv(ll n) {
	return mypow(n, MOD - 2);
}

ll cnk(ll n, ll k) {
	ll ret = 1;
	for (ll i = n - k + 1; i <= n; i++) {
		ret *= i;
		ret %= MOD;
	}
	for (ll i = 1; i <= k; i++) {
		ret *= inv(i);
		ret %= MOD;
	}
	return ret;
}

ll sub(ll a, ll b) {
	return (a + MOD - b) % MOD;
}

int main() {
	ll n, a, b;
	cin >> n >> a >> b;
/*
	for (int i = 1; i <= n; i++) {
		cout << inv(i) << endl << endl;
		return 0;
	}
	cout << endl;
	cout << mypow(2,n) << endl;
	cout << cnk(n,a) << endl;
	cout << cnk(n, b) << endl;

*/
	cout << sub(sub(sub(mypow(2,n), 1), cnk(n, a)), cnk(n, b)) << endl;

	return 0;
}


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

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

//head
int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
  	ll n, m;
  	cin >> n >> m;
  	ll ans = 0;
  	ans += min(n, m/2);
  	m -= min(n, m/2) * 2;
  	n -= min(n, m/2);
  	if(m > 0){
  		ans += m/4;
  	}
  	cout << ans << endl;
	return 0;
}


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

int main(){
    int m, d;
    cin>>m>>d;
    int ans = 0;

    for(int i = 4; i<=m; i++){
        for(int j = 22; j <= d; j++){
            int d_1 = j%10;
            int d_10 = (j - j%10)/10;
            if(d_1 * d_10 == i){
                if(d_1>=2 && d_10>=2){
                    ans++;
                }
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}

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

typedef long long i64;

using namespace std;

int main(){
    int N;
    cin>>N;
    int ans = 0;
    int num = 1e9;

    if(N == 1){
        cout<<"1\n";
        return 0;
    }


    for(int i=2;i<=N;i++){
        for(int j = 2; pow(i,j)<=N; j++){
            int X = N - pow(i,j);
            if(num > X){
                num = X;
                ans = pow(i,j); 
            }
        }
    }

    cout<<ans<<endl;


}

Measured memory_bytes: 512
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

//以下、素集合と木は同じものを表す
class UnionFind {
public:
    vector<ll> parent; //parent[i]はiの親
    vector<ll> siz; //素集合のサイズを表す配列(1で初期化)
    map<ll,vector<ll>> group;//素集合ごとに管理する連想配列(keyはそれぞれの素集合の親、valueはその素集合の要素の配列)

    //コンストラクタの:の後ろでメンバ変数を初期化
    UnionFind(ll n):parent(n),siz(n,1){ 
        //最初は全ての要素の根はそれ自身であるとして初期化
        for(ll i=0;i<n;i++){parent[i]=i;}
    }

    ll root(ll x){ //データxの属する木の根を取得
        if(parent[x]==x) return x;

        return parent[x]=root(parent[x]);
        //代入式の値は代入した変数の値になる
        //経路圧縮(根に直接要素を繋ぐことで計算を効率化する)を行っている
    }

    void unite(ll x,ll y){ //xとyの木を併合
        ll rx=root(x);//xの根をrx
        ll ry=root(y);//yの根をry
        if(rx==ry) return; //同じ木にある時
        //小さい集合を大きい集合へと併合(ry→rxへ併合)
        if(siz[rx]<siz[ry]) swap(rx,ry);
        siz[rx]+=siz[ry];
        parent[ry]=rx; //xとyが同じ木にない時はyの根ryをxの根rxにつける
    }

    bool same(ll x,ll y){//xとyが属する木が同じかを判定
        ll rx=root(x);
        ll ry=root(y);
        return rx==ry;
    }

    ll size(ll x){ //xの素集合のサイズを取得
        return siz[root(x)];
    }

    //↓他の人のライブラリにはないけど便利だと思う関数
    //O(n)であることに注意
    void grouping(ll n){//素集合どうしをグループ化
        REP(i,n){
            if(group.find(parent[i])==group.end()){
                group[parent[i]]={i};
            }else{
                group[parent[i]].PB(i);
            }
        }
    }
};

signed main(){
    //入力の高速化用のコード
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    ll n,m;cin >> n >> m;
    UnionFind uf(n);
    REP(i,m){
        ll x,y,z;cin >> x >> y >> z;
        uf.unite(x-1,y-1);
    }
    REP(i,n)uf.root(i);
    uf.grouping(n);
    cout << SIZE(uf.group) << endl;
}

Measured memory_bytes: 12800
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
typedef long long ll;
typedef priority_queue<int> PQI;
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);

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

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int w,h,x,y,r;
    cin>>w>>h>>x>>y>>r;
    bool a=true;
    if(x-r<0) a=false;
    if(x+r>w) a=false;
    if(y-r<0) a=false;
    if(y+r>h) a=false;
    if(a) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3176
import math

MOD = 10 ** 9 + 7


def cmb(n, r):
    total = 1
    for i in range(r):
        total = total * (n - i) % MOD
    return total * pow(math.factorial(r), MOD - 2, MOD) % MOD


def calc(n, r):
    ret = 1
    for i in range(r):
        ret = ret * (n - i) % MOD
    return ret * pow(math.factorial(r), MOD - 2, MOD) % MOD


if __name__ == '__main__':
    n, a, b = list(map(int, input().split(" ")))

    total = pow(2, n, MOD)
    a_total = cmb(n, a)
    b_total = cmb(n, b)
    print((total - a_total - b_total - 1) % MOD)

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

signed main(){
  unsigned long long int X,Y;
  cin >> X >> Y;
  for(unsigned long long int i=1;i<3;i++){
    if(X*i%Y!=0){
      cout << X*i << endl;
      break;
    }
    if(i==2){
      cout << -1 << endl;
    }
  }
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define ll long long
const ll mod=1e9+7;
using namespace std;
ll n,m,k,sum,ans;
const int maxn=1e5+5;
ll a[maxn];
ll dp[maxn];
int main()
{
    dp[0]=1;
    dp[1]=1;
    dp[2]=2;
    for(int i=3;i<maxn;i++)
    {
        dp[i]=(dp[i-1]+dp[i-2])%mod;
    }
   // printf("%lld\n",((((dp[20]*dp[20]%mod)*dp[20]%mod)*dp[20]%mod)*dp[10]%mod));
    scanf("%lld%lld",&n,&m);
    if(m==0)
    {
        printf("%lld\n",dp[n]);
        return 0;
    }

    for(ll i=1;i<=m;i++)
    {
        scanf("%lld",&a[i]);
    }
    ll sum=1;
    sum=dp[a[1]-1];
    for(ll i=2;i<=m;i++)
    {
        if(a[i]==a[i-1]||(a[i]-a[i-1]-2)==0)
            continue;
        if(a[i]-a[i-1]==1)
        {
            printf("0\n");
            return 0;
        }
        else
        {
            sum=(sum*dp[a[i]-a[i-1]-2])%mod;
        }
    }
    sum=(sum*dp[n-a[m]-1])%mod;
    printf("%lld\n",sum);
}


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

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))    
#define OUT(P) cout << (P) << endl    
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl    
#define PRINT_ARRAY(P) for(int i=0; i<P.size(); i++) cout << P[i] << endl;    
#define PRINT_ARRAY_INLINE(P) do { for(int i=0; i<P.size(); i++) cout << P[i] << " "; cout << endl; } while(0)    
#define PRINT_ARRAY_WITH_LABEL(L, P) do { cout << L << ": "; PRINT_ARRAY_INLINE(P); cout << endl; } while(0)    
typedef long long ll;    

int sum_digits(int num);    
template <class T>    
vector<T> copy_vector(vector<T> vec);    
int gcd(int a, int b);    

int main() {    
    int a, p;
    cin >> a >> p;
    p += a * 3;
    cout << p / 2 << endl;
    return 0;    
}    

/******************************/    
/***** DECRARED FUNCTIONS *****/    
/******************************/    

int sum_digits(int num) {    
    int rtn = 0;    
    while(num != 0) {    
        int tmp = num % 10;    
        rtn += tmp;    
        num /= 10;    
    }    
    return rtn;    
}    

// vectorのコピー    
template <class T>    
vector<T> copy_vector(vector<T> vec) {    
    vector<T> rtn;    
    rtn.reserve(vec.size());    
    copy(vec.begin(), vec.end(), back_inserter(rtn));    
    return rtn;    
}    

// ユークリウッドの互除法    
int gcd(int a, int b) {    
    if(b==0) return a;    
    else return gcd(b, a % b);    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5;
struct Element
{
    int u,v,opt;
} p[N+3];
int fa[N+3];
ll c;

int find(int u) {return fa[u]==u?u:fa[u]=find(fa[u]);}

int main()
{
    ll n,m,q;
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++) fa[i]=i;
    for(int i=1;i<=q;i++){
        scanf("%d%d%d",&p[i].u,&p[i].v,&p[i].opt);
        p[i].u++;
        p[i].v++;
        if(p[i].opt==0){
            int fu=find(p[i].u),fv=find(p[i].v);
            if(fu!=fv)
                fa[fu]=fv;
        }
    }

    ll huan = 0; c = 0;

    for(int i=1; i<=n; i++) {if(i==find(i)) c++;}
    for(int i=1;i<=q;i++){
        if(p[i].opt==1){
            huan++;
            if(find(p[i].u)==find(p[i].v)){
                printf("No\n");
                return 0;
            }
        }
    }

    ll temp=m-(n-c);
    ll l,r;
    l = huan?max(3ll,(ll)c):c-1ll,r = 1ll*c*(c-1ll)/2ll;
    if(l<=temp&&temp<=r)
        printf("Yes\n");
    else printf("No\n");
}


Measured memory_bytes: 1920
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)

int main() {
	ll N; cin >> N;
	ll p = 1;
	repe(i, 1, N) {
		p = i * p % 1000000007;
	}
	cout << p << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define REP(i, n) for(int i=0; i<n; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
using P = pair<int, int>;
const int inf = 1e9;
const ll INF = 1e18;
const ll mod = 1e9+7;

struct edge{
    int to;
    int cost;
};
using graph = vector<vector<edge>>;

int main(){
    int a, b, c, x, y; cin >> a >> b >> c >> x >> y;
    int ans = inf;
    for(int i=0; i<=max(x,y)*2; i+=2){
        ans = min(ans, c*i+max(0, x-i/2)*a+max(0, y-i/2)*b);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
string S;
long long  A[200010] = {0};
int main(){
	cin >> S;
	int N = S.size();
	long long ans = 0;
	for(int i=N-1;i>=0;i--){
		A[i] = (S[i]=='W');
		A[i] += A[i+1];
		if(S[i]=='B') ans += A[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 2180
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define Sort(v, n) sort(v, v+n);
#define VSort(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define cY cout<<"Yes";
#define cN cout<<"No";
#define cA(a) cout<<a;
const ll MOD = 1000000007;



int main() {
    int x,a;cin >> x >>a;
    if(x<a) cout << 0;
    else cout << 10;
}



Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};
class UnionFind{
public:
  //親の番号を格納する変数。数値がマイナスの場合は親であり、その絶対値のサイズのグループを持っている
  vector<int> Parent;
  
  //コンストラクタ。-1で初期化する。
  UnionFind(int N){
    Parent = vector<int>(N,-1);
  }
  
  //Aが何処のグループに属しているか返す
  int root(int A){
    if(Parent[A] < 0) return A; //0以下の時は自分が親。自分のグループなので自分を返す
    return Parent[A] = root(Parent[A]); //根でなかった場合は再帰的に関数を呼ぶ。ついでにParent[A]を更新して次の時高速化する。
  }
  
  //自分の親の頂点数を返す。マイナスでグループのサイズを持っているので反転して返す。
  int size(int A){
    return -Parent[root(A)];
  }
  
  //AとBを連結する関数
  bool connect(int A, int B){
    A = root(A); //Aの親を持ってくる
    B = root(B); //Bの親を持ってくる
    if (A==B){ //親が同じだったらくっつけない
      return false;
    }
    
    //Aが必ず大きい数にする
    if (size(A) < size(B)) swap(A,B);
    
    //AにBのグループをくっつける。
    Parent[A] += Parent[B];
    //Bの親をAにする。
    Parent[B] = A;
    
    return true;
  }
};
int main(){
  int n,m; cin >> n >> m;
  UnionFind uf(n);
  rep(i,m){
    int x,y,z; cin >> x >> y >> z;
    x--;y--;
    uf.connect(x,y);
  }
  
  set<int> st;
  rep(i,n){
    st.insert(uf.root(i));
  }
  
  cout << st.size() << endl;
  
  return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(int)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;

int n;
vvi G;
int depth(int a){
  vi d;
  each(itr, G[a]) d.pb(depth(*itr));
  sort(rng(d));
  reverse(rng(d));
  int ret = 0;
  FOR(i, 0, sz(d)) maxs(ret, d[i]+i+1);
  return ret;
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  G.resize(n+1);
  FOR(i, 2, n+1){
    int a;
    cin >> a;
    G[a].pb(i);
  }
  cout << depth(1) << endl;
  return 0;
}

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

int main() {

  int m;
  while(cin >> m, m) {
    int ret = 1000111000;

    for(int z=0; z*z*z<=m; z++) {
      int y = sqrt(m-z*z*z);
      int x = m - (z*z*z + y*y);
      ret = min(ret, x+y+z);
    }

    cout << ret << endl;
  }

  return 0;
}

Measured memory_bytes: 3092
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip.split())
def main():
    lst = [1 for i in range(10**5+5)]
    s = 1
    for i in range(3,10**5+5):
        s += lst[i-2]
        lst[i] = s
    n,m = LI()
    kaidan = [1 for _ in range(n+1)]
    for _ in range(m):
        a = I()
        kaidan[a] = 0
    itr = itertools.groupby(kaidan)
    span = []
    ans = 1

    for key, group in itr:
        lenth = len(list(group))
        if key == 0 and lenth >= 2:
            ans = 0
        elif key == 1:
            span.append(lenth)

    for i in span:
        ans *= lst[i]%1000000007
        ans %= 1000000007
    
    print(ans)

main()

Measured memory_bytes: 523520
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
  priority_queue<int>st[1000];
  int n,tc,q,t;
  ll x;
  cin>>n>>tc;
  while(tc--)
  {
    cin>>q;
    if(q==0)
    {
      cin>>t>>x;
      st[t].push(x);
    }
    else if(q==1)
    {
      cin>>t;
      if(!st[t].empty())
      {
        cout<<st[t].top()<<endl;
      }
    }
    else if(q==2)
    {
      cin>>t;
      if(!st[t].empty())
      {
        st[t].pop();
      }
    }
  }
}



Measured memory_bytes: 4136
#include <bits/stdc++.h>
using namespace std;
int main(){
	int target,n;
	while(cin>>target,target){
		cin>>n;
		int begin,end,sum=0;
		for(int i=0;i<n;i++){
			cin>>begin>>end;
			sum+=(end-begin);
		}
		if(sum>=target)cout<<"OK"<<endl;
		else cout<<target-sum<<endl;
	}
}

Measured memory_bytes: 1160
if __name__ == "__main__":
    while True:
        n = int(input())
        if n ==0:break
        nline = [i for i in range(1,n+1)]
        count = 0
        for i in range(n):
            for j in  range(i+1,n):
                if sum(nline[i:j]) > n:break
                if sum(nline[i:j]) == n:count +=1

        print(count)

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

int main(){
  int n,k;
  cin >> n >> k;
  int arr[n+1];
  for(int i=0;i<=n;i++){
    arr[i]=0;
  }
  for(int i=0;i<k;i++){
    int d;
    cin >> d;
    for(int j=0;j<d;j++){
      int p;
      cin >> p;
      arr[p]++;
    }
  }
  int count=0;
  for(int i=1;i<=n;i++){
    if(arr[i]==0)count++;
  }
  cout << count;
  return 0;
}

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

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

int merge(int A[], int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    int L[n1 + 1], R[n2 + 1];
    rep(i, n1) L[i] = A[left + i];
    L[n1] = MAX;
    rep(i, n2) R[i] = A[mid + i]; 
    R[n2] = MAX;
    
    int i = 0;
    int j = 0;
    for(int k = left; k < right; ++k) {
        if(L[i] <= R[j]) {
            A[k] = L[i];
            ++i;
        } else {
            A[k] = R[j];
            ++j;
        }
    }
    return right - left;
}

int mergeSort(int A[], int left, int right) {
    int mid;
    int cnt = 0;
    if(right - left > 1) {
        mid = (left + right) / 2;
        cnt += mergeSort(A, left, mid);
        cnt += mergeSort(A, mid , right);
        cnt += merge(A, left, mid, right);
    }
    return cnt;
}

int main(void) {
    int N;
    scanf("%d", &N);
    int A[N];
    rep(i, N) scanf("%d ", &A[i]);
    
    int cnt = mergeSort(A, 0, N);
    rep(i, N - 1) printf("%d ", A[i]);
    printf("%d\n%d\n", A[N - 1], cnt);
    
    return 0;
}


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

#define REP(i,n) for(int i=0;i<n;i++)
typedef long long int lli;
typedef pair<int, int> P;

int yaku[1003];
//int array[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997};
//vector<int> prime(array, array+sizeof(array));
vector<int> prime{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997, 1009};

int main() {
    int n;
    lli ans = 1;
    cin >> n;

    for(int i = 2; i < n+1; i++) {
        //cout << "i: " << i << endl;
        for(int j=2;j<i+1;j++) {
            if (find(prime.begin(), prime.end(), j) == prime.end())
                continue;
            //cout << "j: " << j << endl;
            int count = 0;
            int num = i;
            while (true) {
                if (num % j != 0)
                    break;
                num /= j;
                //cout << "num: " << num << endl;
                count++;
            }
            //cout << "count: " << count << endl;
            yaku[j] += count;
        }
    }
    //REP(i, n+1) {
    //    cout << "yaku: " << i << "i: "<< yaku[i] << endl;
    //}

    REP(i, n+1) {
        if (yaku[i] == 0)
            continue;
        ans = (ans * (yaku[i] + 1)) % (1000000007);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> adj(100001);
int visited[100001],dp[100001];
    
void dfs(int n)
{
    visited[n]=1;
    for(int i=0;i<adj[n].size();i++)
    {
        if(!visited[adj[n][i]])
        {
            dfs(adj[n][i]);
        }
        dp[n]=max(dp[n], 1+dp[adj[n][i]]);
        
    }
}
int main()
{
    int n,m;
    cin>>n>>m;
    
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        adj[x].push_back(y);
    }
    
    for(int i=0;i<=n;i++)
    {
        visited[i]=0;
        dp[i]=0;
    }
    
    for(int i=1;i<=n;i++)
    {
        if(!visited[i])
        dfs(i);
    }
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        ans=max(ans,dp[i]);
    }
    cout<<ans<<"\n";
}

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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

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

ll modpow(ll a, ll b){

    ll ans=1;
    while(b){
        if(b&1){
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return ans;
}


int main(){

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

    int n,k,c;
    cin>>n>>k>>c;

    vector<int> nxt(n + 1);

    vector<int> suff(n + 1);

    string s;
    cin>>s;

    int cur = -1;

    for(int i = n - 1; i >= 0; i--) {
        int res = suff[i + 1];

        if(s[i] == 'o') {
            res = 1;
            if(i + c + 1 < n) {
                res += suff[i + c + 1];
            }

            if(cur == -1) {
                cur = i;
                nxt[i] = -1;
            } else {
                nxt[i] = cur;
                cur = i;
            }
        }  

        suff[i] = res;
    }

    int rem = k;
    vector<int> chosen;

    for(int i = 0; i < n; i++) {
        if(rem == 0) break;
        if(s[i] == 'o') {
            rem--;
            chosen.push_back(i);
            i += c;
        }
    }

    vector<int> ans;

    for(int i = 0; i < chosen.size(); i++) {
        int leftSideChosen = i;

        int rightSideChosen = 0;

        if(nxt[chosen[i]] != -1) {
            rightSideChosen = suff[nxt[chosen[i]]];
        }

        if(leftSideChosen + rightSideChosen < k) {
            ans.push_back(chosen[i]);
        }
    }

    for(int i = 0; i < ans.size(); i++) {
        cout<<ans[i] + 1<<endl;
    }

}


Measured memory_bytes: 5004
import java.util.*;
public class Main {
	static int j;  /*j:判定*/
	static String x;
	static void solve(int a,int b){
		if(a>=b){
			return;
		}
		int k=0,m=0,n=0;
		m=x.charAt(a);
		if(m==40 || m==91){
			for(int i=a;i<b;i++){
				n=x.charAt(i);
				if(n==41 || n==93){
					k--;
				}
				if(n==40 || n==91){
					k++;
				}
				if(k==0){
				    if(m==40 && n==93 || m==91 && n==41){
				    	j++;
				    }
				    else{
				    	solve(a+1,i);
				    	solve(i+1,b);
				    }
					return;	
				}
				if(n==46){
					j++;
			}
		}
		}
		if(m==41 || m==93){
			j++;
		}
		solve(a+1,b);
	}
	public static void main(String[] args){
		Scanner cin = new Scanner(System.in);
		while(true){
			j=0;
			x=cin.nextLine();
			if(x.equals(".")){
				break;
			}
				solve(0,x.length()); 
			
				if(j==0){
					System.out.println("yes");
				}
				if(j>0){
					System.out.println("no");
				}
		}
	}
	}

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

int main(){
  int N, K;
  cin >> N >> K;
  ll a[N];
  ll sum[N + 1];
  sum[0] = 0;
  for(int i = 0; i < N; i++){
    cin >> a[i];
    sum[i + 1] = sum[i] + a[i];
  }

  vector<ll> A;
  for(int len = 1; len <= N; len++){
    for(int i = 0; i + len <= N; i++){
      A.push_back(sum[i + len] - sum[i]);
    }
  }

  /*for(int i = 0; i < A.size(); i++){
    cout << A[i] << endl;
  }*/

  vector<ll> kouho = A;
  for(int i = 42; i >= 0; i--){
    /*cout << "i = " << i << endl;
    cout << "kouho = ";
    for(int j = 0; j < kouho.size(); j++) cout << kouho[j] << " ";
    cout << endl;*/

    int cnt = 0;
    for(int j = 0; j < kouho.size(); j++){
      if(kouho[j] & (1LL << i)) cnt++;
    }

    //cout << "cnt = " << cnt << endl;
    if(cnt >= K){
      //cout << "hoge" << endl;
      vector<ll> tmp;
      for(int j = 0; j < kouho.size(); j++){
        if(kouho[j] & (1LL << i)) tmp.push_back(kouho[j]);
      }
      kouho = tmp;
    }
  }

  ll ans = kouho[0];
  for(int i = 0; i < kouho.size(); i++){
    ans &= kouho[i];
  }

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

Measured memory_bytes: 10092
N, K = map(int, input().split())
x = list(map(int, input().split()))
ans = float('inf')
for i in range(K - 1, N):
    l = x[i - K + 1]
    r = x[i]
    ans = min(ans, abs(l) + abs(l - r), abs(r) + abs(r - l))
print(ans)

Measured memory_bytes: 14384
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n) - 1; (i) >= 0; --i)
#define SZ(n) (int)(n).size()
#define ALL(n) (n).begin(), (n).end()
#define MOD LL(1e9 + 7)
#define INF 1000000
using namespace std;
using LL = long long;

int main() {
	int n, x;
	while (cin >> n >> x) {
		if (!(n + x)) break;
		int sum = 0;
		for (int i = 1; i < n - 1; i++) {
			for (int j = i + 1; j < n; j++) {
				for (int k = j + 1; k <= n; k++) {
					if (i + j + k == x) sum++;
				}
			}
		}
		cout << sum << endl;
	}
	return 0;
}



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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }

int main() {
  int N, X;
  scanf("%d%d", &N, &X);

  vector<int> D(N, 0);
  for (int i = 0; i < N; i++) {
    int x = 0;
    scanf("%d", &x);
    D.at(i) = abs(X - x);
  }

  int ans = D.at(0);
  for (int i = 1; i < N; i++) {
    ans = min(gcd(D.at(i), ans), ans);
  }

  printf("%d", ans);
  return 0;
}

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

int main() {
  int n,m;
  cin>>n>>m;
  vector<int> a(n);
  int sum=0;
  rep(i, n) {
    cin>>a[i];
    sum+=a[i];
  }

  int cnt=0;
  rep(i, n) {
    double x=(double)(a[i])/sum;
    if (x>=((double)(1.0)/(4.0*m))) cnt++;
  }
  if (cnt>=m) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
from itertools import product


def solve(string):
    h, w, *s = string.split()
    h, w = map(int, [h, w])
    s = ["#" + _s + "#" for _s in s]
    s = ["#" * (w + 2)] + s + ["#" * (w + 2)]
    ans = 0
    d = [(1, 0), (-1, 0), (0, 1), (0, -1)]
    for _h, _w in product(range(1, h + 1), range(1, w + 1)):
        if s[_h][_w] == "#":
            continue
        q = list()
        for x, y in d:
            if s[_h + x][_w + y] == ".":
                q.append((_h + x, _w + y, _h, _w))
        if len(q) > 2:
            continue
        c = [[h * w] * (w + 2) for _ in range(h + 2)]
        c[_h][_w] = 0
        while q:
            cx, cy, px, py = q.pop()
            if c[px][py] + 1 >= c[cx][cy]:
                continue
            c[cx][cy] = c[px][py] + 1
            for x, y in d:
                nx = cx + x
                ny = cy + y
                if s[nx][ny] == ".":
                    q.append((nx, ny, cx, cy))
        for i, j in product(range(1, h + 1), range(1, w + 1)):
            ans = max(ans, c[i][j] * (s[i][j] == "."))
    return str(ans)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int l[30001];//i文字目までに存在する集合
int r[30001];
bool num[1000];
string ss[1000];
int cnt(int n)
{
	int ret=0;
	while(n>0)
	{
		if(n&1)
			ret++;
		n>>=1;
	}
	return ret;
}
int main()
{
	int n;
	string s;
	ll ans=0;
	cin>>n;
	cin>>s;
	fill(l,l+30001,0);
	fill(r,r+30001,0);
	fill(num,num+1000,false);
	for(int i=0;i<1000;i++)
	{
		ss[i]=to_string(i);
		for(;ss[i].size()<3;)
			ss[i]='0'+ss[i];
	}
	for(int i=0;i<n;i++)
	{
		l[i+1]=(l[i]|(1<<(s[i]-'0')));
	}
	for(int i=n-1;i>-1;i--)
	{
		r[i]=(r[i+1]|(1<<(s[i]-'0')));
	}
	for(int i=1;i<n-1;i++)
	{
		//l[i],r[i+1]
		for(int j=0;j<1000;j++)
		{
			if((l[i]&(1<<(ss[j][0]-'0'))) && (r[i+1]&(1<<(ss[j][2]-'0'))) && (ss[j][1]==s[i]))
				num[j]=true;
		}
	}
	for(int i=0;i<1000;i++)
	{
		if(num[i])
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << "\n"
using namespace std;
using ll = long long;

signed main() {
    IO;
    // int tests = 1;
    // cin >> tests;
    // for(int test = 1; test <= tests; ++test) {
        
    // }
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for(int i = 0; i < s.size(); ++i) ans += (s[i] != t[i]);
    cout << ans;
    return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
  string s,t;
  cin >> s >> t;
  for(int i=0;i<s.length();i++){
    if(s[i] != t[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 3592
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,m,d=map(int,input().split())
    ans=0
    if d==0:
        print((m-1)/n)
    else:
        print(2*(n-d)*(m-1)/n**2)

if __name__=='__main__':
    main()

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

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define H_MAX 50
#define W_MAX 50

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

bool pairComp(const pii& fip, const pii& sep) {
	return fip.se < sep.se;
}

namespace patch {
  template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
}

int main() {

	int n,m;
	cin >> n >> m;
	vector<pii> bridges;
	int a,b;
	rep(i,m) {
		cin >> a >> b;
		bridges.pb(pii(a,b));
	}
	sort(bridges.begin(), bridges.end(), pairComp);

	vector<pii>::iterator iter=bridges.begin();
	int temp1 = -1;
	int ans = 0;
	while(iter != bridges.end()) {
		if(temp1 == iter->se || temp1 > iter->fi) {
			iter++;
			continue;
		}
		temp1 = iter->se;
		ans++;
		iter++;
	}

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


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

using ll=long long;



void solve(){
    ll x,y;
    cin>>x>>y;
    if(x%y==0){
        cout<<-1<<endl;
        return;
    }else{
        cout<<x<<endl;
    }   
}

signed main(){
    //while(1)
    solve();
}

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

ll memo[2004][2004];
//bool init_flag = false;

void init(int N) {
    for(int i = 0; i < N+2; ++i) {
        memo[i][0] = 1; memo[i][i] = 1;
    }
    for(int i = 1; i < N+2; ++i) {
        for(int j = 1; j < i; ++j) {
            memo[i][j] = (memo[i-1][j-1] + memo[i-1][j])%mod;
        }
    }
}

ll comb(int N, int R) {
    /*
    if(!init_flag) {
        //初期化
        for(int i = 0; i < 2002; ++i) {
            memo[i][0] = 1; memo[i][i] = 1;
        }
        for(int i = 1; i < 2002; ++i){
            for(int j = 1; j < i; ++j) {
                memo[i][j] = (memo[i-1][j-1] + memo[i-1][j])%mod;
            }
        }
    }
    */
    return memo[N][R];
}

/*
int comb(int N, int R) {
    if(N < R || N <= 0 || R < 0) return 0;
    if(N == R || R == 0) return 1;
    return (comb(N-1, R-1) + comb(N-1, R))%mod;
}
*/
/*
int expo(int A, int X) {
    int ans = 1;
    for(int i = 0; i < X; ++i) {
        ans *= A; ans %= mod;
    }
    return ans;
}
*/


int main()
{
    int N, K;
    cin >> N >> K;
    init(N);
    for(int i = 1; i <= K; ++i) {
        cout << comb(N-K+1, i)* comb(K-1, i-1) % mod << endl;
    }
    return 0;
}

Measured memory_bytes: 30080
n = int(input())
xu = list(list(map(str,input().split())) for _ in range(n))

answer = 0
for i in range(n):
    if xu[i][1] == 'JPY':
        answer += int(xu[i][0])
    else:
        answer += float(xu[i][0])*380000

print(answer)


Measured memory_bytes: 2940
function Main(input) {
    lines = input.split("\n");
    const [n, m] = lines.shift().split(' ').map(v => +v);

    if (m == 0) return console.log('0 0');
    
    const ac = {}, wa = {};
    lines.forEach(l => {
        const [p, s] = l.split(' ');
        if (s == 'AC') ac[p] = true;
            else if (!ac[p]) wa[p] = wa[p] ? wa[p] + 1 : 1;
    });
    const waCount = Object.keys(wa).reduce( (acc, key) => acc + (ac[key] ? wa[key] : 0), 0 );
    
    console.log(Object.keys(ac).length, waCount);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(){
    int r, c, a[101][101];
    cin >> r >> c;
    for(int i = 0; i < r; i++){
        for(int j = 0; j < c; j++){
            cin >> a[i][j];
        }
        a[i][c] = 0;
    }
    for(int i = 0; i < r; i++){
        for(int j = 0; j < c; j++){
            cout << a[i][j] << " ";
            if(j != c) a[i][c] = a[i][c] + a[i][j];
            if(j == c-1) cout << a[i][c] << endl;
        }
    }
    for(int i = 0; i < c + 1; i++){
        int rt = 0;
        for(int j = 0; j < r ; j++){
            rt = rt + a[j][i];
        }
        cout << rt;
        if(i != c) cout << " " ;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3124
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#define INF (long)1e9
const int MOD = 1e9 + 7;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<P> vec;
	for(int i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
		vec.push_back(P(a, b));
	}
	sort(vec.begin(), vec.end());
	int left = -INF, right = INF, ans = 1;
	for(int i = 0; i < m; i++)
	{
		//cout << vec[i].first << " " << vec[i].second << " " << left << " " << right << endl;
		if(vec[i].first >= right)
		{
			ans++;
			left = -INF, right = INF;
		}
		left = max(vec[i].first, left);
		right = min(vec[i].second, right);
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <utility>
#include <map>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
vector<ll> a;
const ll INF = 1e16;

int main()
{
    int a,b;
    cin>>a>>b;
    int x=0;
    if(a>=b)
    {
        x+=a;
        a--;
        if(a>=b)
        {
            x+=a;
            a--;
        }
        else if(a<b)
        {
            x+=b;
            b--;
        }
    }
    else if(a<b)
    {
        x+=b;
        b--;
        if(a>=b)
        {
            x+=a;
            a--;
        }
        else if(a<b)
        {
            x+=b;
            b--;
        }
    }
    cout<<x<<endl;
    return 0;
}




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

int main()
{
    int a,b;
    cin >> a >> b;
    if(a<b)
    {
        cout << "a < b" << endl;
        return 0;
    }
    if(a>b)
    {
        cout << "a > b" << endl;
        return 0;
    }
    if(a==b)
    {
        cout << "a == b" << endl;
        return 0;
    }

}



Measured memory_bytes: 3096
from itertools import permutations
from math import sqrt

def dist(A,B):
    p=A[0]-B[0]
    q=A[1]-B[1]
    return sqrt(p*p+q*q)

def f(n):
    if n==0:
        return 1
    return f(n-1)*n

N=int(input())
P=[]
for _ in range(N):
    x,y=map(int,input().split())
    P.append((x,y))

T=permutations(P,N)

D=0
for H in T:
    S=0
    for k in range(N-1):
        S+=dist(H[k],H[k+1])
    D+=S
print(D/f(N))

Measured memory_bytes: 73928
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE cout << -1 << endl;return 0
#define Endl endl


signed main(void){
    int N,M;
    int k[14],s[14][14];
    int p[14];
    cin >> N >> M;
    REP(i,M){
        cin >> k[i];
        REP(j,k[i]){
            cin >> s[i][j];
            s[i][j]--;
        }
    }
    REP(i,M){
        cin >> p[i];
    }
    int Ans=0;
    bool d[14]={};
    for(int l=0;l<(1<<N);l++){
        REP(i,N){
            if((l>>i)%2==1){
                d[i]=1;
            }else{
                d[i]=0;
            }
        }
        int num=0;
        int c=0;
        REP(i,M){
            c=0;
            REP(j,k[i]){
                if(d[s[i][j]]==1){
                    c+=1;
                }
            }
            if(c%2==p[i])num++;
        }
        if(num==M)Ans++;
        //cout << num << endl;
    }
    cout << Ans << endl;

    
    
    
    return 0;
}



Measured memory_bytes: 256
until (n = gets.to_i).zero?
  data = n.times.map {gets.split.map(&:to_i)}.map {|a, b| Rational(a, b)}
  lcm = data.map(&:denominator).inject(:lcm)
  nums = data.map {|d| Rational(1, d * lcm)}
  
  lcm = nums.map(&:denominator).inject(:lcm)
  puts nums.map {|n| (n * lcm).to_i}
end


Measured memory_bytes: 6924
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
const int N = 1e5 + 5;
int n, m;
int out[N], cnt[N];
vector<ii> G[N];
ii ans[N];
bool vis[N];
#define fi first
#define se second
void dfs(int u){
	vis[u] = 1;
	cnt[u] = out[u];
	for(auto x : G[u]){
		int v = x.fi;
		if(!vis[v]){
			dfs(v);
			cnt[u]+=cnt[v];
			cnt[u]%=2;
			if(cnt[v]%2) swap(ans[x.se].fi,ans[x.se].se); 
		}
	}
}
int main(){
	cin >> n >> m;
	for(int i=1;i<=m;i++){
		int u, v;
		cin >> u >> v;
		out[u]++;
		G[u].push_back({v,i});
		G[v].push_back({u,i});
		ans[i] = {u,v};
	}
	int tmp = 0;
	for(int i=1;i<=n;i++) out[i] %= 2, tmp+= out[i];
	if(tmp%2) return cout << -1, 0;
	dfs(1);
	for(int i=1;i<=m;i++) cout << ans[i].fi << " " << ans[i].se << endl;
}

Measured memory_bytes: 13184