akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    vector<int> a(2,0);
    rep(i,s.size()){
        a[s[i]-'0']++;
    }
    cout << min(a[0],a[1])*2;




    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int t[] = new int[N + 1];
		int x[] = new int[N + 1];
		int y[] = new int[N + 1];

		t[0] = 0;
		x[0] = 0;
		y[0] = 0;

		for (int i = 0; i < N; i++) {
			t[i + 1] = sc.nextInt();
			x[i + 1] = sc.nextInt();
			y[i + 1] = sc.nextInt();
		}

		for (int i = 0; i < N; i++) {
			int t2 = t[i + 1] - t[i];
			int dist = Math.abs(x[i + 1] - x[i]) + Math.abs(y[i + 1] - y[i]);

			if(t2 < dist || (t2 - dist) % 2 != 0) {
				System.out.println("No");
				return;
			}
		}

		System.out.println("Yes");
	}

}


Measured memory_bytes: 93736
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "Second" <<"\n"; return;}
#define SP << " " <<
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------
vector<ll> ike(101010);
bool ok=false;
struct edge{ll to;};
struct graph{
    ll N;
    vector<vector<edge> > G;
    vector<bool> used;

    graph(ll n): N(n), G(N), used(N,false) {}

    void ade(ll s, ll t){
        G[s].emplace_back((edge){t});
        G[t].emplace_back((edge){s}); //無向ならON
    }

    void dfs(ll v=0){
        used[v]=true;
        ll ct=0;
        for(auto E : G[v]){
            if(!used[E.to]){
                dfs(E.to);
                ct+=ike[E.to];
            }
        }
        if(ct>=2) ok=true;
        if(ct==0) ike[v]=1;
        else ike[v]=0;
    }
};

//--MAIN-----------------------------------
void Main() {
    ll N; cin>>N;
    // 下にtrueが2つ以上あればかち, trueが1つならfalseに, 0ならtrueに。
    // 2つ以上生えてる点をrootに。
    graph g(N);
    vector<ll> ct(N,0);
    ll root=-1;
    rep(i,N-1){
        ll a,b; cin>>a>>b;--a,--b;
        g.ade(a,b);
        if(++ct[a]>1) root=a;
        if(++ct[b]>1) root=b;
    }
    if(N==2) dame;
    g.dfs(root);
    cout<< ( ok ? "First" : "Second" )<<"\n";

}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 7936
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll A, B, N;

ll Solve(ll X){
  ll ans = (A * X) / B - (X / B) * A;
  return ans;
}

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

  if (B <= N){
    cout << Solve(B - 1) << endl;
  }else{
    cout << Solve(N) << endl;
  }
  
  
  return 0;
}


Measured memory_bytes: 3596
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}

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

  double a, b; cin >> a >> b;
  int x, y;
  x = (int) a; y = (int) b;
  cout << x / y << " ";
  cout << x % y << " "; 
  printf("%.15f\n", a / b);

  return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[310][310];
char S[310][310];

int main()
{
    int n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>m>>k;

    for(int i=1;i<=n;i++){
        cin>>S[i]+1;
    }

    cur = 0;

    for(int j=1;j<=m;j++){
        cnt = 0;
        idx = -1;
        for(int i=1;i<=n;i++){
            if(S[i][j]=='#'){
                idx = i;
                break;
            }
        }
        if(idx==-1){
            for(int i=1;i<=n;i++)
                A[i][j] = A[i][j-1];
            continue;
        }
        ++cur;
        for(int i=1;i<=idx;i++){
            A[i][j] = cur;
        }
        for(int i=idx+1;i<=n;i++){
            if(S[i][j]=='#'){
                ++cur;
            }
            A[i][j] = cur;
        }
    }
    idx = -1;
    for(int j=1;j<=m;j++){
        if(A[1][j]){
            idx = j;
            break;
        }
    }

    for(int j=idx-1;j>=1;j--)
        for(int i=1;i<=n;i++)
            A[i][j] = A[i][j+1];

    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cout<<A[i][j]<<" ";
        }
        cout<<"\n";
    }

    return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP0(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define FILL(c, v) fill((c).begin(),(c).end(), v)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef unsigned long long ULL;

const int INTINF = 2147483647;
const LL LLINF = 9223372036854775807;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int A[50];
int B[50];
int C[50];



void solve() {
  int N; cin >> N;
  REP1(i,N) cin >> A[i];
  REP1(i,N) cin >> B[i];
  REP1(i,N-1) cin >> C[i];
  int ans=0;
  REP1(i, N) {
    ans += B[A[i]];
    if ((i!=1) and (A[i-1]+1==A[i])) ans += C[A[i-1]];
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 256
A = input()
a,b,c,d = map(int,[A[0],A[1],A[2],A[3]])

op = ['-','+']
for i in range(8):
  o = format(i, '03b')
  if o[0] == str(0):
    s = a-b
  else:
    s = a+b
  if o[1] == str(0):
    s = s-c
  else:
    s = s+c
  if o[2] == str(0):
    s = s-d
  else:
    s = s+d
  if s == 7:
    print(str(a)+op[int(o[0])]+str(b)+op[int(o[1])]+str(c)+op[int(o[2])]+str(d)+'=7')
    break

Measured memory_bytes: 3064
A,B=map(int,input().split())
S=input()

if S[0:A].isdigit():
    if S[A:A+1] == '-':
        if S[A+1:].isdigit():
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')


Measured memory_bytes: 2940
#n=int(input())
n,m=map(int,input().split())
hl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
dic={}
for i in range(m):
    a,b=map(int,input().split())
    if hl[a-1]<=hl[b-1]:
        dic[a]=False
    if hl[b-1]<=hl[a-1]:
        dic[b]=False

print(n-len(dic))


Measured memory_bytes: 19828
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

const int MAX_V = 310;
int d[MAX_V][MAX_V];
int flag[MAX_V][MAX_V];
int V;

int main() {
    int n;
    cin >> n;
    V = n;
    rep(i,n){
        rep(j,n){
            cin >> d[i][j];
        }
    }

    for(int k = 0; k < V; k++){
        for(int i = 0; i < V; i++){
            for(int j = 0; j < V; j++){
                //d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                if(d[i][j] > d[i][k]+d[k][j]){
                    cout << "-1" << endl;
                    return 0;
                }else if(d[i][j] == d[i][k]+d[k][j]){
                    if(k!=i && k!=j){
                        flag[i][j] = 1;
                    }
                    
                }
            }
        }
    }


    ll ans = 0;
    rep(i,n){
        rep(j,n){
            if(flag[i][j]==0){
                ans += d[i][j];
            }
        }
    }

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


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] values = new int[w];
		for(int i=0;i<values.length;i++){
			values[i]=i+1;
		}
		for(int i=0;i<n;i++){
			String str = sc.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0])-1;
			int b = Integer.parseInt(ab[1])-1;
			int c = values[a];
			values[a]=values[b];
			values[b]=c;
		}
		for(int i=0;i<w;i++)
		System.out.println(values[i]);
	}

}

Measured memory_bytes: 17188
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <ctime>
using namespace std;
typedef long long ll;

const int INF = 100000000;



int main(int argc, char *args[]) {
	int N; cin >> N;
	int H[21];
	int counter = 0;
	for (int i = 0; i < N; i++) {
		cin >> H[i];
	}
	for (int i = 0; i < N; i++) {
		bool flag = true;
		for (int j = 0; j < i; j++) {
			if (H[j] > H[i]) {
				flag = false;
				break;
			}
		}
		if (flag == true)counter++;
	}
	cout << counter << endl;

}

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

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
#define exit(a, b) return cout << a, b;

#define PB push_back
#define MP make_pair

#define sd(n) scanf("%lld", &n)
#define pdn(n) printf("%lld\n", n);
#define pds(n) printf("%lld ", n);
#define endl '\n'

#define forn(a, b, i) for (int i = a; i < b; i += 1)
#define all(v) v.begin(), v.end() 

using vi = vector<int>;
using vb = vector<bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

#define print(stuff) cout << stuff << endl
#define len(stuff) stuff.size()

#define int long long
#define float long double 

const int upper = 4e5 + 2;
const int M = (int) 1e9 + 7;
const int inf = (int) 1e17;
const double eps =  1e-8;

map<int, int> primecnt;
signed main () {
	start_routine();
	speed();
	#ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);	
	// freopen("output.txt", "w", stdout);
	// freopen("errlog.txt", "w", stderr);
	#endif

	int n, p; cin >> n >> p;
	int mn = inf;

	int te = p;
	vi primes;
	for (int i = 2; i * i <= p; i += 1) {
		int cnt = 0;
		while (te % i == 0) {
			te /= i;
			primecnt[i] += 1;
		}
		if (!cnt) continue;
		mn = min(mn, cnt);
	}
	if (te > 1) {
		primecnt[te] += 1;
		mn = min(mn, 1LL);
	}

	int g = 1;
	for (auto i: primecnt) {
		int kitnibaar = i.second / n;
		for (int j = 0; j < kitnibaar; j += 1) g *= i.first;
	}
	cout << g;
 	end_routine();	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=MOD;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    int memo=modpow(a,b/2);
    return memo*memo%MOD;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
    x=modpow(x,MOD-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
    return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
int n;
string s,t;
signed main(){
    cin>>n>>s>>t;
    rep(i,n)cout<<s[i]<<t[i];
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
from itertools import accumulate
from bisect import bisect_right as br
n = int(input())
alst = sorted(map(int, input().split()))
acc = list(accumulate(alst))
m = int(input())
blst = list(map(int, input().split()))
clst = list(map(int, input().split()))
for b, c in zip(blst, clst):
  index = br(alst, b)
  print(["No", "Yes"][(acc[index - 1] if index > 0 else 0) >= c])


Measured memory_bytes: 79204
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int a,b,h,w,g[111][111]={};
	cin>>a>>b;
	FORQ(i,1,50)FORQ(j,1,100)g[i][j]=1;
	a--;
	b--;
	FOR(i,52,100){
		if(b<=0)break;
		FOR(j,1,100){
			if(b<=0)break;
			g[i][j]=1;
			b--;
			j++;
		}


		i++;
	}
	FORD(i,50,1){
		if(a<=0)break;
		FOR(j,1,100){
			if(a<=0)break;
			g[i][j]=0;
			a--;
			j++;
		}


		i--;
	}

	cout<<100<<" "<<100<<endl;
	FORQ(i,1,100){
		FORQ(j,1,100){
			if(g[i][j]==1)cout<<"#";//kuro 1
			else cout<<".";
		}
		cout<<endl;
	}
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iterator>
#include <functional>
#include <numeric>
#include <cmath>

using namespace std;

#define ll long long
#define f0(i,n)for(i=0;i<n;i++)
#define f1(i,n)for(i=1;i<=n;i++)
#define fc(i,c,n)for(i=c;i<=n;i++)
#define f0r(i,n)for(i=n-1;i>=0;i--)
#define f1r(i,n)for(i=n;i>0;i--)
#define fcr(i,c,n)for(i=c;i>=0;i--)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define co(a) cout<<a<<endl;
#define coc(a) cout<<a<<" ";

typedef list<ll> LST;
typedef vector<ll> VEC;
typedef map<ll, ll> MAP;

ll i, j, q;
ll n, m, p, k, t, s, h, f;
ll a, b, c, d;
ll x, y, z, l, r;
ll one = 1, zero = 0, ans = 0;
ll mod = 1000000007;
ll INF = 1000000000000000000;
ll a1, a2, a3, a4, a5, a6;
string st1, st2, st3;
char ch1, ch2, ch3;

int main() {
	IO;
	ifstream fin("Text.txt");
	cin >> a >> b;
	ch1 = '.';
	ch2 = '#';
	if (b > a) {
		swap(ch1, ch2);
		swap(a, b);
	}
	vector<vector<char> >vc(100, vector<char>(100));
	a1 = a;
	i = 0; j = 0;
	while (a1) {
		if (i < 100) {
			vc[i][j] = ch1;
			a1--;
			i += 4;
		}
		else {
			i = 0;
			j += 4;
		}
	}
	f0(i, 100) {
		f0(j, 100) {
			if (vc[i][j] != ch1)
				vc[i][j] = ch2;
		}
	}
	i = 0; j = 0; a1 = b - 1;
	while (a1) {
		if (i + 2 < 100) {
			vc[i][j+1] = ch1;
			vc[i][j+2] = ch1;
			vc[i + 1][j+2] = ch1;
			vc[i + 1][j] = ch1;
			vc[i + 2][j] = ch1;
			vc[i + 2][j+1] = ch1;
			vc[i + 2][j+2] = ch1;
			a1--;
			i += 4;
		}
		else {
			i = 0;
			j += 4;
		}
	}
	cout << "100 100" << endl;
	f0(i, 100) {
		f0(j, 100) {
			cout << vc[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define FAST  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int 
#define ar array
#define pb push_back
#define fi(a,b) for(int i=a;i<(b);i++)
#define fj(a,b) for(int j=a;j<(b);j++)
#define fk(a,b) for(int k=a;k<(b);k++)
#define lb lower_bound
#define ub upper_bound
//hash base 177013


int main()
{
	FAST;
	//#ifndef ONLINE_JUDGE
	//	freopen("input.txt","r",stdin);
	//	freopen("output.txt","w",stdout);
	//#endif
	//ll testcase;
	//cin>>testcase;
	//while(testcase--)
	{
		string s,t;
		cin>>s>>t;
		int ans=1e9+7;
		fi(0,(int)s.size())
		{
			if(i+(int)t.size()>(int)s.size()) break;
			//cout<<i+t.size()<<'\n';
			string temp=s.substr(i,(int)t.size());
			//cout<<temp<<'\n';
			int count=0;
			fj(0,(int)t.size())
			{
				if(temp[j]!=t[j]) count++;
			}
			ans=min(ans,count);
		}
		cout<<ans;
	}
}


























Measured memory_bytes: 3660
// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;
#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

int main() {
    string s;
    cin >> s;
    auto rev = [&](ll i) { return (ll)s.size() - i - 1; };
    ll ans = 0;
    for(ll i = 0; i < s.size(); i++) {
        char c1 = s[i];
        char c2 = s[rev(i)];
        ans += (c1 != c2);
    }

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


Measured memory_bytes: 256
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int m[] = {0,
  31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int a, b;
  cin >> a >> b;
  int x = 1, y = 1;
  int ans = 0;
  while(1){
    if(x == y) ans++;
    if(a == x && b == y) break;
    y++;
    if(m[x] + 1 == y) y = 1, x++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))

X = [[0]*22 for i in range(n)]
for i, a in enumerate(A):
    b = format(a, 'b')
    b = list(b)
    b.reverse()
    for j in range(len(b)):
        if b[j] == '1':
            X[i][j] = 1

def is_ok(x, S):
    for j in range(22):
        if x[j] == 1:
            if j in S:
                return False
    else:
        return True

t = 0
S = set()
ans = 0
for s in range(n):
    while t < n:
        if is_ok(X[t], S):
            for j in range(22):
                if X[t][j] == 1:
                    S.add(j)
            t += 1
        else:
            break
    #print(s, t)
    ans += t-s
    if t == s:
        t += 1
    else:
        for j in range(22):
            if X[s][j] == 1:
                S.remove(j)
print(ans)


Measured memory_bytes: 141484
#include "bits/stdc++.h"
using namespace std;
#define mod 1000000007
#define all(c) begin(c),end(c)
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
using ll = long long;
using vi = vector<int>; using vs = vector<string>;
int dd[] = { 0, 1, 0, -1, 0 }; //→↓←↑

vs V;
void split(string S, char v)
{
	string s = "";
	for (int i = 0; i <= S.size(); i++)
	{
		if (i == S.size() || S[i] == v)
		{
			V.emplace_back(s);
			s = "";
		}
		else
		{
			s += S[i];
		}
	}
}
void solve()
{
	string S;
	bool B[10][10];
	while (cin >> S, S != "#")
	{
		memset(B, 0, sizeof(B));
		V.clear();
		split(S, '/');

		int H = V.size();
		int W;
		for (int i = 0; i < V.size(); i++)
		{
			int x = 0;
			for (int j = 0; j < V[i].size(); j++)
			{
				if (isdigit(V[i][j]))
				{
					x += V[i][j] - '0';
				}
				else
				{
					B[i][x] = true;
					x++;
				}
			}
			W = x;
		}
		//cout << H << " " << W << endl;

		int a, b, c, d;
		cin >> a >> b >> c >> d;
		B[--a][--b] = false;
		B[--c][--d] = true;

		for (int i = 0; i < H; i++)
		{
			int cnt = 0;
			for (int j = 0; j <= W; j++)
			{
				if (j == W)
				{
					if (cnt > 0)
					{
						cout << cnt;
					}
					if (i < H - 1)
					{
						cout << '/';
					}
				}
				else if (B[i][j])
				{
					if (cnt > 0)
					{
						cout << cnt;
					}
					cnt = 0;
					cout << 'b';
				}
				else
				{
					cnt++;
				}
			}
		}
		cout << endl;
	}
}

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


Measured memory_bytes: 3188
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include<math.h>
#include <vector>
#include<bitset>
#include<map>
using namespace std;

int main() {
	long long n; cin >> n;
	string ans = "";
	while (n > 0) {
		n--;
		ans += 'a' + n % 26;
		n /= 26;
	}
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int a[26];
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	string s;
	cin>>s;
	memset(a,0,sizeof(a)); 
	for(int i=0;i<4;i++)
	{
		a[s[i]-'A']++;
	}
	int t=1,p=0;
	for(int i=0;i<26;i++)
	{
		if(a[i]>0)
		p++;
		if(a[i]>=4)
		t=0;
	}
	if(t==0||p!=2)
	cout<<"No";
	else cout<<"Yes";
	 
	
	
	
	}
	

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

int main(){

    int N;
    cin >> N;
    vector<string> S(N);
    
    map<string,int> dic;
    for (int i = 0; i < N; i++) {
        cin >> S.at(i);
        dic[S.at(i)]++;
    }

    int maxV =0;
    for (auto di : dic) {
        maxV =max(maxV,di.second);
    }

    for (auto di : dic) {
        if(di.second == maxV){
            cout << di.first << endl;
        }
    }
}


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

int main() {
    set<string> st;
    int n;
    cin >> n;
    rep(i, n){
        string str;
        cin >> str;
        st.insert(str);
    }
    cout << st.size() << endl;
    return 0;
}

Measured memory_bytes: 19220
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
from collections import deque,Counter
# import re
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# slist = "abcdefghijklmnopqrstuvwxyz"
W = input()

count = Counter(W)
arr = np.array(list(count.values()))
arr = arr%2

ans = "Yes"
if 1 in arr:
    ans = "No"

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


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

int main() {
	int n,ans;
	cin >> n;
	int x[n],y[n],h[n];
	for (int i = 0;i < n;++i) cin >> x[i] >> y[i] >> h[i];

	for (int i = 0;i <= 100;++i) {
		for (int j = 0;j <= 100;++j) {
			bool f = true;
			for (int k = 0;k < n;++k) {
				if (h[k]) {
					ans = h[k]+abs(x[k]-i)+abs(y[k]-j);
					break;
				}
			}
			for (int k = 0;k < n;++k) {
				if (max(0,ans-abs(x[k]-i)-abs(y[k]-j)) != h[k]) {
					f = false;
					break;
				}
			}
			if (f) {
				cout << i << " " << j << " " << ans << endl;
				exit(0);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
#include<vector>
#include<cstring>
#define INF 1000000000
using namespace std;
int a,b,y=0;
unsigned long long sum=100,x;
int main(){
    cin>>x;
    for(int i=1;sum<x;i++){
        sum=sum*1.01;
        y=i;
    }
    cout<<y;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
ll n;
string s;
cin >> n >> s;
map<char, ll> mp;
for (ll i = 0; i < n; i++) mp[s[i]]++;
ll ans = 1;
for (auto i : mp) {
    ans *= (i.second+1);
    ans %= MOD;
}
cout << ans-1 << endl;
}

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

int gcd(int a ,int b) {

    if (b == 0) return a;

    return gcd(b , a % b);
    
}

int main() {

    int n;
    cin >> n;

    vector<int> A(n);

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

    vector<int> left(n + 1) ,right(n + 1);
    left[0] = 0;
    right[0] = 0;

    for (int i = 0; i < n; i++)
        left[i + 1] = gcd(left[i] , A[i]);
    
    for (int i = n; i > 0;  i--)
        right[i - 1] = gcd(right[i] , A[i - 1]);

    int res = 0;

    for (int i = 0; i < n; i++) {
        
        int l = left[i];
        int r = right[i + 1];

        res = max(res , gcd(l ,r));
    }
    
    cout << res << endl;
    
    return 0;
    
}

Measured memory_bytes: 1408
S = input()[::-1]
ans = 0
mods = [0] * 2019
mods[0] = 1
current = 0
x = 1

for s in S:
    current = (current + x * int(s)) % 2019
    ans += mods[current % 2019]
    mods[current % 2019] += 1
    x = x * 10 % 2019

print(ans)



Measured memory_bytes: 9308
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 1;
const int MAX_V = 575;

// O(|E||V|^2)
struct Edge {
  Edge(int _to, int _cap, int _rev)
    : to(_to), cap(_cap), rev(_rev) {}
  int to;
  int cap; // 容量
  int rev; // 逆辺
};

vector< Edge > G[MAX_V]; // グラフの隣接リスト表現
int level[MAX_V];        // sからの距離
int iter[MAX_V];         // どこまで調べ終わったか

// fromからtoに向かう容量capの辺グラフに追加する
void add_edge(int _from, int _to, int _cap) {
  // 頂点(_from)から行き先(_to), 容量(_cap)
  G[_from].emplace_back(Edge(_to, _cap, G[_to].size()));
  G[_to].emplace_back(Edge(_from, 0, G[_from].size() - 1));
}

// sからの最短距離をBFSで探す
void bfs(int s) {
  memset(level, -1, sizeof(level));
  queue< int > q;
  level[s] = 0;
  q.push(s);

  while (!q.empty()) {
    int from = q.front(); q.pop();
    for (int i = 0; i < G[from].size(); ++i) {
      Edge &e = G[from][i];
      if (e.cap > 0 && level[e.to] < 0) {
	level[e.to] = level[from] + 1;
	q.push(e.to);
      }
    }
  }
}


// 増加パスをDFSで探す
int dfs(int from, int to, int cost) {
  if (from == to) return cost;
  for (int &i = iter[from]; i < G[from].size(); ++i) {
    Edge &e = G[from][i];
    if (level[from] < level[e.to] && e.cap > 0) {
      int d = dfs(e.to, to, min(cost, e.cap));
      if (d > 0) {
	e.cap -= d;
	G[e.to][e.rev].cap += d;
	return d;
      }
    }
  }
  return 0;
}


// sからtへの最大流を求める
int max_flow(int s, int t) {
  int flow = 0;
  for ( ; ; ) {
    bfs(s);
    if (level[t] < 0) return flow;
    memset(iter, 0, sizeof(iter));
    int f;
    while ((f = dfs(s, t, INF)) > 0) { 
      flow += f;
    }
  }
}


int main()
{
  int V, E, u, v, c;
  cin >> V >> E;
  for (int i = 0; i < E; ++i) {
    cin >> u >> v >> c;
    add_edge(u, v, c);
  }

  cout << max_flow(0, V - 1) << endl;
  return 0;
}




Measured memory_bytes: 3124
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define int long long
#define eb emplace_back
#define ef emplace_front
#define rep(i, x, n) for (int i = x; i < n; ++i)
#define mp make_pair
#define fi first
#define se second
#define ii pair<int, int>
#define endl '\n'
#define vi vector<int>
#define vii vector<pair<int, int>>
#define reverse(s) reverse(s.begin(), s.end())
#define ld long double
#define vs vector<string>
#define inf INT_MAX
#define vc vector<char>
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define vb vector<bool>
#define lb(a, x) lower_bound(a.begin(), a.end(), x)
#define ub(a, x) upper_bound(a.begin(), a.end(), x) 
#define vvi vector<vi>
#define mine(a) min_element(a.begin(),a.end())
#define maxe(a) max_element(a.begin(), a.end())
#define iota(a,i) iota(a.begin(),a.end(),i)
#define fileopen(filename) if (fopen(filename".INP", "r")) {freopen(filename".INP", "r", stdin);freopen(filename".OUT", "w", stdout);
const int MOD = 1e9 + 7;
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}
int fact[200001];
int nCr(int n, int r){
    return fact[n] * binpow((fact[r] * fact[n - r] % MOD), MOD-2LL) % MOD;
}
signed main() {
    fastio;
    int n, m, a, b;
    cin >> n >> m >> a >> b;
    int ans = 0;
    fact[0] = fact[1] = 1;
    rep(i, 2, 200001) {
        fact[i] = fact[i - 1] * i % MOD;
    }
    rep(i, 1, a + 1) {
        ans += (nCr(n - a + i + b - 2, b - 1) * nCr(a - i + 1 + m - b - 2, a - i)) % MOD;
        ans %= MOD;
    }
    cout << (nCr(n + m - 2, n - 1) + MOD - ans) % MOD;
}

Measured memory_bytes: 5228
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

ll inf=1ll<<60,mod=1000000007;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n,a;
	cin>>n>>a;
	cout<<n*n-a;
	return 0;
}

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

typedef long long ll;   

typedef pair<ll, ll> pll;

#define mp make_pair
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define swap(a,b) {a=a^b;b=a^b;a=a^b;}
ll gcd(ll a, ll b){ return b==0 ? a : gcd(b, a%b); }


#define FILE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
                      cout << "\n\nTime elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";

ll W,n;

ll K[105][100005];
int32_t main(){

    //start_routine();
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	//FILE

    int t=1;
    ll weight;
    ll in;
    //cin >> t;
    while(t-->0){
    	cin>> n>>W;
        ll wt[n],v[n];

        fr(i,0,n-1){
            cin >> wt[i]>>v[i];
        }


        fr(i,0,n){
            fr(w,0,W){
                if(i==0||w==0)
                    K[i][w]=0;
                else if(w-wt[i-1]>=0)
                    K[i][w]=max(v[i-1]+K[i-1][w-wt[i-1]],K[i-1][w]);
                else
                    K[i][w]=K[i-1][w];
            }
        }
        cout<< K[n][W];
    }   

    //end_routine();
	return 0;
}

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

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i, n)cin >> v[i];
  sort(v.begin(), v.end());


  double result = v[0];
  for (int i = 1; i <= n - 1; i++) {
    result = (result + v[i]) / 2;
  }
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
def search(v, n, m, seq, scs):
    if len(seq) == n:
        ans = 0
        for r in scs:
            if seq[r[1]-1] - seq[r[0]-1] == r[2]:
                ans += r[3]
        return ans
    ans = 0
    for i in range(v, m+1):
        tmp = search(i, n, m, seq + [i], scs)
        ans = max(ans, tmp)
    return ans

def resolve():
    n, m, q = map(int, input().split())
    scs = [list(map(int, input().split())) for _ in range(q)]
    v = search(1, n, m, [], scs)
    print(v)
resolve()

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


bool roop(vector<int> vec, int k) {
  for (int i = 0; i < 5; i++) {
    for (int j = i + 1; j < 5; j++) {
      if (k < vec.at(j) - vec.at(i)) return false;
    }
  }
  return true;
}

int main() {
  int k;
  vector<int> vec(5);
  for (int i = 0; i < 5; i++) {
    cin >> vec.at(i);
  }
  cin >> k;
  if (roop(vec, k)) cout << "Yay!" << endl;
  else cout << ":(" << endl;
}


Measured memory_bytes: 3560
import java.util.*;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int v = sc.nextInt();
        int e = sc.nextInt();
        int r = sc.nextInt();
        int[][][] g = buildDirectedWeightedGraph(sc, v, e);
        long[] d = dijkstra(v, g, r);
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < v; i++) {
            sb.append(d[i] == Long.MAX_VALUE ? "INF" : d[i]).append("\n");
        }
        System.out.print(sb.toString());
        sc.close();

    }

    public static int[][][] buildDirectedWeightedGraph(Scanner sc, int n, int m) {
        int[][][] graph = new int[n][][];
        int[][] edges = new int[m][3];
        int[] deg = new int[n];
        for (int i = 0; i < m; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();
            edges[i][0] = a;
            edges[i][1] = b;
            edges[i][2] = c;
            deg[a]++;
        }
        for (int i = 0; i < n; i++) {
            graph[i] = new int[deg[i]][2];
        }
        for (int i = 0; i < m; i++) {
            int a = edges[i][0];
            int b = edges[i][1];
            int c = edges[i][2];
            graph[a][--deg[a]] = new int[]{b, c};
        }

        return graph;
    }


    public static long[] dijkstra(int n, int[][][] graph, int s) {
        // {sからの最短距離, 頂点}
        PriorityQueue<long[]> pq = new PriorityQueue<long[]>((x, y) -> Long.compare(x[0], y[0]));
        long[] d = new long[n]; // sからの最短距離
        Arrays.fill(d, Long.MAX_VALUE);
        d[s] = 0;
        pq.add(new long[] { 0, s });
        while (!pq.isEmpty()) {
            long[] a = pq.poll();
            int v = (int) a[1];
            if (d[v] < a[0])
                continue;
            for (int[] g : graph[v]) {
                int to = g[0];
                int cost = g[1];
                if (d[to] > d[v] + cost) {
                    d[to] = d[v] + cost;
                    pq.add(new long[] { d[to], to });
                }
            }
        }

        return d;
    }
}



Measured memory_bytes: 315648
program christmas_eve_eve_eve
  implicit none
  integer :: d
  read(*,*) d
  write(*,'(a)',advance='no') "Christmas"
  d = 25-d
  do while (d > 0)
    write(*,'(a)',advance='no') " Eve"
    d = d-1
  end do
  write(*,*)
end program christmas_eve_eve_eve

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cstring>
#include<queue>
using namespace std;
int main(void)
{
	long long a,b,c,d,x,mx;
	scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
	mx=a*c;
	mx=max(mx,a*d);
	mx=max(mx,b*c);
	mx=max(mx,b*d);
	printf("%lld\n",mx);
	return 0;
}


Measured memory_bytes: 1732
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
 
using namespace std;
using ll = long long;
 
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RREP(i, n) for(int i = n - 1; i >= 0; i--)
#define REP2(i, n, k) for(int i = 0; i < n; i += k)


int main()
{
    int h, w, k = 0;
    string s[10];

    cin >> h >> w;
    REP(i, h){
        cin >> s[i];

        REP(j, w){
            if(s[i][j] == '#')k++;
        }
    }

    if(k == h + w - 1) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
}

Measured memory_bytes: 256
N, M = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
X.sort()

diffList = [X[i+1] - X[i] for i in range(M - 1)]
diffList.sort()

ans = 0
if N - M < 0:
    ans += sum(diffList[:M - N])

print(ans)


Measured memory_bytes: 13840
#include<iostream>
#include<stdlib.h>
#include<algorithm>
#include<vector>
using namespace std;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    float sum = (a+b+c)/2.0;
    if ((sum-a)*(sum-b)*(sum-c)==0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;


}


Measured memory_bytes: 764
///Bismi Allahi arrahmani arraheem

///author : I_HAVE_NO_LOGIC
///6.26.2020

#include<bits/stdc++.h>
#define cy cout << "Yes" << endl;
#define cn cout << "No" << endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main(){

 int a,b,c,d,e,i;
string s,s1;
cin >>s >> s1;
int m=0;
for(i=0;i<s.length();i++)
{
    if(s[i]!=s1[i])
    {
        m++;
    }
}
cout << m << endl;





}


Measured memory_bytes: 3916
n, k=map(int, raw_input().split())
a=map(int, raw_input().split())
def gcd(a, b):
	return gcd(b, a%b) if b else a
g=0
for i in range(n):
	g=gcd(g, a[i])
print "IMPOSSIBLE" if k%g!=0 or k>max(a) else "POSSIBLE"

Measured memory_bytes: 11320
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
using namespace std;

long long f(long long a, long long b){
  string sa = to_string(a);
  string sb = to_string(b);
  long long x = max(sa.size(), sb.size());
  return x;
}

int main(){
  long long n;
  cin >> n;
  
  bool is_prime;
    if(n == 2){ is_prime = true; }
    else if(n < 2 || n % 2 == 0){ is_prime = false; }
    else{
        int i = 3;
        while(i <= sqrt(n)){
            if(n % i){ is_prime = false; break;}
            i += 2;
        }
    }
  if(is_prime){
    cout << f(n, 1) << endl;
  }
  else{
    long long x = 11;
  for(long long i = 1; i <= pow(n, 0.5); i++){
    if(n % i == 0){
      long long k;
      k = f(i, n / i);
      if(x > k){ x = k;}
    }
  }
  cout << x << endl;
  }
}

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

typedef long long ll;
const ll INF=1e18;

int main(){
    ll N,C; cin >> N >> C;
    vector<pair<ll,ll>> s(N+2);
    s[0]={0,0};
    s[N+1]={C,0};
    for(int i=1;i<=N;i++){
        ll x,c; cin >> x >> c;
        s[i]=make_pair(x,c);
    }
    sort(s.begin(),s.end());
    vector<ll> r(N+10,0);
    vector<ll> l(N+10,0);
    for(int i=1;i<=N;i++){
        r[i]=r[i-1]-(s[i].first-s[i-1].first)+s[i].second;
        l[i]=l[i-1]-abs(s[N+2-i].first-s[N+1-i].first)+s[N+1-i].second;
    }
    ll ans=0;
    for(int i=1;i<=N;i++){
        r[i]=max(r[i],r[i-1]);
        l[i]=max(l[i],l[i-1]);
        //cout << r[i] << endl;
        //cout << l[i] << endl;
        //cout << endl;
        ans=max(ans,max(r[i],l[i]));
    }
    for(int i=1;i<=N;i++){
        ans=max(ans,r[i]-s[i].first+l[N-i]);
    }
    for(int i=1;i<=N;i++){
        ans=max(ans,l[i]-(C-s[N+1-i].first)+r[N-i]);
    }
    cout << ans << endl;
}

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

int main()
{
    int n;
    cin >> n;
    int p[52];
    int c = 0;
    for(int i = 0; i < n; i++){
        cin >> p[i];
        p[i]--;
        if(i != p[i]) c++;
    }
    if(c <= 2) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

//奇数
bool JudgeOdd(char s) {
    if ((s == 'R')||(s == 'U')||(s == 'D')) return true;
    else return false;
}
//偶数
bool JudgeEven(char s) {
    if ((s == 'L')||(s == 'U')||(s == 'D')) return true;
    else return false;
}


int main() {
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++) {
        if((i+1)%2 == 1) {
            if(!JudgeOdd(s.at(i))){
                cout << "No" << endl;
                return 0;
            }
        } else {
            if(!JudgeEven(s.at(i))){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
def gcd(a,b):
    x,y=max(a,b),min(a,b)
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)
N=int(input())
A=[int(i) for i in input().split()]
ans=A[0]
for i in range(1,N):
    ans=gcd(ans,A[i])
print(ans)


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

int main()
{
  char c[3][3];
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      cin >> c[i][j];
      if(i == j) cout << c[i][j];
    }
  }

  cout << endl;

  return 0;

}


Measured memory_bytes: 256
import heapq

H, W = [int(_) for _ in input().split()]
C = [[int(_) for _ in input().split()] for _ in range(10)]

Distance = [0] * 10

for p in range(10):
    q = p
    D = [float('inf')] * 10
    D[p] = 0
    HEAP = []
    d = 0
    c = 0
    while True:
        if p == 1:
            break
        for i in range(10):
            if D[i] == float('inf'):
                heapq.heappush(HEAP, (d + C[p][i], i))
        d, p = heapq.heappop(HEAP)
        D[p] = d
    Distance[q] = d
print(
    sum([
        sum([Distance[int(_)] for _ in input().split() if int(_) > -1])
        for _ in range(H)
    ]))


Measured memory_bytes: 3064
A, B, C, X, Y = map(int, input().split())
ret = A * X + B * Y
x = 0
y = 0
c = 0
while (X + Y) * 2 > c :
    c += 2
    x += 1
    y += 1
    ret = min(ret, A * max(0, X - x) + B * max(0, Y - y) + c * C)
print(ret)


Measured memory_bytes: 9188
#include <iostream>
#include <vector>
#include <stdio.h>
#include <string>
#include <stdlib.h>

using namespace std;

int main(void){
//	FILE* fp_in = freopen("data.txt", "r", stdin);

	int n;
	string s;
	getline(cin, s);
	n = atoi(s.c_str());

	for(int i = 0; i < n; i++) {
		string str;
		getline(cin, str);
		for(int j = 0; j + 6 < str.length(); j++) {
			string sub;
			sub = str.substr(j, 7);
			if( sub == "Hoshino" )
				str[j + 6] = 'a';

			
		}
		cout << str << endl;
	}
	
 
//	while (1){}
	return 0;
}

Measured memory_bytes: 1204