akhauriyash/Code-Regression huggingface dataset:
//参考：https://qiita.com/DaikiSuyama/items/9dba963ba74396b9b7fd
//インクルード(アルファベット順)
#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 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 FIR first    //pairの一つ目の要素
#define SEC second   //pairの二つ目の要素

signed main()
{
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll X;
    cin >> X;

    if (X >= 30)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3052
#include<iostream>

using namespace std;

int main(){
    
    int k;
    int cnt = 0;

    cin >> k;

    for(int i = 1; i <= k; i++){
        for(int j = i; j <= k; j++){
            if(i % 2 == 1 && j % 2 == 0) cnt++;
            if(i % 2 == 0 && j % 2 == 1) cnt++;
        }
    }

    cout << cnt << endl;
    
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int count=0;
  for(int k = 1; n/k > 0; k *= 10)count++;
  if(count==1)cout << n << endl;
  else if(count==2)cout << 9 << endl;
  else if(count==3)cout << 9+(n-99) << endl;
  else if(count==4)cout << 909 << endl;
  else if(count==5)cout << 909+(n-9999) << endl;
  else if(count==6)cout << 90909 << endl;
}


Measured memory_bytes: 256
import collections
import sys

readline = sys.stdin.buffer.readline


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    C = 10**9 + 7

    d = collections.defaultdict(list)

    for a in A:
        B = factorization(a)
        for b in B:
            d[b[0]].append(b[1])
    e = 1
    for k, v in d.items():
        e *= k**max(v)

    ans = 0
    for a in A:
        ans += (e // a)
    print(ans % C)


main()


Measured memory_bytes: 47580
N, K = map(int, input().split())
Xs = list(map(int, input().split()))

global_min = float('inf')
for i in range(N-K+1):
    left = i
    right = i+K-1
    #print(left, right)

    if 0 <= Xs[left]:
        local_min = Xs[right]
    elif Xs[right] <= 0:
        local_min = abs(Xs[left])
    else: # 先にマイナス側に行く場合と、先にプラス場合に行く場合がある。
        tmp1 = 2 * abs(Xs[left]) + Xs[right]
        tmp2 = abs(Xs[left]) + 2 * Xs[right]
        local_min = min(tmp1, tmp2)

    global_min = min(global_min, local_min)

if global_min == float('inf'):
    print(0)
else:
    print(global_min)


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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug(x) cout<<#x<<" = "<<x<<endl;

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

void solve()
{
    li n;

    cin>>n;

    cout<<n*n*n;
}

int main()
{    
    

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

    li t=1;

    // cin>>t;

    while(t--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

//double cross(double x1,double y1,double x2,double y2)
//{
//	return x1*y2-x2*y1;
//}
#define cross(x1,y1,x2,y2) (x1)*(y2)-(x2)*(y1)

int ccw(double x1,double y1,double x2,double y2,double x3,double y3)
{
	return cross(x2-x1,y2-y1,x3-x1,y3-y1)>=0;
}

int main()
{
	for(double x,y,a,b,n,m,p,q;scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x,&y,&a,&b,&n,&m,&p,&q)==8;){
		int counter=0;
		//counter+=(p-x)*(b-y)-(q-y)*(a-x)>0;
		//counter+=(p-a)*(m-b)-(q-b)*(n-a)>0;
		//counter+=(p-n)*(y-m)-(q-m)*(x-n)>0;
		//counter+=cross(a-x,b-y,p-x,q-y)>=0;
		//counter+=cross(n-a,m-b,p-a,q-b)>=0;
		//counter+=cross(x-n,y-m,p-n,q-m)>=0;
		counter+=ccw(x,y,a,b,p,q);
		counter+=ccw(a,b,n,m,p,q);
		counter+=ccw(n,m,x,y,p,q);
		
		cout<<(counter%3==0?"YES":"NO")<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <stdlib.h>
#define N 100

void DFS(int);

int count=1,d[N+1],f[N+1],arr[N+1][N+1],
n;

int main(){
  int i,j,m,node,num;

  scanf("%d",&n);
  if(n<1 || n>N) exit(2);
    f[0]=d[0]=0;
  for(i=0;i<n;i++){
    f[i+1]=d[i+1]=0;
    scanf("%d %d",&node,&num);
    for(j=0;j<num;j++){
      scanf("%d",&m);
      arr[node][m]=1;
    }
  }

  DBF(1);
  for(i=1;i<=n;i++){
    if(d[i] == 0){
      count++;
      DBF(i);
    }
    printf("%d %d %d\n",i,d[i],f[i]);
  }
   
  return 0;
}

void DBF(int x){
  int i,j;
  
  d[x]=count;
  for(i=1;i<=n;i++){
    if(arr[x][i]==1 && d[i] == 0){
      count++;
      DBF(i);
    }
  }
  
  count++;
  f[x]=count;
}



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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define RFOR(i,a,b) for(long i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;

char c;
int main() {
    std::cin >> c;
    bool f = c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';
    std::cout << ( f ? "vowel" : "consonant" ) << std::endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))


SINT32 main() {
    SINT32 a;
    scanf("%d",&a);

    SINT32 r = 0;
    SINT32 b = 0;

    
    SINT8 s[200001] = {'0'};
    scanf("%s",s);

    for (SINT32 i = 0; i < a; i++) {
        if (s[i] == 'R') {
            r++;
        } else {
            b++;
        }
    }

    if (r > b) {
printf("Yes");
    } else {
printf("No");
    }

    
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
#define MOD2 (998244353)
#define MOD3 (1000000009)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
ifstream cinn("ride.in");ofstream coutt("ride.out");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a+b-1)/b;}
////Read:
//Check corner cases, n==1;
//
////Some function:
//__builtin_popcountll(), 

string l;
int n,dp[100005][2];

int f(int i,int tight){
    if(i==n)return 1;
    int &ans=dp[i][tight];
    if(ans!=-1)return ans;
    if(tight){
        ans=3*f(i+1,1)%MOD;
    }else{
        if(l[i]=='0')ans=f(i+1,0)%MOD;
        else ans=(2*f(i+1,0)+f(i+1,1))%MOD;
    }
    return ans;
}

signed main(){
    FASTER;
    memset(dp,-1,sizeof dp);
    cin>>l;
    n=l.size();
    cout<<f(0,0);
}

Measured memory_bytes: 8468
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;


int main() {
  int k, x;
  cin >> k >> x;
  k *= 500;
  string ans = (k >= x ? "Yes": "No");
  cout << ans << endl;
  return 0;
}

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

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


Measured memory_bytes: 256
H, W = map(int, input().split())

if H % 3 == 0 or W % 3 == 0 :
    print('0')
else :
    ans = min(W, H)
    for a1 in [W // 3, -(-W // 3)] :
        for a2 in [H // 2, -(-H // 2)] :
            A1 = a1 * H
            A2 = a2 * (W - a1)
            A3 = H * W - A1 - A2
            ans = min(ans, max(A1, A2, A3) - min(A1, A2, A3))
    for a1 in [H // 3, -(-H // 3)] :
        for a2 in [W // 2, -(-W // 2)] :
            A1 = a1 * W
            A2 = a2 * (H - a1)
            A3 = H * W - A1 - A2
            ans = min(ans, max(A1, A2, A3) - min(A1, A2, A3))
    print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#define MAX 100
#define WHITE 0
#define BLACK 2
#define GRAY 1

int n, M[MAX][MAX];

int prim(void);

int main()
{
  int i, j;

  scanf("%d", &n);

  for(i=0; i<n; i++) {
    for(j=0; j<n; j++) {
      scanf("%d", &M[i][j]);
      if(M[i][j] == -1)
        M[i][j] = 2001;
    }
  }

  printf("%d\n", prim());

  return 0;
}

int prim(void)
{
  int i, u, minv, v, sum=0;
  int d[MAX], p[MAX], color[MAX];

  for(i=0; i<n; i++) {
    d[i] = 2001;
    p[i] = -1;
    color[i] = WHITE;
  }

  d[0] = 0;

  while(1) {
    minv = 2001;
    u = -1;
    for(i=0; i<n; i++) {
      if(minv>d[i] && color[i]!=BLACK) {
        u = i;
        minv = d[i];
      }
    }
    if(u==-1) break;
    color[u] = BLACK;
    for(v=0; v<n; v++) {
      if(color[v]!=BLACK && M[u][v]!=2001) {
        if(d[v]>M[u][v]) {
          d[v] = M[u][v];
          p[v] = u;
          color[v] = GRAY;
        }
      }
   }
  }
  sum = 0;
  for(i=0; i<n; i++) {
    if(p[i]!=-1) sum += M[i][p[i]];
  }

  return sum;
}

Measured memory_bytes: 636
#include <iostream>
#include <bits/stdc++.h>
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define INF 1000000000
#define MOD 1000000007
#define M 998244353
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ll long long
#define endl "\n"
#define fori(i, a, b) for(i=a; i<b; i++)
#define ford(i, a, b) for(i=a; i>b; i--)
using namespace std;
const ll N = 500043;
ll fact[N];
ll add(ll x, ll y)
{
	x += y;
	while(x >= MOD) x -= MOD;
	while(x < 0) x += MOD;
	return x;
}
ll mul(ll x, ll y)
{
	return (x * 1ll * y) % MOD;
}
ll mulmod(ll a, ll b)
{
    ll res = 0;
    a = a % MOD;
    while (b>0)
    {
        if (b % 2 == 1)
            res = (res + a) % MOD;
        a = (a * 2) % MOD;
        b /= 2;
    }
    return res % MOD; 
}
ll binpow(ll x, ll y)
{
	ll z = 1;
	while(y > 0)
	{
		if(y % 2 == 1)
			z = mul(z, x);
		x = mul(x, x);
		y /= 2;
	}
	return z;
}
ll inv(ll x)
{
	return binpow(x, MOD - 2);
}
ll divide(ll x, ll y)
{
	return mul(x, inv(y));
}
void precalc()
{
	fact[0] = 1;
	ll i;
	fori(i, 1, N)
		fact[i] = mul(i, fact[i - 1]);
}
ll C(ll n, ll k)
{
	if(k > n)
	    return 0;
	return divide(fact[n], mul(fact[n - k], fact[k]));
}

ll solve()
{
    ll i, ans=0;
    string s, t;
    cin >> s >> t;
    ll n = s.length();
    fori(i, 0, n)
    {
        if(s[i]!=t[i])
            ans++;
    }
    
    
    return ans;
}

int main()
{
    io
    int t;
    t=1;
    // cin >> t;
    while(t--)
        cout << solve() << endl;
        // solve();
    return 0;
}

Measured memory_bytes: 3800
import java.util.*;

public class Main {
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();

        if(s.length() + 1 == t.length() && t.startsWith(s)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}

Measured memory_bytes: 35684
//  LINK ZADATKA:http://abc070.contest.atcoder.jp/tasks/abc070_b
 
#include <queue>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <fstream>
#include <cstring>
#include <string>
#include <climits>

using namespace std;

typedef long long ll;
typedef complex<double> point;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;


#define FOR(k,a,b) for(int k=(a); k<=(b); ++k)
#define REP(k,a) for(int k=0; k<(a);++k)
#define SZ(a) int((a).size())
#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define INF 999999999
#define INFLONG 1000000000000000000
#define MOD 1000000007
#define MAX 100
#define ITERS 100
#define MAXM 200000
#define MAXN 1000000
#define _gcd __gcd
#define eps 1e-9
int polje[1100];
int main(){
	int a, b, c, d;

	scanf("%d %d %d %d", &a, &b, &c, &d);
	FOR(i, a, b) polje[i]++;
	FOR(i, c, d) polje[i]++;
	int sol = 0;
	FOR(i, 0, 100){
		//printf("%d ", polje[i]);
		if(polje[i] == 2) sol++;
	}
	//printf("%d %d\n", start, end);
	if(sol == 0) printf("%d", sol);
	else printf("%d\n", sol-1);
}

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

using namespace std;

#define ll long long
#define MOD 1000000007
#define INF 2000000000
#define LINF 9000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define du(x) cout<<#x<<'='<<x<<endl
#define du2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define du3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl
#define ddarr(arr,a,b) rep(i,a){rep(j,b){cout<<*(arr+i*b+j)<<' ';}cout<<endl;}
#define ddd ifstream in("Text.txt");cin.rdbuf(in.rdbuf());


int main() {
    ll N;
    cin >> N;
    ll n = N;
    ll ans = 0;
    int ch = 1;
    for (ll m = 1; m < 20000000; m++) {
        ll x = N / m - 1;
        if (x == 0)break;
        if (n / x == n % x) {
            ans += x;
        }
    }
    cout << ans << endl;

}


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

int main(){
  int A,B,C,D;
  int temp;
  cin >>temp;

  D=temp%10;
  temp=temp/10;
  C=temp%10;
  temp=temp/10;
  B=temp%10;
  temp=temp/10;
  A=temp;
  
  if(A+B+C+D==7){
    cout<<A<<"+"<<B<<"+"<<C<<"+"<<D<<"=7"<<endl;
    return 0;
  }
  if(A-B+C+D==7){
    cout<<A<<"-"<<B<<"+"<<C<<"+"<<D<<"=7"<<endl;
        return 0;
  }
  if(A+B-C+D==7){
    cout<<A<<"+"<<B<<"-"<<C<<"+"<<D<<"=7"<<endl;
        return 0;
  }
  if(A-B-C+D==7){
    cout<<A<<"-"<<B<<"-"<<C<<"+"<<D<<"=7"<<endl;
        return 0;
  }
  if(A+B+C-D==7){
    cout<<A<<"+"<<B<<"+"<<C<<"-"<<D<<"=7"<<endl;
        return 0;
  }
  if(A-B+C-D==7){
    cout<<A<<"-"<<B<<"+"<<C<<"-"<<D<<"=7"<<endl;
        return 0;
  }
  if(A+B-C-D==7){
    cout<<A<<"+"<<B<<"-"<<C<<"-"<<D<<"=7"<<endl;
        return 0;
  }
  if(A-B-C-D==7){
    cout<<A<<"-"<<B<<"-"<<C<<"-"<<D<<"=7"<<endl;
        return 0;
  }
      return 0;
}

Measured memory_bytes: 256
/*Raihan Kabir
  University of Chittagong
  Bangladesh
  */
#include<iostream>
#include<vector>
#include<set>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<array>
using namespace std;
typedef long long ll;
#define endl '\n'
const int m = 2e5+50;
int cnt[m];
int main(){
    int n;
    cin>>n;
    vector<int> b;
    for( int i=1; i<n; i++){
        int a;
        cin>>a;
        b.push_back(a);
        cnt[a]++;
        }
    for( int i=1;i<=n;i++){
        cout<< cnt[i] <<endl;;
    }
    return 0;
}


Measured memory_bytes: 5024
nyu=input()
nyu=nyu.split()
N=int(nyu[0])
M=int(nyu[1])
list=[]
for i in range(N):
    list.append(0)
for i in range(M):
    nyu=input()
    nyu=nyu.split()
    a=int(nyu[0])
    b=int(nyu[1])
    list[a-1]+=1
    list[b-1]+=1
for i in range(N):
    print(list[i])


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Rep(i, N) for(int i = 0; i < N; i++)
#define Reps(i, x, N) for(int i = x; i < N; i++)

inline int llabs(int n) { return n < 0 ? -n : n; }

signed main()
{
  int N, A, B;
  int V[55];
  int ans = 0;
  
  cin >> N >> A >> B;

  Rep(i, N) cin >> V[i];

  sort(V, V + N, greater<int>());
  
  int val = V[0];
  int p = 0;
  while(p < N && V[p] == val) p++;
  bool flag = true;
  int x = A;
  while(flag || (x <= B && x <= p)) {

    int cnt = count(V, V + N, V[x - 1]);
    //cout << cnt << endl;
    int i = 0;
    while(V[x - 1] != V[i]) i++;

    int choice = x - i;
    int j = 2;
    val = 1;
    for(i = 0; i < choice; i++, cnt--) {
      val *= cnt;
      while(!(val % j) && j <= choice) {
	val /= j; j++;
      }
    }
    
    ans += val;
    //cout << val << " " << j << endl;
    x++, flag = false;
  }

  int sum = 0;
  Rep(i, A) sum += V[i];
  printf("%f\n",(double)sum / A);
  cout << ans << endl;

  return 0;
}
  

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

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

    int max = 0, sum = 0, l;
    for (int i = 0; i < n; i++) {
        cin >> l;
        max = l > max ? l : max;
        sum += l;
    }

    cout << ((sum-max > max) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
import fractions
n = int(input())
t = []
for _ in range(n):
    t.append(int(input()))
l = []
ans = t[0]
for i in range(1, n):
    if t[i] in l: continue
    else:
        l.append(t[i])
        ans = ans * t[i] // fractions.gcd(ans, t[i])
print(ans)

Measured memory_bytes: 5560
import sys
from functools import reduce

N, x = list(map(int, input().split()))
arr = list(map(int, input().split()))

cnt, prv = 0, 0

for i in range(N):
    diff = max(arr[i] + prv - x, 0)
    cnt += diff
    arr[i] -= diff
    prv = arr[i]

print(cnt)


Measured memory_bytes: 14684
#include <bits/stdc++.h>
using namespace std;
#define REP(i, t) for(int i = 0; i < t; i++)
#define PR_MAX 10010

int main()
{
    string A[55], B, tmp_comp, tmp_input;
    int N, M;
    cin >> N >> M;
    REP(i, N) cin >> A[i];
    REP(i, M) cin >> tmp_input, B += tmp_input;

    for (int i = 0; i <= N - M; i++) for (int j = 0; j <= N - M; j++)
    {
        tmp_comp.clear();
        for (int k = 0; k < M; k++)
        {
            tmp_comp += A[k + j].substr(i, M);
        }
        if (tmp_comp == B) {cout << "Yes"; return 0;}
    }
    cout << "No";

    return 0;
}


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

using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7;

ll k;
vector<vector<int>> graph;
vector<bool> visited;

vector<ll> fact;

void init_fact(int n) {
    fact = vector<ll>(n);
    fact[0] = 1;
    for (int i = 1; i < n; i++) fact[i] = fact[i - 1] * i % MOD;
}

ll calc_pow(ll x, ll pow) {
    if (pow == 0) return 1;
    ll a = calc_pow(x, pow / 2);
    a = a * a % MOD;
    if (pow % 2 == 1) a *= x;
    return a % MOD;
}

ll calc_div(ll a, ll b) {
    return a * calc_pow(b, MOD - 2) % MOD;
}

ll calc(int nowv, int depth) {
    int notVisited = 0;
    for (auto nextv:graph[nowv]) {
        if (visited[nextv])continue;
        notVisited++;
    }

    ll remainColor = k - min(2, depth);
    ll ret = -1;
    if (remainColor < notVisited)ret = 0;
    else ret = calc_div(fact[remainColor], fact[remainColor - notVisited]);

    for (auto nextv:graph[nowv]) {
        if (visited[nextv])continue;
        visited[nextv] = true;
        ret *= calc(nextv, depth + 1), ret %= MOD;
    }
    return ret;
}

int main() {
    int n;
    cin >> n >> k;
    graph = vector<vector<int>>(n);
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        graph[a].push_back(b), graph[b].push_back(a);
    }

    init_fact(1000000);
    visited = vector<bool>(n), visited[0] = true;
    cout << k * calc(0, 1) % MOD << endl;
    return 0;
}

Measured memory_bytes: 18176
// {{{ Template
// Author:  wenxing
// Date:    2018-01-07 20:01 +0800
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, l, r) for (int i = l; i < r; ++i)
#define per(i, r, l) for (int i = r; i >= l; --i)
#define repv(ele, vec) for (auto &ele : vec)
#define zero(mem) memset(mem, 0, sizeof(mem))
#define sd(_) scanf("%d", &_)
#define sdd(_, __) scanf("%d%d", &_, &__)
#define sddd(_, __, ___) scanf("%d%d%d", &_, &__, &___)
#define sdddd(_, __, ___, ____) scanf("%d%d%d%d", &_, &__, &___, &____)

#define sf(_) scanf("%f", &_)
#define sff(_, __) scanf("%f%f", &_, &__)
#define sfff(_, __, ___) scanf("%f%f%f", &_, &__, &___)
#define sffff(_, __, ___, ____) scanf("%f%f%f%f", &_, &__, &___, &____)

#define sl(_) scanf("%ld", &_)
#define sll(_, __) scanf("%ld%ld", &_, &__)
#define slll(_, __, ___) scanf("%ld%ld%ld", &_, &__, &___)
#define sc(_) scanf("%c", &_)
#define ss(_) scanf("%s", _)
#define mid(a, b) (((a) + (b)) >> 1)
#define lft(x) x << 1
#define rht(x) x << 1 | 1
#define inf 0x3f3f3f3f
#define mod 19260817
#define mp make_pair
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
// }}}

// - Pseudocode -

// {{{ Global Variables
// }}}

int main() {
    char s[20];
    ss(s);
    s[3] = '8';
    printf("%s\n", s);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define pint pair<lli,lli>
#define Lower(v,X) lower_bound(v.begin(),v.end(),X)-v.begin();
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
  lli A,B,C,D,E,L,R,X,Y,W,H,N,M,K,sum=0,num=0,flag=0;string S,T;
  cin >> N >> K;
  rep(i,0,N){
    cin >> X;
    if(X>K-1)sum++;
  }
  Out(sum);
}

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

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (int &ai: a) cin >> ai;
    int q; cin >> q;
    while (q--) {
        int com, b, e; cin >> com >> b >> e;
        if (com == 0) {
            cout << *min_element(a.begin() + b, a.begin() + e) << endl;
        } else if (com == 1) {
            cout << *max_element(a.begin() + b, a.begin() + e) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int count =0;
    cin>>s;
    string ans="AC";
    if(s[0]!='A')
    {
        ans="WA";
    }
    int a=s.length();
    for(int i=1;i<a;i++)
    {
        if(isupper(s[i]))
        {
            if(i==1|| i==a-1||s[i]!='C')
            {
                ans="WA";
            }
            count++;
        }
    }

    if(count!=1)
    {
       ans= "WA";
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define M 1000010

int main(){
	IOS;
	ll n,d;cin>>n>>d;
	d=2*d+1;
	ll ans;
	if(n%d==0)ans=n/d;
	else ans=n/d+1;
	cout<<ans;
	
	
	return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Tue Mar  5 22:41:58 2019

@author: yuta
"""
from collections import Counter
N = int(input())
A = [list(map(int,input().split())) for _ in range(N)]

def main(n,a):
    b = []
    for j in range(n):
        b.append(a[j][0])
        
    count = 0
    c = Counter(b)
    b_new = list(set(b))
    for i in range(len(c)):
        if c[b_new[i]] % 2 != 0:
            count += 1
    print(count)
main(N,A)

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

int x[9999],y,n,q,r;

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x[i];
	}
	cin>>q;
	for(int i=0;i<q;i++){
		cin>>y;
		for(int j=0;j<n;j++){
			if(y==x[j]){
				r++;
				break;
			}
		}
	}
	cout<<r<<endl;
	return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))


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

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

int main() {
  int n,count=1; cin >> n;
  for(int i=0;i<=25;i++) {
    for (int j=0;j<=14;j++) {
      if(n==(4*i)+(7*j)) {
        count--;
      }
    }
  }
 if(count==1)  {
  cout << "No" << endl;
 }
  else {
    cout << "Yes" << endl;
}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();

		System.out.println(Math.abs(c - a) <= d || Math.abs(b - a) <= d && Math.abs(c - b) <= d ? "Yes" : "No");
	}
}

Measured memory_bytes: 35660
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int num[4];
  for(int i = 0; i < 4; i++){
    num[i] = n%10;
    n -= num[i];
    n /= 10;
   // cout << num[i] << endl;
  }

  for(int i = -1; i <= 1; i++)
  for(int j = -1; j <= 1; j++)
  for(int k = -1; k <= 1; k++){
    if(i != 0 && j != 0 && j != 0){
      int res = num[3] + num[2]*i + num[1]*j + num[0]*k;
      if(res == 7){
        string op1, op2, op3;
        op1 = (i == 1)? "+" : "-";
        op2 = (j == 1)? "+" : "-";
        op3 = (k == 1)? "+" : "-";
        cout << num[3] << op1 << num[2] << op2 << num[1] << op3 << num[0] << "=7" <<endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  int N; cin >> N;
  cout << 0 << endl;
  string s; cin >> s;
  if(s[0] == 'V') return 0;
  if(N <= 20) {
    FOR(i,1,20) {
      cout << i << endl;
      cin >> s;
      if(s[0] == 'V') return 0;
    }
  }
  bool male = s[0] == 'M';
  int l = 0, r = N;
  FOR(i, 0, 19) {
    int cen = (l + r) / 2;
    cout << cen << endl;
    cin >> s;
    if(s[0] == 'V') return 0;
    // male と同じなら左にある
    if(cen % 2 == 0) {
      if(male ^ (s[0] == 'M')) {
        r = cen; // 違うなら時計方向
      } else {
        l = cen; // 同じなら反時計回り方向
      }
    }
    // maleと違うなら左にある 
    else {
      if(male ^ (s[0] == 'M')) {
        l = cen;
      } else {
        r = cen;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 852
s = gets.chomp

sum = s.to_i

if s.length == 1
	puts s
	exit
end


(s.length-1).times{|i|
	((1..(s.length - 1)).to_a).combination(i+1){|combi|
		temp = s.dup
		combi.reverse.each{|j|
			temp = temp.insert(j, "+")
		}
		sum += eval(temp)
	}
}
puts sum

Measured memory_bytes: 2044
n, Y = [int(s) for s in input().split(' ')]
 
for x in range(n, -1, -1):
    for y in range(n-x, -1, -1):
        z = n-x-y
        if Y == x*10000+y*5000+z*1000:
            print('{} {} {}'.format(x, y, z))
            exit()
            
print('-1 -1 -1')

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

int main()
{
	
	int i,X,N,A[100],s=0,y=0,j,b=0,l=0;


   #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
   #endif 

 cin>>X>>N;

  	for(i=0;i<N;i++)
  		cin>>A[i];
   
    s= abs(X) ;
    

   for(j=0;j<=101;j++)
  	{  b=0;
        for(i=0;i<N;i++)
        {
        	if(j==A[i])
        		b=1;
        }

        if(b==1)
        continue;

        y=abs(X-j);
       // cout<<j<<" "<<y<<" "<<s<<endl;
        if(y<s)
        {	s=y;
          l=j;
       // cout<<j<<" "<<s<<endl;
        }
    }
      cout<<l;
  
 } 	


Measured memory_bytes: 3624
N, M = map(int, input().split())

query = [list(map(int, input().split())) for i in range(M)]

bind = [-1 for i in range(N)]

for s, c in query:
    if bind[s-1] == -1:
        bind[s-1] = c
    else:
        if bind[s-1] != c:
            print(-1)
            exit()
ans = 0
for i, b in enumerate(bind):
    ans *= 10
    if b == -1:
        if i == 0 and N != 1:
            ans += 1
        else:
            ans += 0
    else:
        if i == 0 and b == 0 and N != 1:
            print(-1)
            exit()
        ans += b
print(ans)


Measured memory_bytes: 3188
N = 10
H, W = map(int, input().split())
g = [list(map(int, input().split())) for _ in range(N)]
A = [list(map(int, input().split())) for _ in range(H)]
for h in range(N):
    for w in range(N):
        if g[h][w] == 0:
            g[h][w] = float('inf')

for k in range(N):
    for i in range(N):
        for j in range(N):
            g[i][j] = min(g[i][j], g[i][k]+g[k][j])

ans = 0
for h in range(H):
    for w in range(W):
        if abs(A[h][w]) != 1:
            ans += g[A[h][w]][1]

print(ans)


Measured memory_bytes: 73824
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=(int)1e9+7;
		static void Main(){
		Sc sc=new Sc();
		int n=sc.I;
		int[] a=sc.Ia;
		int sum=a.Sum();
		int p=sum-(sum+1)/2;
		Bitset bs=new Bitset(p+1);
		bs[0]=1;
		for(int i = 0;i<n;i++) {bs|=bs<<a[i];}
		while(bs[p]==0){p--;}
		Console.WriteLine("{0}",sum-p);
	}
}
public class Bitset{
	public int n,l;
	public ulong[] he;
	public Bitset(int n){
		this.n=n;
		l=(n>>6)+1;
		he=new ulong[l];
	}
	public byte this[int i]{
		set{he[i>>6]=(he[i>>6]&(ulong.MaxValue^(1UL<<i)))|(1UL<<i);}
		get{return (byte)((he[i>>6]>>i)&1);}
	}
	public static Bitset operator&(Bitset a,Bitset b){
		Bitset c=new Bitset(a.n);
		int d=Math.Min(a.l,b.l);
		for(int i=0;i<d;i++){c.he[i]=a.he[i]&b.he[i];}
        return c;
	}
	public static Bitset operator|(Bitset a,Bitset b){
		Bitset c;
		if(a.l<b.l){c=a;a=b;b=c;}
		c=new Bitset(a.n);
		int i=0;
		for(;i<b.l;i++){c.he[i]=a.he[i]|b.he[i];}
		for(;i<a.l;i++){c.he[i]=a.he[i];}
        return c;
	}
	public static Bitset operator^(Bitset a,Bitset b){
		Bitset c;
		if(a.l<b.l){c=a;a=b;b=c;}
		c=new Bitset(a.n);
		int i=0;
		for(;i<b.l;i++){c.he[i]=a.he[i]^b.he[i];}
		for(;i<a.l;i++){c.he[i]=a.he[i];}
        return c;
	}
	public static Bitset operator<<(Bitset a,int b){
		Bitset c=new Bitset(a.n);
		if(b>a.l<<6){return c;}
		int d=(b+63)>>6;
		if(b%64==0){for(int i=a.l-1;i>=d;i--){c.he[i]=a.he[i-d];}}
		else{
			for(int i=a.l-1;i>=d;i--){c.he[i]=(a.he[i-d+1]<<b)|(a.he[i-d]>>(64-b));}
			c.he[d-1]=a.he[0]<<b;
		}
        return c;
	}
	public static Bitset operator>>(Bitset a,int b){
		Bitset c=new Bitset(a.n);
		if(b>a.l<<6){return c;}
		int d=(b+63)>>6;
		if(b%64==0){for(int i=0;i+d<c.l;i++){c.he[i]=a.he[i+d];}}
		else{
			for(int i=0;i+d<c.l;i++){c.he[i]=(a.he[i+d-1]>>b)|(a.he[i+d]<<(64-b));}
			c.he[c.l-d]=a.he[c.l-1]>>b;
		}
        return c;
	}
}

public class Sc{
	private string[] a;
	private int n=-1,m=0;
	public int I{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return int.Parse(a[n]);}}
	public long L{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return long.Parse(a[n]);}}
	public double D{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return double.Parse(a[n]);}}
	public string S{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return a[n];}}
	public int[] Ia{get{if(n!=-1&&n!=a.Length-1){m=n;n=-1;return Array.ConvertAll(a.Skip(m+1).ToArray(),int.Parse);}return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}

Measured memory_bytes: 30680
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include<bits/stdc++.h>
using namespace std;
using ll=int_fast64_t;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

class A01Matrix {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int h,w,a,b;
        in>>h>>w>>a>>b;
        fr(i,h){
            fr(j,w) out<<((i<b)^(j>=a))?1:0;
            out<<endl;
        }
    }
};

int main() {
    A01Matrix solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define int long long int
using namespace std;
int32_t main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
    cout.tie(NULL);
	int n,p;
	cin>>n>>p;
	string s;
	cin>>s; 
	int ans = 0; 
	if(p==2 or p==5){
		for(int i=0;i<n;i++){
			int num = s[i] - '0'; 
			if(num%p==0){
				ans += (i+1);
			}
		}
	}else{
		map<int,int> hash; 
		hash[0]++; 
		int pwr = 1; 
		int suffix = 0; 
		for(int i = n-1;~i;i--){
			suffix = suffix + (s[i]-'0') * pwr;
			if(suffix >=p )
				suffix %= p; 
			ans += hash[suffix]; 
			hash[suffix]++; 
			pwr = pwr * 10 % p;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1044
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<utility>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> P;
typedef unsigned long long int ull;
const ll MOD=1e9+7;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int MAXN=100000;
const int MAXE=100000;
const int MAXV=10000;
const ll INF=2e18;

struct UnionFindTree{
    vector<int> par,rank;
    UnionFindTree(int n):par(n),rank(n,0){
        for(int i=0;i<n;i++) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        return par[x]=root(par[x]);
    }
    void unite(int x,int y){
        int rx=root(x),ry=root(y);
        if(rx==ry) return ;
        if(rank[rx]<rank[ry]) par[rx]=ry;
        else par[ry]=rx;
        if(rank[rx]==rank[ry]) rank[rx]++;
    }
    bool same(int x,int y){
        return root(x)==root(y);
    }
};

ll power(ll a,ll x){
    ll res=1;
    while(x>0){
        if(x&1) res*=a;
        a*=a;
        x>>=1;
    }
    return res;
}

int main(){
    ll n;cin>>n;
    vector<ll> dp(n+1,0LL);
    for(ll i=1;i*i<=n;i++){
        for(ll j=i;j*j<=n;j++){
            for(ll k=j;k*k<=n;k++){
                ll m=i*i+j*j+k*k+i*j+j*k+k*i;
                if(m<=n){
                    if(i==j&&j==k) dp[m]++;
                    else if(i==j||j==k||k==i) dp[m]+=3;
                    else dp[m]+=6;
                }
            }
        }
    }
    for(ll i=1;i<=n;i++){
        cout<<dp[i]<<endl;
    }
}

Measured memory_bytes: 3576
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

    vector<pair<int, int>> reds(N);
    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        reds[i] = {a, b};
    }
    // descending order by y
    sort(reds.begin(), reds.end(), [](const pair<int, int> a, const pair<int, int> b) {
            return a.second > b.second;
                    });

    vector<pair<int, int>> blues(N);
    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        blues[i] = {a, b};
    }
    sort(blues.begin(), blues.end());

    int cnt = 0;
    vector<bool> used_red(N, false);

    for (int bi = 0; bi < N; bi++) {
        for (int ri = 0; ri < N; ri++) {
            if (used_red[ri]) {
                continue;
            }
            auto blue = blues[bi];
            auto red = reds[ri];
            if (red.first < blue.first && red.second < blue.second) {
                cnt++;
                used_red[ri] = true;
                break;
            }
        }
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main(){
  int h,n,a[100000],i,sum=0;
  cin>>h>>n;
  for(i=0; i<n; i++){
    cin>>a[i];
    sum+=a[i];
  }
  if(sum>=h){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 640
list1=list(map(int,input().split()))
list2=list(map(int,input().split()))
list3=list(map(int,input().split()))
n=int(input())
nums = list()
for i in range(n):
    temp = int(input())
    nums.append(temp)

a=list1
a.extend(list2)
a.extend(list3)

a=[i in nums for i in a]
if (a[0] and a[1] and a[2])or \
   (a[3] and a[4] and a[5])or \
   (a[6] and a[7] and a[8])or \
   (a[0] and a[3] and a[6])or \
   (a[1] and a[4] and a[7])or \
   (a[2] and a[5] and a[8])or \
   (a[0] and a[4] and a[8])or \
   (a[2] and a[4] and a[6]):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
int main(){
  ll n;
  cin>>n;

  ll lsum=0;
  priority_queue<ll,vector<ll>,greater<ll>> lpque;
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    lpque.push(a);
    lsum+=a;
  }

  vector<ll> vec;
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    vec.push_back(a);
  }

  ll rsum=0;
  priority_queue<ll> rpque;
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    rsum+=a;
    rpque.push(a);
  }

  vector<ll> lvec(n+1,0);
  lvec[0]=lsum;
  ll lmins=0;
  for(int i=1;i<=n;i++){
    lsum+=vec[i-1];
    lpque.push(vec[i-1]);
    lmins+=lpque.top();
    lpque.pop();
    lvec[i]=lsum-lmins;
  }

  vector<ll> rvec(n+1,0);
  rvec[n]=rsum;
  ll rmaxs=0;
  for(int i=n-1;i>=0;i--){
    rsum+=vec[i];
    rpque.push(vec[i]);
    rmaxs+=rpque.top();
    rpque.pop();
    rvec[i]=rsum-rmaxs;
  }
  ll ans=-1;
  for(int i=0;i<50;i++) ans*=2;
  //cout<<ans<<endl;
  for(int i=0;i<=n;i++) ans=max(ans,lvec[i]-rvec[i]);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4468
import java.util.Scanner;
class Main{
 public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
int ans=1;
if (a!=b) {
	ans++;	
}
if(c!=b&&c!=a) {
	ans++;
}
System.out.println(ans);
 }
  }

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

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; ++i) {
    cin >> p.at(i);
  }
  int ans = 0;
  for (int i = 0; i < n - 2; ++i) {
    vector<int> v = {p.at(i), p.at(i + 1), p.at(i + 2)};
    sort(v.begin(), v.end());
    if (v.at(1) == p.at(i + 1)) {
      ++ans;
    }
  }
  cout << ans << endl;
}


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

int main() {
  int H, W;
  cin >> H >> W;
  for(int i = 0; i < W+2; i++)
    cout << '#';
  cout << endl;
  for(int i = 0; i < H; i++) {
    cout << '#';
    vector<char> p(W);
    for(int j = 0; j < W; j++) {
      cin >> p.at(j);
      cout << p.at(j);
      }
    cout << '#' << endl;
  }
  for(int i = 0; i < W+2; i++)
    cout << '#';
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;


static class NagataKanaIsAGenius {
    public static void Main() {
        int[]nm=Console.ReadLine().Split().Select(int.Parse).ToArray();
        int n=nm[0];
        long m=nm[1];
        Tuple<int,int>[]data=new Tuple<int, int>[n];
        for(int i=0;i<n;i++){
            int[]ab=Console.ReadLine().Split().Select(int.Parse).ToArray();
            data[i]=new Tuple<int,int>(ab[0],ab[1]);
        }
        Array.Sort(data);
        long ans=0;
        for(int i=0;i<n;i++){
            long a=data[i].Item1;
            long b=data[i].Item2;
            if(m<=b){
                ans+=a*m;
                m=0;
                break;
            }
            ans+=a*b;
            m-=b;
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 21180
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char **argv)
{
    int n;
    long y;
    scanf("%d %ld", &n, &y);
    for (int i = 0; i <= n; i++) {
        long amt = 10000L * i;
        for (int j = 0; j <= n - i; j++) {
            int k = n - i - j;
            if (amt + 5000L * j + 1000L * k == y) {
                printf("%d %d %d\n", i, j, k);
                return EXIT_SUCCESS;
            }
        }
    }
    printf("-1 -1 -1\n");
    return EXIT_SUCCESS;
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

vc<pl> primeFactorization(ll n){
    vc<pl> v;
    ll orgn=n;
    int cnt;
    for(ll i=2;i*i<=orgn;i++){
        cnt=0;
        while(n%i==0){
            cnt++;
            n/=i;
        }
        if(cnt)v.emplace_back(i,cnt);
    }
    if(n!=1)v.emplace_back(orgn,1);
    return v;
}

int main(){

    ll n;
    cin>>n;

    int ans=0;
    vc<pl> v=primeFactorization(n);

    rep(i,v.size()){
        int x=0;
        while(x<v[i].second){
            ans++;
            x++;
            v[i].second-=x;
        }
    }

    cout<<ans<<"\n";

    return 0;

}

Measured memory_bytes: 3620