akhauriyash/Code-Regression huggingface dataset:
// #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <tuple>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repd(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define repdm(i, a, b) for (ll i = (ll)(a); i > (ll)(b); i--)
const ll INF = 1LL << 60;

int N, M;
int k[11];
int p[11];
int ans = 0;
int s[11][11] = {0};

int check(int sws[11])
{
  int on = 0;
  rep(i, M)
  {
    int cnt = 0;
    rep(j, k[i])
    {
      int idx = s[i][j] - 1;
      cnt += sws[idx];
    }
    if (cnt % 2 == p[i])
    {
      on++;
    }
  }

  return on == M ? 1 : 0;
}

void dfs(int depth, int sws[11])
{
  if (depth == 0)
  {
    ans += check(sws);
    return;
  }

  rep(i, 2)
  {
    sws[depth - 1] = i;
    dfs(depth - 1, sws);
  }

  return;
}

int main()
{
  cin >> N >> M;
  rep(i, M)
  {
    cin >> k[i];
    rep(j, k[i]) cin >> s[i][j];
  }
  rep(i, M) cin >> p[i];

  int sws[N] = {0};
  dfs(N, sws);

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;

int main(){
    int h,w;
    cin>>h>>w;
    vector<string> c(h);
    rep(i,h) cin>>c[i];
    rep(i,h){
        rep(l,2) cout<<c[i]<<endl;
    }
    return 0;
}


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

class Point {
public:
  double x, y;

  Point(double _x, double _y) {
    x = _x;
    y = _y;
  }

  Point rotate(double rad) {
    double s = sin(rad);
    double c = cos(rad);
    return Point(c*x - s*y, s*x + c*y);
  }
};

Point operator * (const Point& p, double r) {
  return Point(p.x*r, p.y*r);
}

Point operator * (double r, const Point& p) {
  return p*r;
}

Point operator / (const Point& p, double r) {
  return Point(p.x/r, p.y/r);
}

Point operator + (const Point& p1, const Point& p2) {
  return Point(p1.x + p2.x, p1.y + p2.y);
}

Point operator - (const Point& p1, const Point &p2) {
  return Point(p1.x - p2.x, p1.y - p2.y);
}

const double PI = 4.0 * atan(1.0);
auto rotate60 = bind(&Point::rotate, placeholders::_1, PI / 3.0);

void koch(int n, Point p1, Point p2) {
  if(n == 0) {
    printf("%lf %lf\n", p2.x, p2.y);
    return;
  }

  Point p12 = p2 - p1;
  Point su = rotate60(p12/3.0);
  Point s = p1 + p12 / 3.0;
  Point u = s + su;
  Point t = p1 + p12 * 2.0 / 3.0;

  koch(n-1, p1, s);
  koch(n-1, s, u);
  koch(n-1, u, t);
  koch(n-1, t, p2);
}

int main () {
  int n;
  cin >> n;
  printf("%lf %lf\n", 0.0, 0.0);
  koch(n, Point(0.0, 0.0), Point(100.0, 0.0));
  return 0;
}



Measured memory_bytes: 3340
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
constexpr ll MOD = 998244353;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> l(k), r(k);
  vector<ll> ans(n + 10, 0), sum(n + 10, 0);
  for(int i = 0; i < k; i++) {
    cin >> l[i] >> r[i];
  }
  ans[0] = 1;
  sum[0] = 1;
  for(int i = 1; i < n; i++) {
    for(int j = 0; j < k; j++) {
      if(i - r[j] - 1 >= 0) {
        ans[i] -= sum[i - r[j] - 1];
      }
      if(i - l[j] >= 0) {
        ans[i] += sum[i - l[j]];
      }
    }
    ans[i] %= MOD;
    sum[i] += sum[i - 1] + ans[i];
    // for(int j = 0; j < n; j++) {
    //   cout << ans[j] << " ";
    // }
    // cout << '\n';
  }
  if(ans[n - 1] < 0) {
    ans[n - 1] += MOD;
  }
  cout << ans[n - 1] % MOD << endl;
  return 0;
}

Measured memory_bytes: 6348
N = int(input())
PS = [[int(i) if str.isnumeric(i) else i for i in input().split()] for i in range(N)]
a = 1
for i in PS:
    i.append(a)
    a += 1
PS = sorted(PS, reverse=True)
for i in sorted(PS, key=lambda x: x[0]):
    print(i[2])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long
#define pb                      push_back
#define rep(i,a,b,c)            for(ll i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(ll i=(a);i>=(b);i-=(c))
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
#define mp                      make_pair
#define vpll                    vector<pair<ll,ll> >
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define ln                      cout<<"\n";
#define endl                    "\n"
#define test                    ll T;cin>>T;while(T--)
#define isvowel(a)              (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define show(w,size)            for(ll i=0;i<size;i++) cout<<w[i]<<" ";
#define prll(a)                 cout<<a<<"\n";
#define mset(dp,no)             memset(dp,no,sizeof(dp))
#define input(a,n)              rep(i,0,n-1,1) cin>>a[i];
#define countbit                __builtin_popcount                                           //Number of setbits in decimal notation
#define lb(v,cur)               lower_bound(all(v),cur)-v.begin()
#define ub(v,cur)               upper_bound(all(v),cur)-v.begin()
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
ll pows(ll b,ll e){if(e==0)return 1;else if(e%2==0){ll a=pow(b,e/2);return a*a;}else {ll a=pow(b,e/2);return b*a*a;}}
ll powm(ll x,ll y,ll m){x=x%m;ll res=1;while(y){if(y&1)res=res*x;res%=m;y=y>>1;x=x*x;x%=m;}return res;}
ll modInverse(ll a, ll m=MOD){if(m == 1)return 0;ll m0=m,y=0,x=1;while(a>1){ll q=a/m,t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0) x+=m0;return x;}
int main()
{
fastIO
ll n,m,i,j,k,x,y,z,e,f,p,q,g,l,r,w,h,count1=0,prod=1,a,b,c,d,index,x1,x2,diff,ans=0,sum=0,sum1=0,sum2=0,flag=0,flag1=0,flag2=0;
string s,s1,s2;
cin>>n;
for(i=1;i<=sqrt(n);i++)
{
  if(n%i==0)
  {
  if(i>0&&i<=9&&(n/i)>0&&(n/i)<=9)
  {
    cout<<"Yes\n";
    return 0;
  }
  }
}
cout<<"No\n";
}


Measured memory_bytes: 256
n = int(input())

kumi = []
for i in range(4,100,4):
  for j in range(7,100,7):
    if i+j < 100:
      kumi.append(i+j)
if n % 4 == 0 or n % 7 == 0 or n in kumi:
  print("Yes")
else:
  print("No")

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

vector<int> ans;
vector<int> px;
vector<vector<int>> edges;

void dfs(int i, int v) {
    ans[i] += v;
    edges[i].size();
    for (int j : edges[i]) {
      dfs(j, v + px[j]);
    }
}

int main() {
  int N, Q;
  cin >> N >> Q;
  edges.resize(N);
  px.resize(N);
  ans.resize(N);
  for (int i = 0; i < N-1; i++) {
    int a, b;
    cin >> a >> b;
    edges[a-1].push_back(b-1);
  }
  for (int i = 0; i < Q; i++) {
    int a, b;
    cin >> a >> b;
    px[a-1] += b;
  }
  dfs(0, px[0]);
  for (int i = 0; i < N; i++) {
    cout << ans[i] << " ";
  }
}


Measured memory_bytes: 21120
x, y, z, k = gets.strip.split.map(&:to_i)
a = gets.strip.split.map(&:to_i).sort
b = gets.strip.split.map(&:to_i).sort
c = gets.strip.split.map(&:to_i).sort


ab = a.map {|c_a| b.map {|c_b| c_b + c_a} }.flatten.sort.last(k)
abc = ab.map {|c_ab| c.map {|c_c| c_c + c_ab } }.flatten.sort.last(k).reverse
abc.each do |c_abc|
  p c_abc
end



Measured memory_bytes: 127992
N, Y = list(map(int, input().split()))


resultA = -1
resultB = -1
resultC = -1
for a in range(N+1):
    for b in range(N+1-a):
        c = N - a - b
        if ((10000 * a + 5000 * b + 1000 * c) == Y):
            resultA = a
            resultB = b
            resultC = c

print("{} {} {}".format(resultA, resultB, resultC))


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

int main()
{
    ll n;
    ll c = 0;
    double d;
    cin >> n >> d;
    while (n--)
    {
        ll x, y;
        cin >> x >> y;
        if (sqrt(x * x + y * y) <= d)
        {
            c++;
        }
    }
    cout << c;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
int dp[1005][1005], f1[1005], f2[1005];
int pow2(int a, int b){
    int ans = 1;
    while(b){
        if(b%2 == 1) ans = ans*1ll*a%mod;
        a = a*1ll*a%mod;
        b/=2;
    }
    return ans;
}
int ncr(int a, int b){
    return f1[a]*1ll*f2[b]%mod*f2[a-b]%mod;
}
int main(){
    f1[0] = f2[0] = 1;
    for(int i=1;i<=1000;i++){
        f1[i] = f1[i-1]*1ll*i%mod;
        f2[i] = pow2(f1[i], mod-2);
    }
    int n, a, b, c, d;
    scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);
    for(int j=a-1;j<=b;j++) dp[0][j] = 1;
    for(int i=1;i<=n;i++){
        for(int j=a;j<=b;j++){
            dp[i][j] = (dp[i][j] + dp[i][j-1])%mod;
            if(dp[i-1][j-1] == 0) continue;
            int cnt = 1;
            for(int k=i+j-1;k<=n;k+=j){
                if(c <= cnt && cnt <= d) dp[k][j] = (dp[k][j] + dp[i-1][j-1]*1ll*ncr(n-i+1, cnt*j)%mod*f1[cnt*j]%mod*pow2(f2[j], cnt)%mod*f2[cnt])%mod;
                cnt++;
            }
        }
    }
    printf("%d\n", dp[n][b]);
}

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

using namespace std;

class Dice{
    public:
        Dice(vector<int> num_array)
            : aspect(num_array){
            }
        void roll_Dice(char c){
            if(c == 'S'){
                int temp = aspect[0];
                aspect[0] = aspect[4];
                aspect[4] = aspect[5];
                aspect[5] = aspect[1];
                aspect[1] = temp;
            }else if(c == 'E'){
                int temp = aspect[0];
                aspect[0] = aspect[3];
                aspect[3] = aspect[5];
                aspect[5] = aspect[2];
                aspect[2] = temp;
            }else if(c == 'W'){
                int temp = aspect[0];
                aspect[0] = aspect[2];
                aspect[2] = aspect[5];
                aspect[5] = aspect[3];
                aspect[3] = temp;
            }else if(c == 'N'){
                int temp = aspect[0];
                aspect[0] = aspect[1];
                aspect[1] = aspect[5];
                aspect[5] = aspect[4];
                aspect[4] = temp;
            }
        }
        int print_upper(){
            return aspect[0];
        }
    private:
        vector<int> aspect;
};

int main(){
    
    vector<int> num_array(6);
    string command;
    for(int i=0;i < 6;i++){
        cin >> num_array[i];
    }
    Dice dice1(num_array);

    cin >> command;
    for(int i = 0;i < command.size();i++){
        dice1.roll_Dice(command[i]);
    }
    cout << dice1.print_upper() << "\n";

    return 0;
}
 



Measured memory_bytes: 3196
#AGC009A

n=int(raw_input())
a=[]
b=[]
for i in xrange(n):
 x,y=map(int,raw_input().split())
 a.append(x)
 b.append(y)
add=0
for i in xrange(n-1,-1,-1):
 a[i]+=add
 if a[i]%b[i]!=0:
  add+=b[i]-a[i]%b[i]
print add


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

// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';

#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _

// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i < _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i > _##i; --i)
#define rep(i, n) inc(i, 0, n)
#define be(c) begin(c), end(c)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

// Math
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

int main(){
    int N, M, R;
    cin >> N >> M >> R;
    vector<int> rs(R);
    rep(i, R) {
        int r;
        cin >> r;
        rs[i] = --r;
    }
    //overflow when INF=ULONG_MAX
    vector<vector<ll>> d(N, vector<ll>(N, 1e9));
    rep(i, N) d[i][i] = 0;
    rep(i, M){
        int a, b, t;
        cin >> a >> b >> t;
        --a, --b;
        d[a][b] = t;
        d[b][a] = t;
    }
// warshal_froyd
    rep(k, N){
        rep(i, N){
            rep(j, N){
                d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
            }
        }
    }
    ll ans = 1e9;
    sort(be(rs));
    do {
        ll tans = 0;
        rep(i, R-1) tans += d[rs[i]][rs[i+1]];
        ans = min(ans, tans);
    } while (next_permutation(be(rs)));

    cout << ans << nl;
}


Measured memory_bytes: 640
#ifdef LOCAL
//#define _GLIBCXX_DEBUG
#endif
//#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<char> Vc;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;
typedef vector<vector<char>> VVc;
typedef vector<vector<vector<ll>>> VVV;
typedef vector<vector<vector<vector<ll>>>> VVVV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define rEach(i, mp) for (auto i = mp.rbegin(); i != mp.rend(); ++i)
#ifdef LOCAL
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgset(st) cerr << #st << ":"<<endl; for (auto i = st.begin(); i != st.end(); ++i) { cerr << *i <<" ";}cerr<<endl;
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#else
#define dbg(...)
#define dbgmap(...)
#define dbgset(...)
#define dbgarr(...)
#define dbgdp(...)
#endif
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int solve(){
    string s;
    cin>>s;
    ll n = s.length();
    Vec v(3);
    rep(i,n){
        v[s[i]-'a']++;
    }
    sort(ALL(v));
    YES(v[2]-v[0]<2)
    return  0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);
    solve();
}


Measured memory_bytes: 3780
N = int(input())
if 100<=N<=111:
  print(111)
elif 112<=N<=222:
  print(222)
elif 223<=N<=333:
  print(333)
elif 334<=N<=444:
  print(444)
elif 445<=N<=555:
  print(555)
elif 556<=N<=666:
  print(666)
elif 667<=N<=777:
  print(777)
elif 778<=N<=888:
  print(888)
else:
  print(999)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a[5];
	for(int t=0;t<5;t++)
	{
		cin>>a[t];
		if(a[t]==0)
		{
			cout<<t+1;
			return 0;
		}
	}
} 

Measured memory_bytes: 3444
import sys
import math

#https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

 #ランレングス圧縮
def rle_comp(S):
     rle = []
     chain = 0
     for c in S:
         if c == 'x':
             chain += 1
         else:
            rle.append(chain)
            chain = 0
     rle.append(chain)
 
     #print(rle)
     return rle

s = input()
ans = 0

#xを除外した文字列の生成,回文判定
t = [i for i in s if i != 'x']
t2 = t[::-1]
if t != t2:
    ans = -1

#xを挿入する回数の計算
if ans != -1:
    N = len(t)
    #ランレングス圧縮して 'x' の個数ベクトルを求める
    nums = rle_comp(s)

    for i in range(len(nums)//2):
        #左端と右端の要素をを内側に向けて１つずつ比較していく
        ans += max(nums[i], nums[ len(nums)-1-i]) - min(nums[i], nums[ len(nums)-1-i])

print(ans)



Measured memory_bytes: 11344
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  bool all_neg = true, all_pos = true;
  for (ll i = 0; i < N; ++i) {
    cin >> A.at(i);
    if (A.at(i) < 0) {
      all_pos = false;
    }
    else if(A.at(i) > 0) {
      all_neg = false;
    }
  }
  sort(A.begin(), A.end());
  ll M = 0;
  if (all_pos) {
    M -= A.at(0);
    for (ll i = 1; i < N; ++i) {
      M += A.at(i);
    }
    cout << M << "\n";
    for (ll i = 1; i < N - 1; ++i) {
      cout << A.at(0) << ' ' << A.at(i) << "\n";
      A.at(0) -= A.at(i);
    }
    cout << A.at(N - 1) << ' ' << A.at(0) << "\n";
  }
  else if (all_neg) {
    for (ll i = 0; i < N - 1; ++i) {
      M -= A.at(i);
    }
    M += A.at(N - 1);
    cout << M << "\n";
    for (ll i = 0; i < N - 1; ++i) {
      cout << A.at(N - 1) << ' ' << A.at(i) << "\n";
      A.at(N - 1) -= A.at(i);
    }
  }
  else {
    for (ll i = 0; i < N; ++i) {
      M += abs(A.at(i));
    }
    cout << M << "\n";
    for (ll i = 1; i < N - 1; ++i) {
      if (A.at(i) < 0) {
        cout << A.at(N - 1) << ' ' << A.at(i) << "\n";
        A.at(N - 1) -= A.at(i);
      }
      else {
        cout << A.at(0) << ' ' << A.at(i) << "\n";
        A.at(0) -= A.at(i);
      }
    }
    cout << A.at(N - 1) << ' ' << A.at(0) << "\n";
  }
}


Measured memory_bytes: 3964
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
 
#define N 4
#define LIM 46
 
 
int ans[N][N]={
  {1,2,3,4},
  {5,6,7,8},
  {9,10,11,12},
  {13,14,15,0}};
 
int x[N*N]={3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2},y[N*N]={3,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3};
 
int min = LIM;
 
int main() {
  int i,j;
  int p[N][N];
     
  for(i=0;i<N;i++) {
    for(j=0;j<N;j++) {
      scanf("%d",&p[i][j]);
    }
  }
  dfs(p,p,0);
     
  printf("%d\n",min);
     
  return 0;
}

void dfs(int p[N][N], int pr[N][N], int n) {
  int i,j,i0,j0,d=0;
  int f=0;
  int tmp[N][N];
     
  for(i=0;i<N;i++) {
    for(j=0;j<N;j++) {
      if(ans[i][j]!=p[i][j]) f++;
      if(p[i][j]==0) {
	i0=i;
	j0=j;
      }
      else
	d+=abs(j-x[p[i][j]])+abs(i-y[p[i][j]]);
 
    }
  }
     
  if(f==0) {
    if(min>n) {
      min=n;
    }
    return;
  }
  if(d+n>min) return;
     
     
  if(i0>0 && i0<N) {
    memcpy(tmp,p,sizeof(int)*N*N);
    f=tmp[i0][j0];
    tmp[i0][j0]=tmp[i0-1][j0];
    tmp[i0-1][j0]=f;
    if(memcmp(tmp,pr,sizeof(int)*N*N)!=0)
      dfs(tmp, p, n+1);
  }
  if(j0>0 && j0<N) {
    memcpy(tmp,p,sizeof(int)*N*N);
    f=tmp[i0][j0];
    tmp[i0][j0]=tmp[i0][j0-1];
    tmp[i0][j0-1]=f;
    if(memcmp(tmp,pr,sizeof(int)*N*N)!=0)
      dfs(tmp, p, n+1);
  }
     
  if(i0>=0 && i0<N-1) {
    memcpy(tmp,p,sizeof(int)*N*N);
    f=tmp[i0][j0];
    tmp[i0][j0]=tmp[i0+1][j0];
    tmp[i0+1][j0]=f;
    if(memcmp(tmp,pr,sizeof(int)*N*N)!=0)
      dfs(tmp, p, n+1);
  }
  if(j0>=0 && j0<N-1) {
    memcpy(tmp,p,sizeof(int)*N*N);
    f=tmp[i0][j0];
    tmp[i0][j0]=tmp[i0][j0+1];
    tmp[i0][j0+1]=f;
    if(memcmp(tmp,pr,sizeof(int)*N*N)!=0)
      dfs(tmp, p, n+1);
  }
     
}

Measured memory_bytes: 620
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long inf = 1ll << 61;
const long long mod = 998244353;
typedef pair<int, int> P;
int a[200006], b[200006];
signed main() {
	int n; cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, n) {
		cin >> b[i];
	}
	int cnt1 = 0;
	
	queue<int>V;
	rep(i, n) {
		if (b[i] + b[(i + 2) % n] < b[(i + 1) % n]) {
			V.push((i+1)%n);
		}
	}
	while (V.size()) {
		int p = V.front();
		V.pop();
		int sum = b[(p + n - 1) % n] + b[(p + 1) % n];
		cnt1 += b[p] / sum;
		b[p] %= sum;
		if (b[p] == 0) {
			b[p] += sum;
			cnt1--;
		}
		int x1 = (p + n - 1) % n, x2 = p, x3 = (p + 1) % n;
		int x0 = (p + n - 2) % n, x4 = (p + 2) % n;
		if (b[x0] + b[x2] < b[x1]) {
			V.push(x1);
		}
		if (b[x2] + b[x4] < b[x3]) {
			V.push(x3);
		}
	}

	int cnt2 = 0;

	rep(i, n) {
		if (a[i] + a[(i + 2) % n] < a[(i + 1) % n]) {
			V.push((i + 1) % n);
		}
	}
	while (V.size()) {
		int p = V.front();
		V.pop();
		int sum = a[(p + n - 1) % n] + a[(p + 1) % n];
		cnt2 += a[p] / sum;
		a[p] %= sum;
		if (a[p] == 0) {
			a[p] += sum;
			cnt2--;
		}
		int x1 = (p + n - 1) % n, x2 = p, x3 = (p + 1) % n;
		int x0 = (p + n - 2) % n, x4 = (p + 2) % n;
		if (a[x0] + a[x2] < a[x1]) {
			V.push(x1);
		}
		if (a[x2] + a[x4] < a[x3]) {
			V.push(x3);
		}
	}

	rep(i, n) {
		if (a[i] != b[i]) {
			cout << -1 << endl;
			return 0;
		}
	}

	cout << cnt1-cnt2 << endl;
}

Measured memory_bytes: 4224
INF = 10**18

N,M = map(int,input().split())
C = list(map(int,input().split()))

dp = [INF for _ in range(N+1)]
dp[0] = 0

for i in range(M):
    for j in range(N+1):
        if j-C[i] >= 0:
            dp[j] = min(dp[j],dp[j-C[i]]+1)

print(dp[N])


Measured memory_bytes: 7644
#include<cstdio>
#include<cstring>
const int maxn=100000+5;
int par[maxn];
int find(int x)
{
    if(par[x]==x)
        return x;
    else
        return find(par[x]);
}
int main()
{
    int n,m;
    char str[5];
    int x;
    long long sum;
    while(scanf("%d%d",&n,&m)==2&&m+n!=0)
    {
        par[1]=1;
        for(int i=2;i<=n;i++)
        {
            scanf("%d",&x);
            par[i]=x;
        }
        sum=0;
        while(m--)
        {
            scanf("%s%d",str,&x);
            if(str[0]=='Q')
                sum+=find(x);
            else
                par[x]=x;
        }
        printf("%lld\n",sum);
    }
    return 0;
}



Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>  // std::unique
#include <cmath>
using namespace std;

using ll = long long;
constexpr auto PrimeBigNum10_9_7 = 1000000007;

// 素数判定
template <typename T>
bool IsPrimeNumber(T value) {

	for (int i = 2; i * i <= value; ++i) {
		if ((value % i) == 0) {
			return true;
		}
	}
	return false;
}

// 桁数判定
template <typename T>
T GetFigureLength(T value) {
	T figure = 1;
	while (value >= 10) {
		value /= 10;
		++figure;
	}
	return figure;
}

// 素因数分解結果
template <typename T>
map<T, T> GetPrimeFactorize(T value) {

	map<T, T> res;

	for (T i = 2; i * i <= value; ++i) {
		if ((value%i) != 0)	continue;

		T count = 0;
		while ((value % i) == 0) {
			value /= i;
			++count;
		}

		res[i] = count;
	}

	if (value != 1) {
		res[value] = 1;
	}
	return res;
}

int main(void) {
	ll n, m;
	cin >> n >> m;

	vector<ll> elevations;
	map<ll, vector<ll>> ways;

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

		ways[i] = vector<ll>();
	}

	for (int i = 0; i < m; ++i) {
		ll a, b;
		cin >> a >> b;
		--a;
		--b;

		ways[a].push_back(b);
		ways[b].push_back(a);
	}

	vector<bool> isSkip(n, false);


	ll count = 0;

	for (int i = 0; i < n; ++i) {
		if (isSkip[i])	continue;

		bool isOK = true;
		for (auto itr = ways[i].begin(); itr != ways[i].end(); ++itr) {
			if (elevations[i] <= elevations[*itr]) {
				isOK = false;
			}
			if (elevations[i] >= elevations[*itr]) {
				isSkip[*itr] = true;
			}
		}

		if (isOK) {
			count++;
		}

	}


	auto output = count;
	cout << output;

	return 0;
}

Measured memory_bytes: 15380
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    ll N, K;
    string S;
    cin >> N >> K >> S;

    ll cnt = 1;
    vector<ll> length;
    Rep (i, N) {
        if (S[i] != S[i+1]) {
            length.push_back(cnt);
            cnt = 1;
        } else {
            cnt++;
        }
    }
    if (cnt > 1) length.push_back(cnt);

    // for (ll e : length) {
    //     cout << e << endl;
    // }

    ll ans = N - max((ll)1, (ll)length.size() - 2*K);
    cout << ans << endl;

}

Measured memory_bytes: 1480
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000



int main(){
	
	int N;
	cin>>N;
	
	vector<int> A(N),B(N),C(N-1);
	
	for(int i=0;i<N;i++){
		cin>>A[i];
		A[i]--;
	}
	int ans = 0;
	for(int i=0;i<N;i++){
		cin>>B[i];
		ans += B[i];
	}
	
	for(int i=0;i<N-1;i++)cin>>C[i];
	
	for(int i=0;i<N-1;i++){
		if(A[i+1]-A[i]==1){
			ans += C[A[i]];
		}
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
N,P = map(int,input().split())

# nを因数分解する
# arr = [素因数,個数] のリスト
# n==1 のとき [1,1] となるので注意
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i ==0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

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

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

    return arr

l = factorization(P)
#print(l)
ans = []
for i in range(len(l)):
    if l[i][1] >= N:
        ans.append(l[i][0]**(l[i][1]//N))
if ans:
    k = 1
    for i in ans:
        k *= i
    print(k)
else:
    print(1)

Measured memory_bytes: 62388
#include "bits/stdc++.h"
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;


int main(){
  ll N;
ll K;
cin>>N>>K;
ll ans =0;
ll tmp;
for(ll i=0;i<N;i++){
cin>>tmp;
if(tmp>=K)
ans++;
}



cout<<ans<<endl;
}



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

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

int main() {
    int N; cin >> N;
    long long X; cin >> X;
    long long res = 0;
    for (int i = 0; i < N; ++i) {
        long long x; cin >> x;
        res = GCD(res, abs(x - X));
    }
    cout << res << endl;
}


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

struct Card {char suit, value; };

void bubble(struct Card A[] , int N) {
  for (int i = 0; i<N ;i++){
    for (int j =N-1; j>= i +1; j--){
      if(A[j].value <A[j-1].value){
        Card t = A[j]; A[j] = A[j-1]; A[j-1] =t;
      }
    }
  }
}

void selection(struct Card  A[] , int N){
  for ( int i =0;i<N;i++){
    int minj =i;
    for(int j =i ; j<N ; j++){
      if (A[j].value <A[minj].value) minj =j;
    }
    Card t =A[i]; A[i] =A[minj]; A[minj] = t;
  }
}

void print(struct Card A[], int N){
  for ( int i=0; i<N ;i++){
    if(i >0) cout << " ";
    cout << A[i].suit <<A[i].value;
  }
  cout << endl;
}


bool isStable(struct Card C1[], struct Card C2[],int N){
  for(int i =0; i<N;i++){
    if (C1[i].suit != C2[i].suit) return false;
  }
  return true;
  }

int main (){
  Card C1[100], C2[100];
  int N;
  char ch;

  cin >>N;
  for ( int i =0; i<N; i++){
    cin >> C1[i].suit >> C1[i].value;
  }

  for (int i=0;i<N ; i++) C2[i] = C1[i];

  bubble(C1, N);
  selection(C2,N);

  print(C1,N);
  cout << "Stable" << endl;
  print(C2,N);
  if ( isStable(C1,C2,N)){
    cout << "Stable" <<endl;
  }else{
    cout << "Not stable" << endl;
  }

  return 0;
}

Measured memory_bytes: 3100
/*https://atcoder.jp/contests/dp/tasks/dp_i*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int,pii> pr;
double heads(int n,int req,vector<double> &prob,vector<vector<double>> &dp){
	if(req == 0){
		return 1.00;
	}
	if(n == 0){
		return 0.00;
	}
	if(dp[n][req]!=-1){
		return dp[n][req];
	}
	return dp[n][req] = prob[n-1] * heads(n-1,req-1,prob,dp) + (1-prob[n-1]) * heads(n-1,req,prob,dp);
}
int main(int argc,char const* argv[]){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin>>n;
	vector<double> prob(n);
	for(int i=0;i<n;i++){
		cin>>prob[i];
	}
	double ans = 0.00;
	int majority = n/2;
	majority++;
	vector<vector<double>> dp(n+1,vector<double>(n+1,-1));
	ans = heads(n,majority,prob,dp);
	cout<<fixed<<setprecision(10)<<ans<<endl;
	return 0;
}

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


void solve(std::string S){
    if(regex_match(S, regex("(A[a-z][a-z]*C[a-z]+)")))cout << "AC" << endl;
    else cout << "WA" << endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

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

                int x = values[a];
                values[a] = values[b];
                values[b] = x;
            }
            for(int i=0; i<values.length; i++){
                System.out.println(values[i]);
            }
        }
    }
}



Measured memory_bytes: 26232
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] In = Console.ReadLine().Split(' ');
            int l = int.Parse(In[0]);
            int r = int.Parse(In[1]);
            int d = int.Parse(In[2]);
            int cnt =0;
            for(int i=l; i <= r; i++)
            {
                if (i % d == 0) cnt++;
            }
            Console.WriteLine(cnt);
        }
    }
}


Measured memory_bytes: 27388
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
//#include <chrono> //1e+9で割る auto end= chrono::system_clock::now()-st;  cout<<end.count()%1e+9<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
typedef long double db;

#define fr first
#define sc second
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)

int N;
string s[1000];
bool b;
int main()
{
	cin>>N;
	rep(i,N) cin>>s[i];
	rep(i,N){
		if(s[i][0]=='Y') b=1;
	}
	if(b) puts("Four");
	else puts("Three");
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"

	"math"
	"strconv"
)

func Calc(a, b, c, x int64) int64 {
	if x == 0 {
		return 0
	}

	var cnt int64 = 0
	var amax int64 = a
	// 多すぎても困る
	if x/500 < a {
		amax = int64(math.Floor(float64(x) / 500))
	}
	var amin int64 = 0
	// 100円と50円かき集めても足りないなら最低数が決まる
	if b*100+c*50 < x {
		amin = int64(math.Floor(float64(x-b*100-c*50) / 500))
	}
	var bmax int64 = b
	// 多すぎても困る
	if x/100 < b {
		bmax = int64(math.Floor(float64(x) / 100))
	}
	var bmin int64 = 0
	// 500円と50円かき集めても足りないなら最低数が決まる
	if a*500+c*50 < x {
		bmin = int64(math.Floor(float64(x-a*500-c*50) / 100))
	}
	// 多すぎても困る
	var cmax int64 = c
	if x/50 < c {
		cmax = int64(math.Floor(float64(x) / 50))
	}
	var cmin int64 = 0
	// 500円と100円かき集めても足りないなら最低数が決まる
	if a*500+b*100 < x {
		cmin = int64(math.Floor(float64(x-a*500-b*100) / 50))
	}

	for i := amax; i >= amin; i-- {
		for j := bmax; j >= bmin; j-- {
			for k := cmax; k >= cmin; k-- {
				if i*500+j*100+k*50 == x {
					cnt++
				}
			}
		}
	}

	return cnt
}

func Run(in io.Reader, out io.Writer) error {
	sc := bufio.NewScanner(in)

	sc.Scan()
	a, _ := strconv.ParseInt(sc.Text(), 0, 64)
	sc.Scan()
	b, _ := strconv.ParseInt(sc.Text(), 0, 64)
	sc.Scan()
	c, _ := strconv.ParseInt(sc.Text(), 0, 64)
	sc.Scan()
	x, _ := strconv.ParseInt(sc.Text(), 0, 64)

	cnt := Calc(a, b, c, x)
	fmt.Fprintf(out, "%d\n", cnt)

	return nil
}

func main() {
	err := Run(os.Stdin, os.Stdout)

	if err != nil {
		log.Fatal(err)
	}
}


Measured memory_bytes: 640
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <iomanip>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 2;
const int MOD = 1000000007;
typedef vector<ll> vl;

int main() {
	int N;
	cin >> N;
	vi dp(100010, INF);
	dp[0] = 0;
	REP(i, 100000) {
		dp[i + 1] = min(dp[i + 1], dp[i] + 1);
		for (int j = 1; i + pow(6 , j) <= 100000; j++) {
			dp[i + pow(6, j)] = min(dp[i + pow(6, j)], dp[i] + 1);
		}
		for (int k = 1; i + pow(9, k) <= 100000; k++) {
			dp[i + pow(9, k)] = min(dp[i + pow(9, k)], dp[i] + 1);
		}
	}
	cout << dp[N] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
const ll MOD = 1e9+7;
const ll inf = (LLONG_MAX>>2);
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  if(s == "Sunny") cout << "Cloudy";
  else if(s == "Cloudy") cout << "Rainy";
  else cout << "Sunny";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
#include <set>


using namespace std;
int main(){
    
ios_base::sync_with_stdio(false);
    cin.tie(NULL);   
    
    int n; cin>>n;
    vector <long double> a;
    for (int i=0; i<n; i++)
    {
    	long double temp; cin>>temp;
    	a.push_back(temp);
    }
    
     long double dp[n][n+1]; //dp[ptr][no. of heads]
     
    for (int ptr=0; ptr<n; ptr++)
    {
    	for (int heads=0; heads<n+1; heads++)
    	{
    		dp[ptr][heads]=0.0;
    	}
    }
    
    dp[0][1]=a[0];
    dp[0][0]=1-a[0];
    
    for (int ptr=0; ptr<n-1; ptr++)
    {
    	for (int heads=0; heads<ptr+2; heads++)
    	{
    		dp[ptr+1][heads] += dp[ptr][heads]*(1-a[ptr+1])*1.0;
    		dp[ptr+1][heads+1] += dp[ptr][heads]*(a[ptr+1])*1.0;
    	}
    }
    long double sum=0;
    for (int i=n/2+1; i<n+1; i++)
    {
    	sum+=dp[n-1][i];
    }
    std::cout << std::setprecision(10) << sum << endl;
}

Measured memory_bytes: 140928
import sys
sys.setrecursionlimit(10**9)

N = int(input())
tree = [[] for _ in range(N)]
for i in range(N-1):
    a,b,c = map(int,input().split())
    tree[a-1].append((b-1,c))
    tree[b-1].append((a-1,c))

Q,K = map(int,(input().split()))

dis = [-1]*N
dis[K-1] = 0
def dfs(v,d):
    for i in tree[v]:
        d = dis[v]
        next,c = i
        if dis[next] == -1:
            d += c
            dis[next] = d
            dfs(next,d)
dfs(K-1,0)

for i in range(Q):
    x,y = map(int,(input().split()))
    print(dis[x-1]+dis[y-1])

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

#define fa(x,v) for(auto x:v)
#define f(i,a,b) for(ll i=(ll)a;i<=(ll)b;i++)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define spc " "
#define endl '\n'
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(s) (ll)int(s.length())
#define sz(v) (ll)int(v.size())
#define MOD 1000000007

void Fast_IO() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.in","r",stdin);
    freopen("output.out","w",stdout);
    freopen("debug.out","w",stderr);
    #endif
} 

// Code Here

int main()
{
    // Fast_IO();
    ll n, m, k; cin >> n >> m >> k;
    ll a[n][m];
    f(i,0,n-1) f(j,0,m-1) {
    	char ch; cin >> ch;
    	a[i][j] = (ch == '.' ? 0 : 1);
    }
    ll ans = 0;
    f(rmask,0,(1 << n)-1) f(cmask,0,(1 << m)-1) {
    	ll temp[n][m];
    	f(i,0,n-1) f(j,0,m-1) temp[i][j] = a[i][j];
    	f(i,0,n-1) if(rmask & (1 << i)) {
    		f(j,0,m-1) temp[i][j] = 0;
    	}
    	f(j,0,m-1) if(cmask & (1 << j)) {
    		f(i,0,n-1) temp[i][j] = 0;
    	}
    	ll cc = 0;
    	f(i,0,n-1) f(j,0,m-1) if(temp[i][j]) cc++;
    	if(cc == k) ans++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3608
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
using ll=long long int;
using vi=vector<int>;
using vl=vector<ll>;
using vvi=vector<vi>;
using vvl=vector<ll>;
using vs=vector<string>;
constexpr int INF=1<<30;
constexpr ll INFL=1l<<60;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define RANGE(i,a,b) for(int i=(a);i<=(b);i++)
#define RANGER(i,a,b) for(int i=(b);i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,0,n)

#define EVALe 1

#ifdef EVAL
#define LOG(i) 0
#else
#define LOG(i) cerr<<#i<<": "<<i<<endl
#endif

void solve(){
	int N,M;
	cin>>N>>M;
	cout<<(N==M?"Yes":"No")<<endl;
}

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

Measured memory_bytes: 256
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

template<class T>
bool UpdateMax(T &a, const T &b){
  if(a<b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template<class T>
bool UpdateMin(T &a, const T &b){
  if(a>b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

struct ticket{
      int x,y,c;
    };

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  int a,b,m;
  cin>>a>>b>>m;
  vector<pair<int,int>> fri(a),mic(b);
  for(int i=0;i<a;i++){
    int price;
    cin>>price;
    fri[i]=make_pair(price,i+1);
  }
  for(int i=0;i<b;i++){
    int price;
    cin>>price;
    mic[i]=make_pair(price,i+1);
  }
  vector<ticket> tick(m);
  for(int i=0;i<m;i++){
    int x,y,c;
    cin>>x>>y>>c;
    ticket tic;
    tic.x=x;
    tic.y=y;
    tic.c=c;
    tick[i]=tic;
  }

  int fri_min=INT32_MAX;
  for(auto v:fri){
    UpdateMin(fri_min,v.first);
  }
  int mic_min=INT32_MAX;
  for(auto v:mic){
    UpdateMin(mic_min,v.first);
  }
  int result=fri_min+mic_min;
  for(auto t:tick){
    int price=fri[t.x-1].first+mic[t.y-1].first-t.c;
    UpdateMin(result,price);
  }
  cout<<result<<endl;


  return 0;
}




Measured memory_bytes: 2944
//Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<ll,ll>&a,const pair<ll,ll>&b)
{
    return (a.second<b.second);
}
int main()
{
    ios;
    int n;
    cin>>n;
    int a[n],f=1,m=0;
    for(int i=0;i<n;i++)
        {
            cin>>a[i];
            m=max(a[i],m);
            if(a[i]<m-1)
                f=0;
        }

    if(f)
        cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;



}
//Alhamdulillah



















Measured memory_bytes: 3972
s=input()
cnt=len(s)-1
ans=0
for i in range(2**cnt):
    sum=s[0]
    for j in range(cnt):
        if ((i>>j)&1):
            sum+="+"
        else:
            pass
        sum+=s[j+1]
    ans+=eval(sum)
print(ans)
            


Measured memory_bytes: 2940
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a == b){
            System.out.println("Draw");
        } else if(a == 1){
            System.out.println("Alice");
        } else if(b == 1){
            System.out.println("Bob");
        } else if(a > b){
            System.out.println("Alice");
        } else {
            System.out.println("Bob");
        }
    }
}

Measured memory_bytes: 21588
#include<stdio.h>

int main(void){
    long x;
    scanf("%ld",&x);
    for(long long i = -120;i < 121;i++){
	for(long long j = -120;j < 121;j++){
		if(i*i*i*i*i - j*j*j*j*j == x){
		    printf("%lld %lld",i,j);
		    return 0;
		}

	}
    }
}


Measured memory_bytes: 1708
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }

const ll INF=1e18;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    string s,t;
    cin>>s>>t;
    queue<char> que;
    rep(i,t.size()){
        que.push(s[i]);
        que.push(t[i]);
    }
    if(s.size()!=t.size()) que.push(s[s.size()-1]);
    while(!que.empty()){
        cout<<que.front();
        que.pop();
    }
    cout<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
{
    ・全探索できるなら全探索しろ
    ・異常な制約ならそこに注目
}
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'¥n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え('='でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
*/

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int a, b, c;
	set<int> s;
	cin >> a >> b >> c;
	s.insert(a);
	s.insert(b);
	s.insert(c);
	cout << (int)s.size();
}

Measured memory_bytes: 256
function Main(input) {
    var S = input.split("\n")[0];
    var len = S.length;
    var min = Number.MAX_VALUE;
    for (var n = 0; n < len - 3 + 1; n++) {
        var x = S.substr(n, 3) - 0;
        min = Math.min(min, Math.abs(753 - x));
    }

    console.log(min);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

vector<int> G[100005];
int dist[2][100005];

int ans = 0;

void dfs(int parent, int cur, int idx) {
  for(auto nx : G[cur]){
    if(nx == parent) continue;
    dist[idx][nx] = dist[idx][cur] + 1;
    dfs(cur, nx, idx);
  }
}

void dfs2(int parent, int cur) {
  if (dist[0][cur]<dist[1][cur]){
    ans = max(ans, dist[1][cur]-1);
  }
  for(auto nx : G[cur]){
    if(nx == parent) continue;
    if (dist[0][nx]<dist[1][nx]){
      dfs2(cur, nx);
    }
  }
}

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  int n;cin>>n;
  int u,v;cin>>u>>v;u--,v--;
  for(int i=0;i<n-1;i++){
    int a,b;cin>>a>>b;a--,b--;
    G[a].push_back(b);G[b].push_back(a);
  }

  dfs(u, u, 0);
  dfs(v, v, 1);
  dfs2(u, u);
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 13184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
void read(int& x){ scanf("%d",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back

int n;
int a[100010];
int l[100010];

int main()
{
#ifdef NAMSEO
	freopen("in", "r", stdin);
#endif
	
    read(n);
    int lm = 0;
    const ll M=int(1e9)+7;
    ll ans = 1;
    for(int i=1; i<=n; ++i){
		read(a[i]);
		l[i] = lm;
		ans *= (i-lm);
		ans %= M;
		lm = max(lm, i - (a[i]+1)/2);
    }
    
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	int D;
	double E;
	while (cin>>D>>E,D) {
		double ans = 1e9;
		REP(i, D / 2 + 1) {
			ans = min(ans, abs(hypot(i, D - i)-E));
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3276