akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long int
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second
#define MAXN 1000007
#define fr(i, s, e, st) for(ll (i) = (s); (i) < (e); (i) += (st))
#define fre(i, s, e, st) for(ll (i) = (s); (i) <= (e); (i) += (st))
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
 
using namespace std;

bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  
    // This is checked so that we can skip  
    // middle five numbers in below loop 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 

int main()
{
    fastio;
    int T = 1;
    while(T--){
        ll n;
        cin>>n;
        while(!isPrime(n))
            n++;
        cout<<n;
    }                                               
    return 0;
}

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

int main(){
    int N,X,Y;
    cin>>N>>X>>Y;
    vector<int> ans(N-1,0);

    for(int i=1;i<=N;i++){
        queue<int> q;
        vector<int> d(N+1,-1);
        q.push(i);
        d[i]=0;
        while(!q.empty()){
            int n=q.front();q.pop();
            //cout<<n<<endl;
            if(n<N && d[n+1]==-1){
                q.push(n+1);
                d[n+1]=d[n]+1;
            }
            if(n>1){
                if(d[n-1]==-1){
                    q.push(n-1);
                    d[n-1]=d[n]+1;
                }
            }
            if(n==X && d[Y]==-1){
                q.push(Y);
                d[Y]=d[X]+1;
            }
        }
        for(int j=i+1;j<=N;j++){
            //cout<<d[j]<<" ";
            ans[d[j]-1]++;
        }
        //cout<<endl;
    }

    for(auto p:ans){
        cout<<p<<endl;
    }
    
    return 0;
}

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

int main()
{
  ll n,k; cin>>n>>k;
  map<ll, ll> mp;
  rep(i, n) {
    ll a,b; cin>>a>>b;
    mp[a] += b;
  }
  for (auto v:mp) {
    k -= v.second;
    if (k <= 0) {
      cout << v.first << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 4224
// 2020-09-29 20:53:59
// clang-format off
#include <bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
// #include <atcoder/convolution>
// #include <atcoder/dsu>
// #include <atcoder/fenwicktree>
// #include <atcoder/lazysegtree>
// #include <atcoder/math>
// #include <atcoder/maxflow>
// #include <atcoder/mincostflow>
// #include <atcoder/modint>
// #include <atcoder/scc>
// #include <atcoder/segtree>
// #include <atcoder/string>
// #include <atcoder/twosat>
// #include <atcoder/all>
// using namespace atcoder;

// clang-format on
void answer() {
  ll n, m, d;
  cin >> n >> m >> d;
  ld ans = ld(1) / n / n * (n - d) * (1 + (d > 0)) * (m - 1);
  cout << fixed << setprecision(10) << ans << '\n';
}

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

Measured memory_bytes: 3796
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <bitset>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using lint = long long;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int MOD = 1000000007;
const lint INF = 1LL << 60;

int main() {
    int N, K;
    cin >> N >> K;
    int h[110000];
    for (int i = 0; i < N; i++) cin >> h[i];

    lint dp[110000];
    for (int i = 0; i < 110000; i++) dp[i] = INF;

    dp[0] = 0;

    for (int i = 0; i < N; i++) {
        for (int j = 1; j <= K; j++) {
            chmin(dp[i+j], dp[i] + abs(h[i] - h[i+j]));
        }
    }

    cout << dp[N-1] << endl;
    return 0;
}


Measured memory_bytes: 1536
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y-1);(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
#define re real()
#define im imag()

typedef complex<double> P;
typedef pair<P,P> L; //sX+tY
double EPS=1e-10;
double dot(P a,P b){return (conj(a)*b).real();}
double cros(P a,P b){return (conj(a)*b).imag();}

int ccw(P a,P b,P c){
  b-=a; c-=a;
  if(cros(b,c) > EPS) return +1;//ccw
  if(cros(b,c) < EPS) return -1;//cw
  if(dot(b,c) < EPS) return +2; //c-a-b
  if(dot(b,c) > EPS) return -2; //a-b-c or a-c-b
  return 0;
}
P dir(L a){return a.Y-a.X;}
P proj(P a,L to){
  P t=dir(to); a-=to.X;
  return dot(a,t)/norm(t)*t+to.X;
}

P refle(P a,L mirror){
  return P(2)*proj(a,mirror)-a;
}
int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int i,j,k;
  double a,b,c,d,e,f;
  P p,q;
  L l;
  while(EOF!=scanf("%lf,%lf,%lf,%lf,%lf,%lf",&a,&b,&c,&d,&e,&f)){
    p=P(e,f);
    l=L(P(a,b),P(c,d));
    //  cout<<p<<l<<endl;
    q=refle(p,l);
    printf("%.5lf %.5lf\n",q.re,q.im);
  }
  return 0;
}

Measured memory_bytes: 1288
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <map>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define mod 1000000007

ll sum[100]={0},pa[100]={0};

ll f(ll N,ll X){//level;N, X以下のpの数
  if(N==0){
    if(X<=0)return 0;
    else return 1;
  }else if(X<=1+sum[N-1])return f(N-1,X-1);
  else if(X==2+sum[N-1])return pa[N-1]+1;
  else if(X>2+sum[N-1] && X<=2+2*sum[N-1]){
    return pa[N-1]+1+f(N-1,X-2-sum[N-1]);
  }else return 2*pa[N-1]+1;
}

int main(){
  ll n,x;
  cin >> n >>x;
  sum[0]=pa[0]=1;
  rep(i,70){
    sum[i+1]=sum[i]*2+3;
    pa[i+1]=pa[i]*2+1;
  }
  cout << f(n,x) << endl;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

#define INF 1000000000

struct edge{int from,to,w;};
bool operator < (const edge &e, const edge &f) {
  return e.w != f.w ? e.w > f.w :
    e.from != f.from ? e.from < f.from : e.to < f.to;
}

vector<edge> g[310];

// http://www.prefield.com/algorithm/graph/dijkstra.html
void dijkstra(int n, int s, vi& dist, vi& prev) {
  dist.assign(n, INF); dist[s] = 0;
  prev.assign(n, -1);
  priority_queue<edge> Q; // "e < f" <=> "e.weight > f.weight"
  for (Q.push((edge){-2, s, 0}); !Q.empty(); ) {
    edge e = Q.top(); Q.pop();
    if (prev[e.to] != -1) continue;
    prev[e.to] = e.from;
    REP(i,g[e.to].size()){
      edge f = g[e.to][i];
      if (dist[f.to] > e.w+f.w) {
        dist[f.to] = e.w+f.w;
        Q.push((edge){f.from, f.to, e.w+f.w});
      }
    }
  }
}
vector<int> buildPath(const vector<int> &prev, int t) {
  vector<int> path;
  for (int u = t; u >= 0; u = prev[u])
    path.push_back(u);
  reverse(path.begin(), path.end());
  return path;
}

void add_edge(int src,int dst,int w){
  g[src].push_back((edge){src,dst,w});
}

int main(){
  int m;
  cin>>m;
  int a[6];
  REP(i,6) cin>>a[i];
  int s,g;
  cin>>s>>g;
  --s; --g;
  int sgrk[m];
  REP(i,m) cin>>sgrk[i];
  REP(i,m){
    REP(j,6){
      int v = a[j];
      if(i+v < m && 0 <= i+v+sgrk[i+v] && i+v+sgrk[i+v] < m){
        add_edge(i,i+v+sgrk[i+v],1);
      }
      if(i-v >= 0 && 0 <= i-v+sgrk[i-v] && i-v+sgrk[i-v] < m){
        add_edge(i,i-v+sgrk[i-v],1);
      }
    }
  }
  vi dist,prev;
  dijkstra(m,s,dist,prev);
  vi path = buildPath(prev,g);
  int now = s;
  int iter = 1;
  while(now != g){
    int nxt = path[iter];
    int st = nxt-now;
    int cand = 0;
    REP(j,6){
      int v = a[j];
      if(now+v < m && now+v+sgrk[now+v] == nxt){
        cand = v;
        break;
      }
      if(now-v >= 0 && now-v+sgrk[now-v] == nxt){
        cand = -v;
        break;
      }
    }
    while(true){
      int d;
      cin>>d;
      int v = a[d-1];
      if(v==cand){
        cout << 1 << endl;
        break;
      }else if(v==-cand){
        cout << -1 << endl;
        break;
      }else{
        cout << 0 << endl;
      }
    }
    ++iter;
    now = nxt;
  }
  return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>

int main(){
    string akiba = "AKIHABARA";
    int M = akiba.size();
    string s; cin>>s;
    int N = s.size();
    bool ok = false;
    if(N<=M){
        int state = 0;
        REP(i,N){
            char c = s[i];
            if(c==akiba[state]){
                state += 1;
            }else if(state==0 && c=='K'){
                state += 2;
            }else if(state==4 && c=='B'){
                state += 2;
            }else if(state==6 && c=='R'){
                state += 2;
            }else{
                break;
            }
        }
        if(state==M){ ok = true;}
        else if(state==M-1 && s[N-1]=='R'){ ok = true;}
    }
    cout << (ok?LINY:LINN);
    
}

Measured memory_bytes: 256
program megalomania
  implicit none
  integer :: n, i
  integer(8) :: w(200000,2), b(200000), s
  w = 0_8
  read(*,*) n
  do i = 1, n
    read(*,*) w(i,1:2)
  end do
  call merge_sort(w(1:n,1:2))
  s = 0_8
  do i = 1, n
    s = s+w(i,1)
    if (s.gt.w(i,2)) then
      write(*,'(a)') "No"
      stop
    end if
  end do
  write(*,'(a)') "Yes"
  stop
contains
  subroutine merge_sort(c)
    implicit none
    integer(8), intent(inout) :: c(:,:)
    integer :: n, m, l, u, i
    n = size(c(:,1))
    m = n
    l = 1
    do while (m.gt.1)
      do i = 1, m/2
        u = min(2*i*l,n)
        call merger(c(2*(i-1)*l+1:(2*i-1)*l,:),c((2*i-1)*l+1:u,:))
      end do
      l = 2*l
      m = (m+1)/2
    end do
    return
  end subroutine merge_sort
  subroutine merger(c1,c2)
    implicit none
    integer(8), intent(inout) :: c1(:,:), c2(:,:)
    integer(8) :: c(size(c1(:,1))+size(c2(:,1)),size(c2(1,:)))
    integer :: i1, i2, n1, n2
    i1 = 1
    i2 = 1
    n1 = size(c1(:,1))
    n2 = size(c2(:,1))
    do while ((i1.le.n1).and.(i2.le.n2))
      if (c1(i1,2).lt.c2(i2,2)) then
        c(i1+i2-1,:) = c1(i1,:)
        i1 = i1+1
      else if (c1(i1,2).gt.c2(i2,2)) then
        c(i1+i2-1,:) = c2(i2,:)
        i2 = i2+1
      else if (c1(i1,1).lt.c2(i2,1)) then
        c(i1+i2-1,:) = c1(i1,:)
        i1 = i1+1
      else
        c(i1+i2-1,:) = c2(i2,:)
        i2 = i2+1
      end if
    end do
    if (i1.le.n1) then
      c(i1+i2-1:n1+n2,:) = c1(i1:n1,:)
    else if (i2.le.n2) then
      c(i1+i2-1:n1+n2,:) = c2(i2:n2,:)
    end if
    c1 = c(1:n1,:)
    c2 = c(n1+1:n1+n2,:)
    return
  end subroutine merger
end program megalomania

Measured memory_bytes: 7536
#include <queue>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

extern inline char gc() {
    static char RR[23456], *S = RR + 23333, *T = RR + 23333;
    if(S == T) fread(RR, 1, 23333, stdin), S = RR;
    return *S ++;
}
inline int read() {
    int p = 0, w = 1; char c = gc();
    while(c > '9' || c < '0') { if(c == '-') w = -1; c = gc(); }
    while(c >= '0' && c <= '9') p = p * 10 + c - '0', c = gc();
    return p * w;
}

#define sid 200050
#define inf 1e9
#define ri register int

int n;
int bit[sid], l_g[sid];
int st[sid][21][2], v[sid][2], arc[sid];

void Init() {
    for(ri i = 0; i <= 30; i ++) bit[i] = 1 << i;
    for(ri i = 2; i <= n; i ++) l_g[i] = l_g[i >> 1] + 1;
    for(ri o = 0; o <= 1; o ++)
    for(ri i = 1; i <= n; i ++) st[i][0][o] = v[i][o];
    for(ri o = 0; o <= 1; o ++)
    for(ri j = 1; bit[j] <= n; j ++)
    for(ri i = 1; i + bit[j] - 1 <= n; i ++)
    st[i][j][o] = min(st[i][j - 1][o], st[i + bit[j - 1]][j - 1][o]);
}

inline int rmq(int l, int r, int o) {
    int lg = l_g[r - l + 1];
    return min(st[l][lg][o], st[r - bit[lg] + 1][lg][o]);
}

struct Seg {
    int v, l, r;
    friend bool operator < (Seg a, Seg b)
    { return a.v > b.v; }
};
priority_queue <Seg> q;

int main() {
    n = read();
    for(ri i = 1; i <= n; i ++) {
        int w = (v[i][(i ^ 1) & 1] = read());
        v[i][i & 1] = inf; arc[w] = i;
    }
    Init();
    q.push({ rmq(1, n, 0), 1, n });
    while(!q.empty()) {
        Seg tmp = q.top(); q.pop();
        int w1 = tmp.v, pw1 = arc[w1];
        int w2 = rmq(pw1 + 1, tmp.r, pw1 & 1), pw2 = arc[w2];
        printf("%d %d ", w1, w2);
        if(tmp.l != pw1) q.push({ rmq(tmp.l, pw1 - 1, (tmp.l + 1) & 1), tmp.l, pw1 - 1 });
        if(pw1 + 1 != pw2) q.push({ rmq(pw1 + 1, pw2 - 1, pw1 & 1), pw1 + 1, pw2 - 1 });
        if(pw2 != tmp.r) q.push({ rmq(pw2 + 1, tmp.r, pw2 & 1), pw2 + 1, tmp.r });
    }
    return 0;
}

Measured memory_bytes: 38008
import java.io.*;
import java.util.*;
public class Main {
  public static void main(String[] args) throws Exception {
    String line = null;
    long sum = 0;
    int answer = 0;
    ArrayList<Integer> aList = new ArrayList<Integer>();

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    line = br.readLine();
    line = br.readLine();
    String data[] = line.split(" ");
    for (int i = 0; i < data.length; i ++) {
      int num = Integer.parseInt(data[i]);
      aList.add(num);
    }
    Collections.sort(aList);
    for (int i = 0; i < aList.size(); i++) {
      int num = aList.get(i);
      if (2 * sum >= num) {
        answer = answer + 1;
      } else {
        answer = 0;
      }
      sum = sum + num;
    }
    answer = answer + 1;
    System.out.println(answer);
  }
}

Measured memory_bytes: 52052
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i = (ll)(a); i < (ll)(b); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;
int main(){
    ll n,x,d; cin >> n >> x >> d;

    if (d==0){
        if (x==0) cout << 1 << endl;
        else cout << n+1 << endl;
        return 0;
    }
    //k個選ぶ
    map<ll, vector<pair<ll,ll>>> mp;
    rep(k,n+1){
        ll ck= k*x + d*(k-1)*k/2;
        ll rk = (n-1+n-k)*k/2 - (k-1)*k/2;
        ll s = (ck%d+d)%d;
        assert((ck-s)%d==0);
        mp[s].push_back(make_pair((ck-s)/d,rk));
    }
    ll ans = 0;
    for(auto p : mp){
        auto v = p.second;
        vector<pair<ll,ll>> ev;
        for(auto lr: v){
            ev.emplace_back(lr.first,1);
            ev.emplace_back(lr.first+lr.second+1,-1);
        }
        sort(ev.begin(),ev.end());
        ll prev = -INF;
        ll ct = 0;
        for(auto e: ev){
            if(ct>0) ans+=e.first-prev;
            ct+=e.second;
            prev = e.first;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 22144
#include <iostream>                                                             
#include <numeric>                                                              
#include <vector>                                                               
using namespace std;                                                            
                                                                                
int gcd_euclid(int u, int v) {                                                  
  int r;                                                                        
  while (0 != v) {                                                              
    r = u % v;                                                                  
    u = v;                                                                      
    v = r;                                                                      
  }                                                                             
  return u;                                                                     
}                                                                               
                                                                                
int main() {                                                                    
  int N, X;                                                                     
  cin >> N >> X;                                                                
  vector<int> x;                                                                
  int max_x = 0;                                                                
  for (int i = 0; i < N; ++i) {                                                 
    int data = 0;                                                               
    if (scanf("%d", &data) == 1) {                                              
      int tmp_x = abs(X-data);                                                  
      x.push_back(tmp_x);                                                       
      max_x = max(tmp_x, max_x);                                                
    }                                                                           
  }                                                                             
  int ans = gcd_euclid(x[0], x[1]);                                             
  for (int i = 2; i < x.size(); ++i) {                                          
    ans = gcd_euclid(ans, x[i]);                                                
  }                                                                             
  cout << ans << endl;                                                          
  return 0;                                                                     
}   

Measured memory_bytes: 892
#include<iostream>
#include<string>
using namespace std;
int alphabet[100];
bool check = true;
int main() {
	string w;
	cin >> w;
	for (int i = 0; i < 100; i++)alphabet[i] = 1;
	for (int i = 0; i < w.size(); i++) {
		int tmp = w[i] - 'a';
		alphabet[tmp] *= -1;
	}
	for (int i = 0; i < 100; i++){
		if (alphabet[i] == -1)check = false;

	}
	if (check) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> pi;
typedef pair<int,int> vi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i <= b; i++)


int main() {
	ll W;
	ll H;
	cin >> H >> W;
	
	ll sol = 0;
	if(H == 1 || W == 1){
		sol = 1;
	}
	else if(H%2 == 1){
		--H; //6
		sol += W*(H/2); // 9
		++W; // 7
		W /= 2; //3
		sol += W; //12
	}
	else{
		sol += W*H/2;
	}
	cout << sol << "\n";

}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=998244353;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

string sa;
LL dp[333][333][333];
vector<int> v1;

int main(){
	LL n,m;
	int i,j,k;
	LL a,b,c;
	cin>>sa>>m;
	n=sa.size();
	a=0;
	for(i=0;i<n;i++){
		if(sa[i]=='0')v1.push_back(a),a=0;
		else a++;
	}
	v1.push_back(a);
	dp[0][0][0]=1;
	c=0;
	for(i=0;i<v1.size();i++){
		c+=v1[i];
		for(j=0;j<=min(m,n);j++){//dif
			a=0;
			for(k=0;k<=n;k++){//sum
				a+=dp[i][j][k];
				if(a>=MAX)a-=MAX;
				if(k>=v1[i]){
					dp[i+1][j][k]=a;
					a-=dp[i][j][k-v1[i]];
					if(a<0)a+=MAX;
				}
			}
		}
		for(j=-n;j<=n;j++){
			a=0;
			for(k=c-v1[i];k<=n;k++){
				if(j+k<0)continue;
				if(j+k+v1[i]>n)break;
				a+=dp[i][j+k][k];
				if(a>=MAX)a-=MAX;
				dp[i+1][j+k+1][k+v1[i]+1]+=a;
				if(dp[i+1][j+k+1][k+v1[i]+1]>=MAX)dp[i+1][j+k+1][k+v1[i]+1]-=MAX;
			}
		}
	}
	b=v1.size();
	a=0;
	for(i=0;i<=min(m,n);i++){
		a+=dp[b][i][c];
	}
	cout<<a%MAX<<endl;
}

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

class Program {

    static int MX = 6;
    const int wht = 6, gry = 1, blk = 2;
    const long inf = long.MaxValue;

    static List<Edge> edges = null;
    static long[] d = null;




    class Edge {
        public int frm, to, cst;
        public Edge(int pf, int pt, int pc) {
            frm = pf;
            to = pt;
            cst = pc;
        }
        public string prt() {
            return "eg:" + frm.ToString() + "-" + to.ToString() + " " + cst.ToString();
        }
    }


    static bool shortestPath(int src) {

        for (int i = 0; i < MX; i++) {
            d[i] = inf;
        }
        d[src] = 0;

        int cnt = 0;
        bool updated = true;

        while (updated) {
            updated = false;
            foreach (var eg in edges) {
                if (d[eg.frm] != inf && d[eg.to] > d[eg.frm] + eg.cst) {
                    d[eg.to] = d[eg.frm] + eg.cst;
                    updated = true;
                    if (cnt == MX - 1) return false;
                }
            }
            cnt++;
        }
        return true;
    }

    static void Main(string[] args) {
    

        var inp = Console.ReadLine().Split(' ').Select(z => int.Parse(z)).ToArray();
        int v, e; v = inp[0]; e = inp[1];

        int stt = inp[2];

        MX = v;
        edges = new List<Edge>();
        d = new long[MX];


        for (int i = 0; i < e; i++) {
            var c = Console.ReadLine().Split(' ').Select(z => int.Parse(z)).ToArray();

            edges.Add(new Edge(c[0], c[1], c[2]));
        }


        bool ngCyc = false, tmp = false;
        string str = "";

        tmp = shortestPath(stt);
        if (!tmp) {
            ngCyc = true;
        }

        if (ngCyc) Console.WriteLine("NEGATIVE CYCLE");
        else {
            string s = "";
            foreach (var dst in d) {
                if (s.Length > 0) s += " ";
                s = dst == inf ? "INF" : dst.ToString();
                Console.WriteLine(s);
            }

        }

    }
}




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

int lcs(string X, string Y) {
    int m = X.size();
    int n = Y.size();
    int c[m + 1][n + 1];
    c[0][0] = 0;
    for (int i = 1; i <= m; i++) c[i][0] = 0;
    for (int j = 1; j <= n; j++) c[0][j] = 0;

    int max_len = 0;
    for (int i = 1; i <= m; i++) {
        for (int j = 1; j <= n; j++) {
            if (X[i - 1] == Y[j - 1]) {
                c[i][j] = c[i - 1][j - 1] + 1;
            } else {
                c[i][j] = max(c[i - 1][j], c[i][j - 1]);
            }
            max_len = max(max_len, c[i][j]);
        }
    }

    return max_len;
}

int main() {
    int n;
    cin >> n;
    string s1, s2;
    int max_len[n];
    for (int i = 0; i < n; i++) {
        cin >> s1 >> s2;
        max_len[i] = lcs(s1, s2);
    }

    for (int i = 0; i < n; i++) {
        cout << max_len[i] << endl;
    }

    return 0;
}



Measured memory_bytes: 7020
#include<bits/stdc++.h>
using namespace std;
signed main()
{
	int n;
	scanf("%d",&n);
	if(n%2==1)
	{
		printf("%d\n",n*(n-1)/2-(n-1)/2);
		for(int i=1;i<=n;i++)
			for(int j=i+1;j<=n;j++)
				if(i+j!=n)
					printf("%d %d\n",i,j);
	}
	else
	{
		printf("%d\n",n*(n-1)/2-n/2);
		for(int i=1;i<=n;i++)
			for(int j=i+1;j<=n;j++)
				if(i+j!=n+1)
					printf("%d %d\n",i,j);
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,count=0;
    cin >> n;
    
    long long int a[100000]={};
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a,a+100000);
    reverse(a,a+100000);
    for(int i=0;i<n-1;i++){
        if(a[i]==a[i+1]){
            a[i]=0;
            a[i+1]=0;
        }
    }
    for(int i=0;i<n;i++){
        if(a[i]!=0){
            count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define sz(v) (ll((v).size()))
#define forn(i,n) for(ll i=0;i<(n);i++)
#define forr(i,n) for(ll i=(n)-1;i>=0;i--)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))

const ll N =1e5+5;
vector <ll> G[N];
ll vis[N]={0},ans[N]={0},n,m;

void dfs(ll v)
{
	vis[v]=1;
	for(ll i:G[v])if(!vis[i])dfs(i);
	ll mx=0;for(ll i:G[v])mx=max(mx,ans[i]);
	ans[v]=mx+1;
}

int main()
{
    ios_base::sync_with_stdio(false);

    cin>>n>>m;forn(i,m){ll u,v;cin>>u>>v;u--,v--;G[u].pb(v);}
    forn(i,n)if(!vis[i])dfs(i);
    ll mx=0;forn(i,n)mx=max(mx,ans[i]);
    //forn(i,n)cout<<ans[i]<<endl;
    cout<<mx-1<<endl;
}


Measured memory_bytes: 9344
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt(),B=sc.nextInt();
		int ans=0;

		for(int i=0;i<2;i++) {
			if(A>B) {
				ans+=A;
				A-=1;
			}else {
				ans+=B;
				B-=1;
			}
		}
		System.out.println(ans);
	}
}

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

int main()
{
    int H, W, A, B; cin >> H >> W >> A >> B;

    for (int h = 0; h < H; h++) {
        for (int w = 0; w < W; w++) {
            cout << ((h < B && w < A) || (h >= B && w >= A));
        }
        cout << '\n';
    }
    return 0;
}

Measured memory_bytes: 1280
a, b, c, d = map(int,input().split())

if a >= 0 and c >=0:
    print(b*d)
elif b <= 0 and d <= 0:
    print(a*c)
elif a >= 0 and d <= 0:
    print(a*d)
elif b <= 0 and c >= 0:
    print(b*c)
else:
    if a*c > b*d:
        print(a*c)
    else:
        print(b*d)


Measured memory_bytes: 9176
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <time.h>
using namespace std;

void insertSort(int arr[], int n){
    for(int i = 1;i < n;i++){
        int temp = arr[i];
        int j = i-1;
        for(;j>=0;j--){
            if(temp < arr[j]){
                arr[j+1] = arr[j];
            } else {
                break;
            }
        }
        arr[j+1] = temp;

        for(int q = 0;q< n;q++){

            cout<<arr[q];
            if(q != n-1){
                cout<<" ";
            }
        }
        cout<<endl;
    }
}


int main(){
    int n;
    int arr[110];
    cin>>n;
    for (int i = 0; i < n;i++) {
        cin>>arr[i];
    }
    for(int q = 0;q< n;q++){

        cout<<arr[q];
        if(q != n-1){
            cout<<" ";
        }
    }
    cout<<endl;
    insertSort(arr, n);




}

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

typedef class dice {
private:

public:
    int mae;
    int ushiro;
    int migi;
    int hidari;
    int ue;
    int shita;

    dice(int qian, int hou, int zuo, int you, int shang, int xia): mae(qian), ushiro(hou), hidari(zuo), migi(you), ue(shang), shita(xia) {}

    void toEast() {
        int tmp = this->ue;
        this->ue = this->hidari;
        this->hidari = this->shita;
        this->shita = this->migi;
        this->migi = tmp;
    }

    void toWest() {
        int tmp = this->ue;
        this->ue = this->migi;
        this->migi = this->shita;
        this->shita = this->hidari;
        this->hidari = tmp;
    }

    void toNorth() {
        int tmp = this->ushiro;
        this->ushiro = this->ue;
        this->ue = this->mae;
        this->mae = this->shita;
        this->shita = tmp;
    }

    void toSouth() {
        int tmp = this->ushiro;
        this->ushiro = this->shita;
        this->shita = this->mae;
        this->mae = this->ue;
        this->ue = tmp;
    }

    void rotateToRight() {
        int tmp = this->mae;
        this->mae = this->hidari;
        this->hidari = this->ushiro;
        this->ushiro = this->migi;
        this->migi = tmp;
    }

    int getRightSideOnFrtAndTop(int top, int frt) {
        while (this->mae != frt || this->ue != top) {
            for (int i = 0; i < 4; ++i) {
                if (this->mae != frt) {
                    this->rotateToRight();
                }
            }
            for (int i = 0; i < 4; ++i) {
                if (this->ue != top) {
                    this->toWest();
                }
            }
        }

        return this->migi;
    }
}* diceptr;

int main() {
//    freopen("in.txt", "r", stdin);

    int a,b,c,d,e,f;
    int n, frt, bak;

    cin >> a >> b >> c >> d >> e >> f;
    diceptr dice2 = new dice(b, e, d, c, a, f);

    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> frt >> bak;
        cout << dice2->getRightSideOnFrtAndTop(frt, bak) << endl;
    }
}

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

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

    cout<<saidai<<endl;

    return 0;
}

Measured memory_bytes: 256
a = gets.split.map(&:to_i)

if a[1] >= 0
    sum = 0
    b = a[1] + 1
    (a[0] - 1).times do
        sum += b
        b = b + 1
    end
    p sum
    exit
else
    dd = a[1]
    ee = []
    a[0].times do
        ee.push(dd)
        dd += 1
    end
    
    result = ee.sort_by do |i|
        i.abs
    end
    # p result[0]
    #eeからresult[0]を抜く
    ee.delete(result[0])
    p ee.inject(&:+)
    exit
end

Measured memory_bytes: 1788
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  long long ans;
  ans=k*pow(k-1,n-1);
  cout<<ans<<endl;
    
  
  return 0;
}


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

int d, w;
int cap = 0;
int e[10][10];

int hight_of_ike(int sx, int sy, int col, int row) {
    int suii = e[sy][sx];
    for (int y = sy; y <= sy + col; ++y) {
        for (int x = sx; x <= sx + row; ++x) {
            suii = max(suii, e[y][x]);
        }
    }
    return suii;
}

int hight_of_sto(int sx, int sy, int col, int row) {
    int hight = e[sy][sx];
    for (int y = sy; y <= sy + col; ++y) {
        for (int x = sx; x <= sx + row; ++x) {
            if (y > sy && y < sy + col && x > sx && x < sx + row) continue;
            hight = min(hight, e[y][x]);
        }
    }
    return hight;
}

int get_cap(int sto, int sx, int sy, int col, int row) {
    int tmp = 0;
    for (int y = sy; y <= sy + col; ++y) {
        for (int x = sx; x <= sx + row; ++x) {
            tmp += sto - e[y][x];
        }
    }
    return tmp;
}

int main() {
    while(cin >> d >> w, d||w) {
        cap = 0;
        for (int y = 0; y < d; ++y) {
            for (int x = 0; x < w; ++x) {
                cin >> e[y][x];
            }
        }
        for (int sy = 1; sy < d - 1; ++sy) {
            for (int sx = 1; sx < w - 1; ++sx) {
                for (int col = 0; sy + col < d - 1; ++col) {
                    for (int row = 0; sx + row < w - 1; ++row) {
                        int ike = hight_of_ike(sx, sy, col, row);
                        int sto = hight_of_sto(sx-1, sy-1, col+2, row+2);
                        if (sto - ike > 0) {
                            cap = max(cap, get_cap(sto, sx, sy, col, row));
                        }
                    }
                }
            }
        }
        cout << cap << endl;
    }
    return 0;
}


Measured memory_bytes: 3088
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

const int INF = 1e9 + 5;

int main() {
    int n;
    scanf("%d", &n);
    vector<int> h(n);
    for(int& x : h) {
        scanf("%d", &x);
    }
    vector<int> dp(n, INF);
    dp[0] = 0;
    for(int i = 0; i < n; ++i) {
        for(int j : {i + 1, i + 2}) {
            if(j < n) {
                dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
            }
        }
    }
    printf("%d\n", dp[n-1]);
}

Measured memory_bytes: 1024
let analysis area =
  let len = String.length area in
  let stack = Stack.create () in
  let rec loop acc = function
      i when i = len -> acc
    | i ->
      match area.[i] with
      | '\\' -> Stack.push i stack; loop acc (i+1)
      | '/' -> loop
                 (match Stack.is_empty stack with
                    true -> acc
                  | false -> let j = Stack.pop stack in
                    (((j,i),i-j)::acc))
                 (i+1)
      | _ -> loop acc (i+1)
  in loop [] 0
 
let summarize lst =
  let rec loop acc = function
      []  -> acc
    | [x] -> x::acc
    | ((s1,e1),v1)::((s2,e2),v2)::r when s1 < s2 && e1 > e2 ->
      loop acc (((s1,e1), v1+v2)::r)
    | a::(b::r as rest) -> loop (a::acc) rest
  in loop [] lst
 
let () =
  let line = read_line () in
  let count = ref 0 in
  let buf = Buffer.create 128 in
  analysis line |> summarize
  |> List.fold_left
    (fun acc (_,v) ->
       incr count;
       Buffer.add_string buf (Printf.sprintf " %d" v);
       acc+v)
    0
  |> (fun sum -> Printf.printf "%d\n%d%s\n" sum !count (Buffer.contents buf))

Measured memory_bytes: 4020
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
//#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define drep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define Maxe(x) *max_element(all(x))
#define Mine(x) *min_element(all(x))
#define Size(x) ((ll)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
#define Fi first
#define Se second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo
//mint,dijkstra,gyakugen

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll n,k;
        cin>>n>>k;
        ll res=0;
        while(n>0){
            n/=k;
            res++;
        }
        cout<<res<<endl;
    }

Measured memory_bytes: 256
r, c = map(int, input().split())
a = [[int(i) for i in input().split()] for j in range(r)]
b = [[0 for i in range(c+1)] for j in range(r+1)]
for i in range(r):
    for j in range(c):
        b[i][j] = a[i][j]
        b[i][c] += a[i][j]
    
for i in range(c+1):
    for j in range(r):
        b[r][i] += b[j][i]

for i in range(r+1):
    for j in range(c+1):
        if j == c:
            print(b[i][j])
        else:
            print("{0} ".format(b[i][j]), end = "")

Measured memory_bytes: 8196
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ATravelingBudget solver = new ATravelingBudget();
        solver.solve(1, in, out);
        out.close();
    }

    static class ATravelingBudget {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            out.print(Math.min(in.nextInt(), in.nextInt()) + Math.min(in.nextInt(), in.nextInt()));
        }

    }

    static class InputReader implements AutoCloseable {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public void close() {
        }

    }
}



Measured memory_bytes: 21460
#include<bits/stdc++.h>
using namespace std;
int main(){

  long long A;
  long long B;
  long long K;
  cin >> A >> B >> K;
  
  if(A + B <= K){
    cout << "0 0" << endl;
  }
  else{
    if(A <= K){
      cout << "0" << " " << B - (K - A) << endl;
    }
    else{
      cout << A - K << " " << B << endl;
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	int a,r;
	while(true){
		cin>>a>>r;
		if(a==0&&r==0)
			break;
		int h=0,b=0;
		char c[4],d[4];
		c[0]=a/1000+'0';
		c[1]=a/100%10+'0';
		c[2]=a/10%10+'0';
		c[3]=a%10+'0';
		d[0]=r/1000+'0';
		d[1]=r/100%10+'0';
		d[2]=r/10%10+'0';
		d[3]=r%10+'0';
		for(int i=0;i<4;i++){
			for(int j=0;j<4;j++){
				if(c[i]==d[j])
					b++;
			}
		}
		for(int i=0;i<4;i++){
			if(c[i]==d[i])
				h++;
		}
		b-=h;
		cout<<h<<" "<<b<<endl;
	}
    return 0;
}
 

Measured memory_bytes: 1164
N, M, Q = [int(_) for _ in input().split()]
ABCD = [[int(_) for _ in input().split()] for _ in range(Q)]
cand = [[i] for i in list(range(1, M + 1))]
for i in range(N - 1):
    candn = []
    for l in cand:
        j = l[-1]
        candn += [l + [k] for k in range(j, M + 1)]
    cand = candn
ans = 0
for l in cand:
    x = 0
    for a, b, c, d in ABCD:
        if l[b - 1] - l[a - 1] == c:
            x += d
    ans = max([ans, x])
print(ans)


Measured memory_bytes: 107184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	long double cnt=0.0;
	for(ll i=0;i<n;i++){
		long double now;
		cin>>now;
		cnt+=1/now;
	}
	cnt=1/cnt;
	printf("%.9Lf",cnt);
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        r: i32
    }
    println!("{}", r * r)
}


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

struct Q{
    ll x, y, d;
};

ll dx[] = {0, -1, 1, 0};
ll dy[] = {-1, 0, 0, 1};
ll h, w, ans;
bool a[1005][1005];
queue<Q> q;

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
    cin >> h >> w;
    for (int i = 1; i <= h; i++){
        for (int j = 1; j <= w; j++){
            char x;
            cin >> x;
            if (x == '#') a[i][j] = 1, q.push({i, j, 1});
        }
    }
    while (!q.empty()){
        Q u = q.front(); q.pop();
        ans = max(ans, u.d);
        for (int i = 0; i < 4; i++){
            ll xx = u.x + dx[i];
            ll yy = u.y + dy[i];
            if (!a[xx][yy] && xx > 0 && xx <= h && yy > 0 && yy <= w){
                //cout << xx << " " << yy << endl;
                a[xx][yy] = 1;
                q.push({xx, yy, u.d + 1});
            }
        }
        //cout << endl;
    }
    cout << ans - 1;
    return 0;
}


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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef float Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

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

int main() {

  int n; cin >> n;

  while (n--) {

    Real x1,y1,x2,y2,x3,y3,x4,y4;
    cin >> x1 >> y1 >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;

    if ((x1 - x2) * (y3 - y4) == (y1 - y2) * (x3 - x4)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }

  }

  return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
#define F first
#define S second



signed main(){
	int n;
	cin>>n;
	string s;
	cin>>s;

	set<string>A,B,C;

	r(i,n){
		string t="";
		t+=s[i];
		if(A.count(t))continue;
		A.insert(t);

		for(int j=i+1;j<n;j++){
			string tt=t;
			tt+=s[j];
			if(B.count(tt))continue;
			B.insert(tt);

			for(int k=j+1;k<n;k++){
				string ttt=tt;
				ttt+=s[k];
				C.insert(ttt);
			}
		}
	}
	cout<<(int)C.size()<<endl;
}

Measured memory_bytes: 384
# itne me hi thakk gaye?
x, n = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
if x in arr:
    ans = 10**9
    diff = 10**9
    for i in range(0, 102):
        if i not in arr:
            if(abs(x - i) < diff):
                diff = abs(x-i)
                ans = i
    print(ans)
else :
    print(x)

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

using namespace std;

const int MX = 3000000, md = 998244353;

long long inv[MX], f[MX], inv_f[MX];

long long c(int n, int k) {
	if (k == -1) return n == -1 ? 1 : 0;
	
	return f[n] * inv_f[n - k] % md * inv_f[k] % md;
}

int main() {
	inv[1] = f[0] = f[1] = inv_f[0] = inv_f[1] = 1;
	for (int i = 2; i < MX; i++) {
		inv[i] = md - inv[md % i] * (md / i) % md;
		f[i] = f[i - 1] * i % md;
		inv_f[i] = inv_f[i - 1] * inv[i] % md;
	}
	
	int n, m;
	ignore = scanf("%d %d", &n, &m);
	
	int ans = 0;
	for (int k = m % 2; k <= m && k <= n; k += 2) {
		ans = (ans + c(n, k) * c((3 * m - k) / 2 + n - 1, n - 1)) % md;
	}
	
	for (int k = 2 * m + 1; k <= 3 * m; k++) {
		ans = (ans - c(3 * m - k + n - 2, n - 2) * n) % md;
	}
	
	if (ans < 0) ans += md;
	
	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 70528