akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if((a*b)==(c*d))
    {
        cout<<a*b<<endl;
    }
    else if((a*b)>(c*d))
    {
       cout<<a*b<<endl;
    }
    else
    {
         cout<<c*d<<endl;
    }
    return 0;
}




Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <limits>

using namespace std;
using ll = long long;
using vi = vector<int>;


#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ITER(it,v) for(auto it=v.begin();it!=v.end();++it)
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<"\n"
const ll INF = numeric_limits<ll>::max();

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

  vi V(N);
  ll sum[N+1];
  sum[0] = 0;
  REP(i, N) {
    cin >> V[i];
    sum[i+1] = (ll)sum[i] + V[i];
  }
  ll ans = -INF;
  REP(l, min(N, K)+1) REP(r, min(N-l, K-l)+1) {
    // 左からl個、右からr個取り出す
    vi v2(l+r);
    copy(V.begin(), V.begin() + l, v2.begin());
    copy(V.end() - r, V.end(), v2.begin()+l);
    sort(ALL(v2));

    ll tmp = (ll)sum[l] + (sum[N] - sum[N-r]);
    REP(i, min(l + r, K - (l + r))) {
      if (v2[i] < 0) {
        tmp += -v2[i];
      }
    }
    ans = max(ans, tmp);
  }
  OUT(ans);
  return 0;
}


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

template <typename T>
struct Point {
    T x, y;

    Point() = default;
    Point(T x, T y) : x(x), y(y) {}

    template <typename U>
    Point(const Point<U> &rhs) : x(rhs.x), y(rhs.y) {}

    Point<T> operator+(const Point<T> &rhs) const {
        return Point(x + rhs.x, y + rhs.y);
    }

    Point<T> operator-(const Point<T> &rhs) const {
        return Point(x - rhs.x, y - rhs.y);
    }

    T operator*(const Point<T> &rhs) const {
        return x * rhs.x + y * rhs.y;
    }

    T operator%(const Point<T> &rhs) const {
        return x * rhs.y - y * rhs.x;
    }
};

struct Line{
    // ax+by+c=0
    int64_t a,b,c;
    double angle;
    Point<int64_t> pa,pb;
    Line():a(0),b(0),c(0),angle(0),pa(),pb(){}
    Line(Point<int64_t> pa, Point<int64_t> pb):a(pa.y-pb.y),b(pb.x-pa.x),c(pa%pb),angle(atan2(-a,b)),pa(pa),pb(pb){}
};

Point<double> intersect(Line la,Line lb){
    if(la.a*lb.b == la.b*lb.a) throw;
    int64_t bot=-la.a*lb.b+la.b*lb.a;
    return Point<double>(1.0 * (-la.b*lb.c+la.c*lb.b) / bot,1.0 * (la.a*lb.c-la.c*lb.a) / bot);
}

int main() {
    int q; cin >> q;
    while (q--) {
        Point<int64_t> p1, p2, p3, p4;
        cin >> p1.x >> p1.y;
        cin >> p2.x >> p2.y;
        cin >> p3.x >> p3.y;
        cin >> p4.x >> p4.y;
        Point<double> ans = intersect(Line(p1, p2), Line(p3, p4));
        cout << fixed << setprecision(20) << ans.x << ' ' << ans.y << endl;
    }
    return 0;
}



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

int D;
long long G;
vector<long long>p,c;

int main(){
    cin>>D>>G;
    p.resize(D);c.resize(D);
    for(int i=0;i<D;i++)cin>>p[i]>>c[i];
    long long res=1<<29;
    //out<<res<<endl;
    for(int bit=0;bit<(1<<D);bit++){
        long long sum=0;
        long long num=0;
        for(int i=0;i<D;i++){
            if(bit&(1<<i))sum+=c[i]+p[i]*100*(i+1),num+=p[i];
        }
        if (sum>=G) {
            //cout<<res<<" "<<num<<endl;
            res=min(res,num);
        }
        else{
            for(int i=D-1;i>=0;i--){
                if(bit&(1<<i)) continue;
                for(int j=0;j<p[i];j++){
                    if(sum>=G) break;
                    sum+=100*(i+1);
                    num++;
                }
            }
            //cout<<res<<" "<<num<<endl;
            res=min(res,num);
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<climits>
#include<map>
#define ll long long
using namespace std;
int main() {
	string o,e;
	cin >> o >> e;
	for (ll i = 0; i < o.size(); i++) {
		cout << o[i];
		if (o.size() != e.size()&&i==o.size()-1) {
			break;
		}
		cout<<e[i];
	}
	cout << endl;


}



Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
    VECCIN(head);
    VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
    seco[head]=IN();
    VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    CIN(n);
    auto f = [&](int t){
        int num = 0;
        while(t){
            num += t%10;
            t/=10;
        }
        return num;
    };
    int ans = INF;
    FOR(a,1,n){
        int b = n - a;
        ans = min(ans, f(a) + f(b));
    }
    COUT(ans);

    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cctype>

inline void read(int & x)
{
	x = 0;
	int k = 1;
	char c = getchar();
	while (!isdigit(c))
		if (c == '-') c = getchar(), k = -1;
		else c = getchar();
	while (isdigit(c))
		x = (x << 1) + (x << 3) + (c ^ 48),
		c = getchar();
	x *= k;
}

int a, b;

signed main()
{
	 read(a), read(b);
	 std::cout << a + (b >> 1); 
}



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

int m1, d1, m2, d2;

int main()
{
    cin >> m1 >> d1;
    cin >> m2 >> d2;
    if (d2 == 1) printf("1\n");
    else printf("0\n");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;


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

   vector<string> s(N);
   rep(i,N){
      cin>>s[i];
   }
   string ans;
   sort(s.begin(),s.end());
   rep(i,N){
      ans+=s[i];
   }
   cout<<ans;




return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
n = []
m = []
for i in range(N):
  s = str(input())
  row = []
  for j in range(N):
    if s[j] == "#":
      row.append(1)
    else:
      row.append(0)
  n.append(row)
for i in range(M):
  s = str(input())
  row = []
  for j in range(M):
    if s[j] == "#":
      row.append(1)
    else:
      row.append(0)
  m.append(row)
 
def search(a,b):
  mr = mc = 0
  for r in range(a, a+M):
    for c in range(b, b+M):
      if n[r][c] != m[mr][mc]:
        return False
      mc += 1
    mr += 1
    mc = 0
  return True

ans = 0
for i in range(N-M+1):
  for j in range(N-M+1):
    if search(i,j):
      ans = 1
      break
  if ans:
    break
if ans:
  print("Yes")
else:
  print("No")

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

using namespace std;
using ll = long long;

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    string s; cin >> s;
    vector<int> ans, v(n+1);
    int x = n;
    rep(i, m){
        if(s[max(0, n-i-1)] == '0')x = max(0, n-i-1);
    }
    v[n] = x;
    for (int i = n; i > 0; i--)
    {
        if(s[max(0, i-m-1)] == '0')x = max(0, i-m-1);
        v[i-1] = x;
    }
    int start = n;
    while (start != 0)
    {
        if (v[start] == start){
            cout << -1 << endl;
            return 0;
        }
        ans.push_back(start - v[start]);
        start = v[start];
    }
    for (int i = ans.size() - 1; i >= 0; i--)
    {
        cout << ans[i] << " ";
    }
    
    
}

Measured memory_bytes: 1480
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


int main(){
    ll n; cin >> n;
    vector<ll> a(n);
    vector<ll> pos, neg;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i]<0){neg.push_back(a[i]);}
        else{pos.push_back(a[i]);}
    }
    sort(all(a));
    sort(all(pos));
    sort(all(neg)); reverse(all(neg));

    if(pos.empty()){
        ll ans = 0;
        for(int i = 1; i < neg.size(); i++){
            ans += -1*neg[i];
        }
        ans += neg[0];
        cout << ans << endl;

        for(int i = 0; i < neg.size()-1; i++){
            cout << neg[0] << " " << neg[n-1-i] << endl;
            neg[0] -= neg[n-1-i];
        }
    }else if(neg.empty()){
        ll ans = 0;
        for(int i = 1; i < pos.size(); i++){
            ans += pos[i];
        }
        ans -=pos[0];
        cout << ans << endl;

        for(int i = 0; i < pos.size()-2; i++){
            cout << pos[0] << " " << pos[n-2-i] << endl;
            pos[0] -= pos[n-2-i];
        }
        cout << pos[n-1] << " " << pos[0] << endl;
        pos[n-1] -= pos[0];
    }else{
        ll ans = 0;
        for(int i = 0; i < pos.size(); i++){
            ans += pos[i];
        }
        for(int i = 0; i < neg.size(); i++){
            ans -= neg[i];
        }
        cout << ans << endl;

        for(int i = 1; i < pos.size(); i++){
            cout << neg[0] << " " << pos[i] << endl;
            neg[0] -= pos[i];
        }
        for(int i = 0; i < neg.size(); i++){
            cout << pos[0] << " " << neg[i] << endl;
            pos[0] -= neg[i];
        }
    }


    return 0;
}


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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
//#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int a[maxn];

int32_t main()
{
    IOS
    int n;
    cin>>n;
    for (int i=1;i<=n;i++) cin>>a[i];
    int minn=inf;
    for (int i=1;i<=100;i++)
    {
        int sum=0;
        for (int j=1;j<=n;j++) sum+=(a[j]-i)*(a[j]-i);
        minn=min(minn,sum);
    }
    cout<<minn<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MAX 2000005
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define vi vector<ll>
#define vp vector<pii>
#define all(v) v.begin(),v.end()
#define lb(v,x) lower_bound(all(v),x)
#define ub(v,x) upper_bound(all(v),x)
#define sz(x) (ll)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(ll i=a;i<b;++i)
#define ROF(i,a,b) for(ll i=a;i>=b;--i)
#define trace(x) cerr<<#x<<": "<<x<<'\n';
typedef long long ll;
using namespace std;
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

ll mexp(ll a, ll b){
    ll ans=1;
    a%=MOD;
    while(b){
        if(b&1) ans=ans*a%MOD;
        b>>=1;
        a=a*a%MOD;
    }
    return ans;
}

ll gcd(ll a,ll b){
    if(a==0){
        return b;
    }
    return gcd(b%a,a);
}

const int N = 305;

double dp[N][N][N];
int c[4];

int main(){
    IOS
    
    int n;
    cin>>n;
    FOR(i,1,n+1){
        int x;
        cin>>x;
        c[x]++;
    }
    FOR(k,0,n+1){
        FOR(j,0,n+1){
            FOR(i,0,n+1){
                int sum=i+j+k;
                if(sum==0){
                    continue;
                }
                dp[i][j][k]=1.0*n/sum;
                if(i){
                    dp[i][j][k]+=dp[i-1][j][k]*i/sum;
                }
                if(j){
                    dp[i][j][k]+=dp[i+1][j-1][k]*j/sum;
                }
                if(k){
                    dp[i][j][k]+=dp[i][j+1][k-1]*k/sum;
                }
            }
        }
    }
    cout<<fixed<<setprecision(10)<<dp[c[1]][c[2]][c[3]];
    cerr<<1.0/CLOCKS_PER_SEC<<endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  n++;
  vector<int> t(n, 0), x(n, 0), y(n, 0);
  for (int i = 1; i < n; i++) {
    cin >> t[i] >> x[i] >> y[i];
  }

  for (int i = 0; i + 1 < n; i++) {
    int dis = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);
    int tt = t[i + 1] - t[i];
    if (tt < dis) {
      cout << "No\n";
      return 0;
    }
    if ((tt - dis) % 2 == 1) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";

  return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
typedef pair<int,int> P;
#define mod 1000000007

ll power(ll n, ll x){
    if(x==0) return 1;
    if(x%2==0) {
        ll t=power(n,x/2);
        return t*t%mod;
    }
    return n*power(n,x-1)%mod;
}
ll com(ll n, ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(n>tmp-r){
        x*=n;
        x%=mod;
        n--;
    }
    while(r>0){
        y*=r;
        y%=mod;
        r--;
    }
    return x*power(y,mod-2)%mod;
}

int main(){
    ll n,a,b;
    cin >> n>>a>>b;
    ll sum=power(2,n);
    ll ans=(sum-com(n,a)-com(n,b)-1)%mod;
    if (ans<0) ans+=mod;
    cout <<ans%mod<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5; 
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}

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


int n; float a[N];

void solve()
{
    cin >> n;
    for (int i=0; i<n; ++i) cin >> a[i];
    sort(a,a+n);
    float ans=0;
    ans = (a[0]+a[1])/2;
    for (int i=2; i<n; ++i) {
        ans = (ans+a[i])/2;
    }nout(ans);    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}       

Measured memory_bytes: 3768
#include<bits/stdc++.h>//h
using namespace std;
int main()
{
    int a,w,x,y,z,c,b,d,p[4],coutt=0;
    cin>>a;
    if(a>=1000 && a<=9999)
    {
        w=a%10;
        b=a/10;
        x=b%10;
        c=b/10;
        y=c%10;
        z=c/10;
        p[0]=w;
        p[1]=x;
        p[2]=y;
        p[3]=z;
        for(int i=0; i<2; i++)
        {
            if(p[i]==p[i+1] && p[i]==p[i+2])
            {
                coutt++;
                break;
            }
        }
        if ((coutt>0)) {
          cout<<"Yes"<<endl;
        }
        else{
          cout<<"No\n";
        }
    }
    return 0;
}


Measured memory_bytes: 256
while True:
  a,op,b =input().split()
  a = int(a)
  b = int(b)
  if op=='?':
    break
  ans=0
  if op=='+':
    ans+=(a+b)
  if op=='-':
    ans+=(a-b)
  if op== '*':
    ans+=(a*b)
  if op=='/':
    ans+=(a//b)
  print(ans)


Measured memory_bytes: 5596
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  string s;
  cin >> s;
  int n = s.size();
  bool ok = true;
  if(s[0] != 'A') ok = false;
  int cntCapital = 0;
  int cntC = 0;
  rep(i, n) {
    if(1 < i && i < n - 1 && s[i] == 'C') cntC++;
    int nc = s[i] - 'a';
    dbg(s[i]);
    dbg(nc);
    if(nc < 0) cntCapital++;
  }
  if(cntCapital > 2) ok = false;
  if(cntC != 1) ok = false;
  if(ok)
    cout << "AC" << endl;
  else
    cout << "WA" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
  int N, K;
  int S[101];
  int B;
  
  while(cin >> N >> K){
    if(N == 0 && K == 0) break;
    
    bool flag = 1;

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

    for(int i = 0 ; i < N ; i++){
      for(int j = 0 ; j < K ; j++){
	cin >> B;
	S[j] -= B;
	if(S[j] < 0) flag = 0;
      }
    }
    
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}

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

using namespace std;

int main() {
	string s1,s2;
	cin>>s1>>s2;
	for (int i=0;i<s1.length();i++) {
		if (s1==s2) {
			cout<<"Yes"<<endl;
			return 0;
		}
		s1=s1[s1.length()-1]+s1.substr(0,s1.length()-1);
	}
	cout<<"No"<<endl;
//	system("pause");
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if(N == 1) {
			System.out.println(1);
			return;
		}
		int[] A = new int[N];
		int ans = 0;
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		Arrays.sort(A);
		int a = 1;
		for(int i = 1; i < N; i++) {
			if(A[i] == A[i-1]) {
				a += 1;
				if(i == N-1)
					ans += a % 2;
			}
			else {
				ans += a % 2;
				a = 1;
				if(i == N-1)
					ans++;
			}
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 49656
import qualified Data.Vector.Unboxed as V
import Data.Vector.Unboxed ((!))
import qualified Data.Vector.Unboxed.Mutable as VM
import Data.List
import Control.Monad

coordN :: Int -> (Int, Int) -> Int
coordN n (x,y) = x*n+y

main :: IO ()
main = do
  [n,m,q] <- map read . words <$> getLine
  let cd = coordN n
  vecm <- VM.replicate (n*n) 0 :: IO (VM.IOVector Int)
  replicateM_ m $ do
    [x,y] <- map read . words <$> getLine
    VM.modify vecm (+1) $ cd (x-1,y-1)
  forM_ [0..(n-1)*n-1] $ \i -> do
    val <- VM.read vecm i
    VM.modify vecm (val+) (i+n)
  forM_ [0..n-1] $ \x -> do
    let slice = VM.slice (x*n) n vecm
    forM_ [1..n-1] $ \y -> do
      val <- VM.read slice (y-1)
      VM.modify slice (val+) y
  vec <- V.unsafeFreeze vecm :: IO (V.Vector Int)
  replicateM_ q $ do
    [x,y] <- map read . words <$> getLine
    putStrLn $ show $ query vec n (x-1) (y-1)

query :: V.Vector Int -> Int -> Int -> Int -> Int
query vec n x y =
  vec ! cd (y,y) - chk (vec ! cd (x-1,y)) - chk (vec ! cd (y,x-1))
  + chk (vec ! cd (x-1,x-1))
 where
   cd = coordN n
   chk = if x <= 0 then const 0 else id

Measured memory_bytes: 3964
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, m;
    long long sum = 0;
    cin >> n >> m;
    pair<int, int> shop[n];
    for(int i = 0; i < n; i++){
        cin >> shop[i].first >> shop[i].second;
    }
    sort(shop,shop+n);
    for(int i = 0; i < n; i++)
    {
        int t = min(m, shop[i].second);
        sum += (long long) t * shop[i].first;
        m -= t;
        if(m==0) break;
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
vector<vi> graph;
vector<int> ans;
void bfs()
{
	queue<int> q;
	q.push(1);
	ans[1] = -1;
	while(!q.empty())
	{
		int x = q.front();q.pop();
		for(int i=0;i<graph[x].size();++i)
		{
			if(ans[graph[x][i]]==0)
			{
				ans[graph[x][i]] = x;
				q.push(graph[x][i]);
			}
		}
	}
}
int main()
{
	int n,m,x,y,i;
	scanf("%d %d",&n,&m);
	graph.assign(n+1,vi());
	ans.assign(n+1,0);
	for(i=0;i<m;++i)
	{
		scanf("%d %d",&x,&y);
		graph[x].push_back(y);
		graph[y].push_back(x);
	}
	bfs();
	for(i=1;i<=n;++i)
	{
		if(ans[i]==0)
		{
			printf("-1");
			return 0;
		}
	}
	printf("Yes\n");
	for(i=2;i<=n;++i)			cout << ans[i] << "\n";
}

Measured memory_bytes: 10180
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 440000, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += (72 - dig >> 3);
	return tmp;
}
char* di = cn;
inline void putint(int X) {
	if (X < 10) {
		*di++ = '0' + X;
		*di++ = '\n';
		return;
	}
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

int A[200001];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);

	int N = getint();
	rep(i, N - 1) A[getint()]++;

	rep1(i, N) putint(A[i]);

	fwrite(cn, 1, di - cn, stdout);


	Would you please return 0;
}

Measured memory_bytes: 2688
#include <iostream>
#include <string>

using namespace std;

int main() {
    string str; cin >> str;

    int sum = str[0] - '0';

    int bit = 0;
    for (; bit < 16; ++bit, sum = str[0] - '0') {
        for (int j = 1; j < 4; ++j) {
            if (bit & 1 << (3 - j)) sum += str[j] - '0';
            else                    sum -= str[j] - '0';
        }

        if (sum == 7) break;
    }

    cout << str[0];
    for (int i = 1; i < 4; ++i) {
        if (bit & 1 << (3 - i)) cout << '+';
        else                    cout << '-';
        cout << str[i];
    }

    cout << "=7" << endl;


    return 0;
}

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

S = [list(input()) for _ in range(H)]

# #の座標(i,j)を与え、隣接している#があるならばTrue、そうでなければNoを出力して終了する
def exist_neighbor_black_cell(i,j):
    if "#" in [S[max(0,i-1)][j], S[min(H-1,i+1)][j], S[i][max(0,j-1)], S[i][min(W-1,j+1)]]:
        return True
    else:
        print("No")
        exit()

# どの#にも隣接していない#マスがあれば不可。そうでなければ可
for i in range(H):
    for j in range(W):
        if S[i][j] == "#":
            exist_neighbor_black_cell(i, j)

print("Yes")

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
using namespace std;
int pal(long long a)
{
	long long b=0;
	while(a!=0)
	{
		b=b+(a%10);
		a=a/10;
		if(a!=0)
		{
			b*=10;
		}
	}
	return b;
}
int main()
{
	long long x,y;
	long long ans=0;
	cin>>x>>y;
	while(x<=y)
	{
		if(x==pal(x))
		{
			ans++;
		}
		x++;
	}
	cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 256
/******************************************
* NICK : nikhilsinghh59 *
******************************************/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"

#define PB push_back
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
const int M = 1e9+7;

int main()
{   
    

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

    if(n==0) {
        cout << 0 ;
        return 0;
    }
    if(k==1) {
        cout << 0;
        return 0;
    }
    if(n==k) {
        cout << 0;
        return 0;
    }
    if(n%k == 0) {
        cout << 0;
        return 0;
    }

    n = n - (n/k)*k;

    cout << min(n , abs(n - k));
    //cout << "n ";
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int gcd(int m,int n){
   if(m<n) swap(m,n);
   while(true){
      if(n==0) return m; 
      int tmp=n;
      n=m%n;
      m=tmp;
  }
}

int lcm(int a, int b){
//   cout <<a*b<<endl;
   return (a/gcd(a,b))*b;
}

int main(){

   int a,b;

   while(cin >> a >> b){
      cout << gcd(a,b);
      cout << " ";
      cout << lcm(a,b) <<endl;
   }

   return 0;

}

Measured memory_bytes: 1160
#include<stdio.h>
int main(void)
{
	int n,i,x;
	scanf("%d", &n);
	for(i=3; i<=n; i++)
	{;
		if(i%3==0||i%10==3)
		printf(" %d", i);
		else
		{
			x=i;
			while(x>0)
			{
				if(x%10==3)
				{
					printf(" %d", i);
					break;
				}
				x/=10;
			}
		}
	}
	printf("\n");
	
	return 0;
}


Measured memory_bytes: 2092
#include<bits/stdc++.h>
using namespace std;
int main(){
 int A,B,C;
  cin>>A>>B>>C;
  vector <int> a(3);
  a.at(0)=A-B;
  a.at(1)=A-C;
  a.at(2)=B-C;
  int sum=0;
  for(int i=0;i<3;i++){
  if(a.at(i)==0) sum++;
    
  }
  if(sum==1) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
 return 0;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r, c;
    cin >> r >> c;
    int table[r][c];
    
    //input
    for(int i = 0; i < r; i++){
        for(int j = 0; j < c; j++){
            cin >> table[i][j];
        }
    }
    
    //output
    int r_sum;
    int c_sum[c];
    for(int i = 0; i < c; i++) c_sum[i] = 0;
    
    for(int i = 0; i < r; i++){
        r_sum = 0;
        for(int j = 0; j < c; j++){
            cout << table[i][j] << " ";
            c_sum[j] += table[i][j];
            r_sum += table[i][j];
        }
        cout << r_sum << endl;
    }
    
    int gross = 0;
    for(int j = 0; j < c; j++){
        cout << c_sum[j] << " ";
        gross += c_sum[j];
    }
    cout << gross << endl;

}



Measured memory_bytes: 3128
#include<algorithm>
#include <bits/stdc++.h>
#include <math.h>
#include <queue>
using namespace std;
int main(void){
	string s,abc="abcdefghijklmnopqrstuvwxyz";
	int i,j,f;
	cin>>s;
	for(i=0;i<26;i++){
		f=1;
		for(j=0;j<s.size();j++){
			if(abc[i]==s[j]){
				f=0;
				break;
			}
		}
		if(f){
			cout<<abc[i]<<endl;
			return 0;
		}
	}
	cout<<"None"<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>

int main() {
    std::string S;
    std::cin >> S;

    for  (char& c : S) {
        if (std::count(S.begin(), S.end(), c) != 2) {
            std::cout << "No" << std::endl;
            return 0;
        }
    }

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


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

using namespace std;
typedef long long ll;
int main()
{
    int x=0 , y;
    int n ;
    cin >> n;
    int arr[n+1];
    arr[0]=-1;
    for(int i =1 ; i <=n ; i++)
    {
        cin >> arr[i];
        if(arr[i]==i&&arr[i-1]!=i-1)
        {
            x++;
        }
        else if(arr[i]==i&&arr[i-1]==i-1)
        {
            arr[i]--;
        }
    }
    cout << x ;
    return 0;
}


Measured memory_bytes: 3972
a, b, k = list(map(int, input().split(' ')))

while k > 0:
    aa = int(a / 2)
    b += aa
    a = aa

    k -= 1
    if k <= 0:
        break

    bb = int(b / 2)
    a += bb
    b = bb

    k -= 1

print(a, b)

Measured memory_bytes: 3064
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String[] line = sc.nextLine().split(" ");
			int N = Integer.parseInt(line[0]);
			int X = Integer.parseInt(line[1]);
			int[] L = Arrays.stream(sc.nextLine().split(" ")).mapToInt(r -> Integer.parseInt(r)).toArray();

			int d = 0, i = 0, cnt = 1;
			while (d <= X && i < L.length) {
				d += L[i++];
				if (d <= X) cnt++;
			}
			System.out.println(cnt);
		}
	}
}

Measured memory_bytes: 27084
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int A = sc.nextInt();
    if(N % 500 <= A) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	vector<pair<int,int>> v(n);
	for (int i=0;i<n;i++){
		cin >> v[i].first >> v[i].second;
	}
	vector<vector<double>> d(n,vector<double>(n));
	for(int i =0;i<n;i++){
		for(int j=0;j<n;j++){
			d[i][j] = sqrt((v[i].first-v[j].first)*(v[i].first-v[j].first)+
							(v[i].second-v[j].second)*(v[i].second-v[j].second));
		//	cout<<d[i][j] << " ";
			}
		//		cout << endl;
		}
	
	vector<int> perm;
	double sum=0;
	int count = 0;
	for(int i=1;i<=n;i++) perm.push_back(i);
	do{
		for(int i=1;i<(int)perm.size();i++){
			sum+=d[perm[i]-1][perm[i-1]-1];
			
		}
		count++;
	}
	while(next_permutation(perm.begin(),perm.end()));
	double result = sum/count;
	printf("%.10f", result);
}


Measured memory_bytes: 256
import Data.IORef
import Control.Monad
 
main :: IO()
main = getLine >> getContents >>= (\(x:y:xs) -> solve (y - x) (min x y) xs).map read.lines >>= print
 
solve :: Int -> Int -> [Int] -> IO Int
solve a b xs = do
                a' <- newIORef a
                b' <- newIORef b
                forM_ xs $ \z -> do
                    x <- readIORef a'
                    y <- readIORef b'
                    when (z - y > x) $ writeIORef a' (z - y)
                    when (z < y)     $ writeIORef b' z
                readIORef a'

Measured memory_bytes: 5552
import kotlin.math.abs

fun main() {
  val (H, W) = readInts()
  val S = (1..H).map { readString() }

  val dp = Array(H) { Array(W) { Array(2) { 0 } } }
  for (h in 0 until H) {
    var cnt = 0
    for (w in 0..W) {
      if (S[h].getOrNull(w) == '.') {
        cnt++
      } else {
        for (i in 1..cnt) dp[h][w - i][1] = cnt
        cnt = 0
      }
    }
  }
  for (w in 0 until W) {
    var cnt = 0
    for (h in 0..H) {
      if (S.getOrNull(h)?.get(w) == '.') {
        cnt++
      } else {
        for (i in 1..cnt) dp[h - i][w][0] = cnt
        cnt = 0
      }
    }
  }

  var max = 0
  for (h in 0 until H) {
    for (w in 0 until W) {
      val v = dp[h][w][0] + dp[h][w][1] - 1
      max = maxOf(v, max)
    }
  }
  println(max)
}

fun gcd(a: Int, b: Int): Int = if (a < b) gcd(b, a) else if (b == 0) a else gcd(b, a % b)
fun gcd(a: Long, b: Long): Long = if (a < b) gcd(b, a) else if (b == 0L) a else gcd(b, a % b)
fun lcm(a: Int, b: Int): Int = (a * b) / gcd(a, b)
fun lcm(a: Long, b: Long): Long = (a * b) / gcd(a, b)

fun readString() = readLine()!!
fun readStrings() = readLine()!!.split(" ")
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readInts() = readLine()!!.split(" ").map { it.toInt() }
fun readLongs() = readLine()!!.split(" ").map { it.toLong() }


Measured memory_bytes: 310200
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <nmmintrin.h>
#include <chrono>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

int c, n;

pii getza(int cx, int cy){
	if (cx >= n / 2)
		cx = n - cx - 1;
	if (cy >= n / 2)
		cy = n - cy - 1;
	return{ cx, cy };
}

int nanm(int cx, int cy){
	int ret = 0;
	if (cx >= n / 2)
		ret += 1;
	if (cy >= n / 2)
		ret+= 2;
	return ret;
}

signed main() {
	cin >> c >> n;
	int mp[501][501][4] = {};

	int wr = 0;

	REP(i, n){
		char ch;
		scnaf("%c", &ch);
		REP(j, n){
			pii cc = getza(i, j);
			scnaf("%c",&ch);
			mp[cc.first][cc.second][nanm(i,j)] = ch - '0';
		}
	}

	REP(i, n/2){
		REP(j, n/2){
			pii cc = getza(i, j);
			int cs = mp[cc.first][cc.second][0] + mp[cc.first][cc.second][1] + mp[cc.first][cc.second][2] + mp[cc.first][cc.second][3];
			if (cs < 4 && cs > 0)
				wr++;
		}
	}

	int ans = 0;

	if (!wr)
		ans++;

	REP(i, c-1){
		int m;
		cin >> m;
		REP(i, m){
			int x, y;
			cin >> x >> y;
			x--, y--;
			pii cc = getza(x, y);
			int bef = mp[cc.first][cc.second][0] + mp[cc.first][cc.second][1] + mp[cc.first][cc.second][2] + mp[cc.first][cc.second][3];

			mp[cc.first][cc.second][nanm(x, y)] = 1 - mp[cc.first][cc.second][nanm(x, y)];

			int cur = mp[cc.first][cc.second][0] + mp[cc.first][cc.second][1] + mp[cc.first][cc.second][2] + mp[cc.first][cc.second][3];

			if ((bef == 4 ||bef == 0) && (cur > 0 && cur < 4)){
				wr++;
			}

			if ((cur == 4 || cur == 0) && (bef > 0 && bef < 4)){
				wr--;
			}
		}

		if (!wr)
			ans++;
	}

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

Measured memory_bytes: 7144
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

PII dfs(VVI &es, vector<bool> &v, int p) {
    PII ret;
    v[p] = true;
    for (auto dst: es[p]) {
        if (v[dst]) continue;
        PII tmp = dfs(es, v, dst);
        ret.first += tmp.first;
        ret.second += tmp.second;
    }
    if (p <= 100000) ret.first++;
    else ret.second++;
    return ret;
}

void solve() {
    int n;
    cin >> n;
    //VI ps(100000*2+1);
    VVI es(100000*2+1);
    int x,y;
    REP(i,0,n) {
        cin >> x >> y;
        es[x].emplace_back(y+100000);
        es[y+100000].emplace_back(x);
    }
    vector<bool> v(100000*2+1, false);
    LL ans = 0;
    REP(i,0,100000*2+1) {
        if (v[i]) continue;
        auto vs = dfs(es, v, i);
        ans += 1LL * vs.first * vs.second;
    }
    cout << ans - n << endl;
}

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

Measured memory_bytes: 12928
a,b,c,x,y = map(int,input().split())
all_ab = max(x,y) * 2
ans = a*x + b*y

for i in range(2,all_ab+1,2):
    cnt = i*c
    alt = int(i/2)
    need_a = max(x - alt, 0)
    need_b = max(y - alt, 0)
    cnt += a*need_a + b*need_b
    ans = min(ans, cnt)
    # print(i,ans)

print(ans)

Measured memory_bytes: 66528
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 1000005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
#define all(x) x.begin(), x.end()
const int mod = 1e9+7;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m, x, y;
    cin >> n >> m >> y >> x;
    f(n) {
        fr(j,0,m) {
            if ((i < x) ^ (j < y)) {
                cout << 1;
            }
            else {
                cout << 0;
            }
        }
        cout << '\n';
    }
}

Measured memory_bytes: 1280
#include <iostream>

int main(){
    int a, b, c;
    std::cin >> a >> b >> c;

    if (a - b >= c)
    {
        std::cout << 0 << std::endl;
    }
    else
    {
        std::cout << c - a + b << std::endl;
    }

    return 0;
}

Measured memory_bytes: 3636
#pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef int_fast64_t ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
inline void fastio(){cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15);}
ll gcd(ll a,ll b){ll c=max(a,b);ll d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll modfact(ll a){ll b=1;FOR(i,2,a)b=b*i%MOD;return b;}
ll modpow(ll a, ll n){ll b=1;while (n>0){if(n&1)b=b*a%MOD;a=a*a%MOD;n>>=1;}return b;}
ll modcomb(ll n, ll k){ll b=1;k=min(n-k,k);DOWN(i,n,n-k+1)b=b*i%MOD;return b*modpow(modfact(k),MOD-2)%MOD;}

int N, Q;
const int size = 200010;
char S[size];
char ts[size];
int ds[size];
 
inline bool judge(int pos, bool left_judge) {
    if(pos < 0) return left_judge;
    if(pos >= N) return !left_judge;
    REP(i, Q) {
        if(S[pos]==ts[i]) {
            pos += ds[i];
            if(pos < 0) return left_judge;
            if(pos >= N) return !left_judge;
        }
    }
    return false;
}

inline int solve() {
    int l, r, m, res=0;
    for(l=-1, r=N; r-l>1; m=(r+l)/2) {
        if(judge(m, true)) l=m;
        else r=m;
    }
    res -= l+1;
    for(l=-1, r=N; r-l>1; m=(r+l)/2) {
        if(judge(m, false)) r=m;
        else l=m;
    }
    res += r;
    return res;
}

int main() {
    fastio();
    cin >> N >> Q;
    cin >> S;
    char d;
    REP(i, Q) {
        cin >> ts[i] >> d;
        ds[i] = d=='R'?1:-1;
    }
    cout << solve() << "\n";
	return 0;
}

Measured memory_bytes: 1408
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
ll INF = 1e18;
#define def 0

int main() {
  ll n;
  cin >> n;
  vl a(n);
  rep(i, n) cin >> a[i];
  ll tmp = a[0];
  REP(i, 1, n) { tmp = tmp ^ a[i]; }
  if (tmp == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int x, y;
    cin >> x;
    cin >> y;

    for (int i = 0; i <= x; i ++)
    {
        for (int j = 0; j <= y; j ++)
        {
            if ( (i + j == x) && (2*i + 4*j == y))
            {
                cout <<"Yes"; return 0;
            } 
        }
    }
    cout <<"No"; return 0;

}


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

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

    int input;
    cin >> input;
    int minv = input, maxv = -1000000001;
    for (int i = 1; i < n; i++) {
        cin >> input;
        maxv = max(maxv, input - minv);
        minv = min(minv, input);
    }

    cout << maxv << endl;
}


Measured memory_bytes: 3100
# coding: utf-8

N, K = map(int,input().split())
L = [0] * (N+1)
for i in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for i in range(d):
        L[A[i]] = 1

ans = 0
for i in L:
    if i == 0:
        ans += 1
ans -= 1
print(ans)

Measured memory_bytes: 67616
#include <stdio.h>

int main(void)
{
    int a, b;
    int x, y, z;
    int max;

    scanf("%d %d", &a, &b);

    x = a + b;
    y = a - b;
    z = a * b;

    max = (x > y) ? x : y;
    max = (z > max) ? z : max;

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

    return 0;
}

Measured memory_bytes: 128
////////////////////////////////////////////////////////////////////
// This source code is for Visual Studio
////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <stack>
#include <functional>
#include <iomanip>
#include <string>
#include <cstring>
#include <deque>
#include <math.h>
#include <assert.h>

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF32		INT32_MAX
#define	INF64		INT64_MAX
#define Rep(i,n) for(int i = 0; i < (n); ++i )

using namespace std;

typedef vector< vector<int> > MAT;
typedef pair<int, int> PINT;
typedef long long ll;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int32_t s32;
typedef int64_t s64;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

// main function
ll dp[41][405][405];// dp[i][a][b]: i番目までにAがa, Bがbを達成する最小の予算
int main()
{
	ll N = 0;
	ll MA = 0;
	ll MB = 0;
	ll ans = INF32;

	cin >> N >> MA >> MB;
	vector<ll> a(N);
	vector<ll> b(N);
	vector<ll> c(N);
	Rep(i, N) {
		cin >> a[i] >> b[i] >> c[i];
	}

	// solve
	Rep(i, 41) Rep(j, 405) Rep(k, 405) dp[i][j][k] = INF32;
	dp[0][0][0] = 0;
	for (ll i = 0; i < N; ++i ) {
		for (ll ja = 0; ja < 405; ++ja) {
			for (ll jb = 0; jb < 405; ++jb) {
				if (ja >= a[i] && jb >= b[i]) {
					dp[i + 1][ja][jb] = min(dp[i][ja][jb], dp[i][ja - a[i]][jb - b[i]] + c[i]);
				}
				else {
					dp[i + 1][ja][jb] = dp[i][ja][jb];
				}
				//printf("dp[%lld][%lld][%lld] : %d \n", i + 1, ja, jb, dp[i + 1][ja][jb]);
			}
		}
	}

	ll MAB = max(MA, MB);
	for (ll i = 1; i * MAB <= 400; ++i) {
		ans = min(ans, dp[N][MA * i][MB * i]);
	}
	ans = (ans == INF32) ? -1 : ans;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 52736
#include<iostream>
#include<algorithm>
using lint=long long;
using namespace std;

int main()
{
	int N,M;
	pair<int,int> p[100010]={};
	
	cin >> N >> M;
	for(int i=0;i<M;i++)
		cin >> p[i].second >> p[i].first;
	
	sort(p,p+M);
	
	int Min=0;
	int ans=0;
	for(int i=0;i<M;i++)
	{
		if(Min<p[i].second)
		{
			ans++;
			Min=p[i].first-1;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		@SuppressWarnings("resource")
		int x = new Scanner(System.in).nextInt();
		if (x < 1 || x > 100) {
			throw new IllegalArgumentException("input number error");
		}
		x = (int) Math.pow(x, 3);
		System.out.println(x);
	}
}



Measured memory_bytes: 25988
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print(i) std::cout << (i) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()
/* libraries */

#define dump1(v) for(auto i:v) std::cout << i << ' '; std::cout << "\n";
#define dump2(v) for(auto i:v) { for(auto j:i) std::cout << j << ' '; std::cout << "\n"; }


signed main() {
	int n;
	std::cin >> n;
	std::vector<int> a(n,0);
	for(int i=1;i<n;i++) {
		std::cin >> a[i];
		a[i]--;
	}
	std::vector<std::vector<int> > from(n,std::vector<int>());

	for(int to=1;to<n;to++) {
		from[a[to]].emplace_back(to);
	}

	std::function<int(int)> dfs = [&] (int i) -> int {
		if(from[i].size()==0) return 1;
		std::vector<int> depth;
		for(int to:from[i]) {
			depth.emplace_back(dfs(to));
		}
		int max = 0;
		std::sort(all(depth),std::greater<int>());
		for(int j=0;j<from[i].size();j++) {
			max = std::max(max,depth[j]+j);
		}
		return max+1;
	};

	print(dfs(0)-1);

	
	return 0;
}


Measured memory_bytes: 15872