akhauriyash/Code-Regression huggingface dataset:
//
// Created on 2020/04/04.
//

//#include <bits/stdc++.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    string ans = "Yes";
    int n;
    double m;
    double all = 0;
    cin>>n>>m;
    vector<double >A(n);
    for (ll i = 0; i < n; ++i) {
        cin>>A[i];
        all += A[i];

    }
    sort(all(A));
    reverse(all(A));
    for (ll j = 0; j < m; ++j) {
        if(A[j] < (all/(4*m))){
            ans = "No";
            break;
        }
    }

    cout<<ans<<endl;
}


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

using namespace std;
typedef long long ll;

int main(){
    ll s;
    cin >> s;
    vector<bool> num(1000001, false);
    num.at(s) = 0;
    for(ll i = 0;; ++i){
        if(num.at(s)){
            cout << i + 1 << endl;
            break;
        }
        num.at(s) = true;
        if(s % 2 == 0){
            s /= 2;
        }else{
            s = 3 * s + 1;
        }
    }
    return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

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

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;
    ll N;
    cin >> N;
    vector<string> S(N);
    rep(i, N) cin >> S[i];

    vector<ll> cnt(4, 0);

    rep(i, N) {
        if (S[i] == "AC")
            cnt[0]++;
        else if (S[i] == "WA")
            cnt[1]++;
        else if (S[i] == "TLE")
            cnt[2]++;
        else if (S[i] == "RE")
            cnt[3]++;
    }

    cout << "AC x " << cnt[0] << endl;
    cout << "WA x " << cnt[1] << endl;
    cout << "TLE x " << cnt[2] << endl;
    cout << "RE x " << cnt[3] << endl;

    return 0;
}

Measured memory_bytes: 6364
import java.util.Scanner;

class Main {
    public static void main(String[] args){
    	Scanner in = new Scanner(System.in);
    	StringBuilder sb = new StringBuilder();
    	while(in.hasNextLine()) {
    		int a = in.nextInt();
    		int b = in.nextInt();
    		if (a == b) {
    			if(a == 0) {
    				break;
    			}
    			sb.append(a).append(" ").append(b).append("\n");
    		} else if(a < b){
    			sb.append(a).append(" ").append(b).append("\n");
    		} else {
    			sb.append(b).append(" ").append(a).append("\n");
    		}
    	}
    	System.out.print(sb.toString());
    }
}

Measured memory_bytes: 31204
#include<stdio.h>
#include<string.h>
int main(){
    char a[11];
    char b[11];
    char c[11];
    scanf("%s",a);
    scanf("%s",b);
    int m,n;
    scanf("%d%d",&m,&n);
    scanf("%s",c);
    if(strcmp(a,c)==0){
        printf("%d %d",m-1,n);
    }
    else
    {
        printf("%d %d",m,n-1);
    }
    

}

Measured memory_bytes: 1696
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define ld long double
#define pld pair<ld,ld>
#define lg length()
#define sz size()
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pi>
#define vpl vector<pl>
#define pb push_back
#define INF 1000000005
#define LINF 1000000000000000005

ll n,k,x,cnt[45],t1,t2=-LINF;

int32_t main(int argc, char* argv[]){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
#ifdef LOCAL_DEFINE
    ifstream cin("input.in");
#endif
    cin >> n >> k;
    for(int i=1;i<=n;i++){
        cin >> x;
        for(int j=0;j<=40;j++){
            if(x&(1ll<<j)) cnt[j]++;
        }
    }
    for(int i=40;i>=0;i--){
        if(cnt[i]>=n-cnt[i]) t2+=cnt[i]*(1ll<<i);
        else t2+=(n-cnt[i])*(1ll<<i);
        if(k&(1ll<<i)) t2=max(t2,t1+cnt[i]*(1ll<<i)),t1+=(n-cnt[i])*(1ll<<i);
        else t1+=cnt[i]*(1ll<<i);
    }
    cout << max(t1,t2);
}


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

typedef long long ll;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> k(M), p(M);
    vector<vector<int>> s(M, vector<int>(0));
    rep(i, M) {
        cin >> k[i];
        rep(j, k[i]) {
            s[i].push_back(0);
            cin >> s[i][j];
            s[i][j]--;
        }
    }
    rep(i, M) cin >> p[i];
    int ans = 0;
    rep(i, 1 << N) {
        bool f = true;
        rep(j, M) {
            int t = 0;
            rep(l, k[j]) {
                if ((i >> s[j][l]) & 1) t++;
            }
            if (t % 2 != p[j]) f = false;
        }
        if (f) ans++;
    }
    cout << ans << endl;
}

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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

    ll N, x[6];
    cin >> N;
    rep(i, 5) cin >> x[i];

    ll y = 1e16;
    rep(i, 5) y = min(y, (ll)x[i]);

    if(y < N){
        long double p = (long double)(N-y)/y;

        ll q = (long double)p+(long double)0.9;

        cout << (ll)5 + q << endl;
    }else{
        cout << 5 << endl;
    }



    return 0;
}

Measured memory_bytes: 256
import math


def combi(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


n, k = map(int, input().split())
div_num = 10 ** 9 + 7
for i in range(1, k + 1):
    if n - k + 1 >= i:
        print(combi(n - k + 1, i) * combi(k - 1, i - 1) % div_num)
    else:
        print(0)


Measured memory_bytes: 3316
N,A,B=map(int,input().split())
 
Alltotal=0
for i in range(1,N+1):
  partTotal=0
  temp=i
  while temp!=0:
    partTotal+=temp%10
    temp=temp//10
    
  if A<=partTotal and partTotal<=B:
    Alltotal+=i
    #print(i)
print(Alltotal)

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

using namespace std;

#define MAXN 200004

vector<int> g[MAXN];
int d[MAXN];
bool visited[MAXN];

void bfs(int node){
  visited[node] = true;
  d[node] = 0;
  queue<int> q;
  q.push(node);
  while(!q.empty()){
    int actual = q.front(); q.pop();
    for(int i=0;i<g[actual].size();++i){
      int nextNode = g[actual][i];
      if(!visited[nextNode]){
	d[nextNode] = d[actual] + 1;
	q.push(nextNode);
      }
    }
  }
}

main(){
  int vertex, edges;
  scanf("%d %d",&vertex,&edges);
  int from, to;
  for(int i=0;i<edges;++i){
    scanf("%d %d",&from,&to);
    g[from].push_back(to);
  }
  for(int i=1;i<=vertex;++i){
    visited[i] = false;
    d[i] = -1;
  }
  bfs(1);
  if(d[vertex]<=2 and d[vertex]!=-1) printf("POSSIBLE\n");
  else printf("IMPOSSIBLE\n");
}


Measured memory_bytes: 9848
#include <bits/stdc++.h>
using namespace std;
#define rep(i,e) for(int i= 0; i< (int)(e); i++)
#define reps(i,s,e) for(int i = s; i < (int)(e); i++)
#define repr(i,s,e) for(int i = s; i > (int)(e); i--)
typedef long long ll;
long bigp = 1000000007;


int main(){
	int n,m;
	cin >> n >> m;
	vector<int> l(m),r(m);
	rep(i,m){
		cin >> l[i] >> r[i];
	}
	int a = *max_element(l.begin(),l.end());
	int b = *min_element(r.begin(),r.end());
	cout << max(0,b-a+1);
}

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

#define rep(X,Y) for(int (X) = 0; (X) < (Y); ++(X))
typedef long long ll;
typedef pair<int, int> pii;

#define all(X) (X).begin(),(X).end()
#define pb push_back
#define eb emplace_back
#define rrep(X,Y) for(int (X)=(Y)-1; (X) >= 0; --(X))
#define X first
#define Y second
#define reps(X,Y,Z) for(int (X)=(Y); (X) <= (Z); ++(X))
#define sz size()
#define in(i,j,k) ((i) >= (j) && (j) <= (k))

#define UNIQUE(X) (X).erase(unique(all(X)), (X).end())

int main(){
    int n;
    while(cin >> n&&n){
        vector<pair<pii,pii > > v;
        rep(i,n){
            int id,u,a,p;
            cin >> id >> u >> a >> p;
            v.eb(pii(-a,p),pii(id,u));
        }
        sort(all(v));
        map<int,int> m;
        vector<int> ans;
        rep(i,n){
            if( ans.sz < 10 && m[v[i].Y.Y] < 3 ||
                ans.sz < 20 && m[v[i].Y.Y] < 2 ||
                ans.sz < 26 && m[v[i].Y.Y] < 1 )
            {
                m[v[i].Y.Y]++;
                ans.pb(v[i].Y.X);
            }
        }
        rep(i,ans.sz){
            cout << ans[i] << endl;
        }
    }
    return 0;
}

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

ll x[100005];

int main(){
	
	int n,k;
	scanf("%d%d",&n,&k);
	
	for (int i=0;i<n;i++){
		scanf("%lld",&x[i]);
	}
	
	ll ans=2000000000;
	
	for (int i=0;i<n-k+1;i++){
		ll temp=0;
		if (x[i]*x[i+k-1]<0) temp=max(-x[i],min(2*-x[i]+x[i+k-1],-x[i]+2*x[i+k-1]));
		else temp=max(abs(x[i+k-1]),abs(x[i]) );
		ans=min(ans,temp);
	}
	
	
	cout<<ans<<endl;
	
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
using namespace std;
#define N 100001
const int mod=1e9+7;
int a[N],inv[N];
int Pow(int p,int q)
{
    int s=1;
    for(;q;q>>=1,p=1LL*p*p%mod)
        if(q&1) s=1LL*s*p%mod;
    return s;
}
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;++i) scanf("%d",&a[i]);
    sort(a+1,a+n+1);
    for(int i=1;i<=n;++i) inv[i]=Pow(i,mod-2); 
    long long p=1,ans=a[k];
    for(int i=k+1;i<=n;++i)
    {
         p=p*(i-1)%mod;
         p=p*inv[i-k]%mod;
         ans=(ans+a[i]*p%mod)%mod;
    }
    ans-=a[n-k+1];
    p=1;
    for(int i=k+1;i<=n;++i)
    {
         p=p*(i-1)%mod;
         p=p*inv[i-k]%mod;
         ans=(ans-a[n-i+1]*p%mod)%mod;
    }
    if(ans<0) ans+=mod;
    printf("%d",ans);
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define bit(k) (1LL<<(k))
typedef long long ll;

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

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;
const double PI = acos(-1.0);

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

/*------------------------------------/
for library*/

/*------------------------------------*/

int main() {

    ll N,K,S;
    cin>>N>>K>>S;
    vector<int> A(N,S);
    if(N == K){
        rep(i,N){
            cout<<A[i]<<endl;
        }
        return 0;
    }
    if(S == 1){
        rep(i,K){
            cout<<1<<endl;
        }
        rep(i,N-K){
            cout<<min(S+1,(ll)1e9)<<endl;
        }
        return 0;
    }
    ll a = S/2;
    ll b = S - a;
    rep(i,N){
        if(i < K+1){
            if(i % 2 == 0)cout<<a<<endl;
            else cout<<b<<endl;
        }
        else{
            if(S == 1e9){
                cout<<5<<endl;
            }
            else{
                cout<<min(S+1,(ll)1e9)<<endl;
            }
        }
    }
    /*
    rep(i,K+1){
        if(i%2 == 0){
            A[i] = a;
        }
        else A[i] = b;
    }
    for(int i = K+1;i<N;i++){
        A[i] = min(S+1,(ll)1e9);
    }
    rep(i,N){
        cout<<A[i]<<endl;
    }
    */
}

Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <algorithm>

#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

using namespace std;

typedef long long int lli;

int main () {
    lli N;
    cin >> N;
    REP (h, 1, 3501) REP (n, 1, 3501) {
        lli bot = 4 * h * n - N * (n + h);
        if (bot <= 0) continue;
        lli up = N * h * n;
        if (up % bot) continue;
        lli w = up / bot;
        if (w > 3501) continue;
        cout << h << ' ' << n << ' ' << w << endl;
        return 0;
    }
    return 0;
}


Measured memory_bytes: 256
class UnionFind
  def initialize(size)
    @rank = Array.new(size, 0)
    @parent = Array.new(size, &:itself)
  end

  def unite(id_x, id_y)
    x_parent = get_parent(id_x)
    y_parent = get_parent(id_y)
    return if x_parent == y_parent

    if @rank[x_parent] > @rank[y_parent]
      @parent[y_parent] = x_parent
    else
      @parent[x_parent] = y_parent
      @rank[y_parent] += 1 if @rank[x_parent] == @rank[y_parent]
    end
  end

  def get_parent(id_x)
    @parent[id_x] == id_x ? id_x : (@parent[id_x] = get_parent(@parent[id_x]))
  end

  def same_parent?(id_x, id_y)
    get_parent(id_x) == get_parent(id_y)
  end
end

N,M=gets.split.map(&:to_i)

ps=gets.split.map(&:to_i)

uf=UnionFind.new(N)

M.times do
  x,y=gets.split.map(&:to_i)
  x-=1
  y-=1
  uf.unite(x,y)
end


sets=Hash.new
sets_counts=Hash.new(0)
N.times do |i|
  par=uf.get_parent(i)
  sets[par] ||= Hash.new
  sets[par][i]=1
  sets[par][ps[i]-1]=1
  sets_counts[par]+=1
end

ans=0
sets.each do |id,elems|
  ans+=sets_counts[id]*2-elems.size
end

puts ans

Measured memory_bytes: 46348
N = int(input())
A = list(map(int,input().split()))

#print(A)

def getSign(a):
	if a < 0:
		return -1
	elif a == 0:
		return 0
	else:
		return 1

counts = []
for beforeSign in [-1,1]:
	count = 0
	sumN = 0
	for i in range(N):
		sumN += A[i]

		#print("be",i,sumN,A[i],count,beforeSign)

		if 0 <= beforeSign * sumN:
			add = -sumN - beforeSign
			sumN += add
			count += abs(add)
		
		beforeSign = getSign(sumN)
		#print("af",i,sumN,A[i],count,beforeSign)
	
	counts.append(count)
	
print(min(counts))

Measured memory_bytes: 14332
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<map>
#include<unordered_map>
#include<queue>
#include<deque>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int sum = a+b+c;
    if(sum >= 22)cout << "bust";
    else cout << "win";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
using ll = long long;
using VI = vector<int>;

int main(){
  int n;cin >> n;
  vector<int> a(n);
  for(auto &i:a) cin >> i;
  reverse(a.begin(),a.end());
  int count = 0;
  int ans = 0;
  for(int i=0;i<n;i++){
    if(a[i+1]>=a[i]) count++;
    else{
      ans = max(ans,count);
      count = 0;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <set>
#include <map>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e933
#define INFL 1e18
#define MOD 1e9+7
#define pb push_back
#define MP make_pair
typedef long long int ll;
typedef std::pair<int,int> pii;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int temp[3]={1,5,10};

using namespace std;

int main() {
    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    int x=a+b*5+c*10+50*d+100*e+500*f;
    if(x>=1000)cout<<true<<endl;
    else cout<<false<<endl;
    return 0;
}



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

int main(){
  int N,sum;
  sum=0;
  cin >>N;
  int L[N];
  for(int i=0;i<N;i++){
    cin >>L[i];
    sum += L[i];
  }
  int flag;
  flag=1;
  for(int i=0;i<N;i++){
    if(sum-L[i]<=L[i]){
      flag=0;
    }
  }
  if(flag==1){
    cout<<"Yes";
  }
  else{
     cout<<"No";
  }
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n = int(input())
a = [int(x) for x in input().split()]

mean = sum(a) / n

ans = [200, 200]

for i in range(n):
    if abs(mean - a[i]) < ans[1]:
        ans = [i, abs(mean - a[i])]

print(ans[0])

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

int main(void) {
    int64_t N,M,A,B,C;
    int64_t remains;
    int64_t sum;

    cin >> N >> M;

    map<int64_t,int64_t,greater<int64_t>> mp;
    for(int64_t i=0;i<N;i++) {
        cin >> A;
        mp[A]++;
    }

    for(int64_t i=0;i<M;i++) {
        cin >> B >> C;
        mp[C] += B;
    }

    remains = N;
    sum = 0;
    for(map<int64_t,int64_t,greater<int64_t>>::iterator it=mp.begin();it!= mp.end();it++)  {
        if(remains > it->second) {
            sum += (it->first * it->second);
            remains -= it->second;
        } else {
            sum += (it->first * remains);
            break;
        }
    }
    
    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 12800
using System;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(solver() ? "Yes" : "No");
        }
        static bool solver()
        {
            var abc = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            var a = abc[0]; var b = abc[1]; var c = abc[2];
            if (a + b > c) return false;
            return (c - (a + b)) * (c - (a + b)) > 4 * a * b;
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define MAX 10e9

int main() {
  int n, i, a, count = 0;
  map<ll, ll> mp;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a;
    mp[a]++;
  }
  for (auto p : mp) {
    if (p.second % 2 == 1) {
      count++;
    }
  }
  cout << count << "\n";
  return 0;
}

Measured memory_bytes: 6528
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	n := len(s)
	ng := 0
	for _, r := range s {
		if r == 'g' {
			ng++
		}
	}
	fmt.Println(ng - ((n + 1) / 2))
}


Measured memory_bytes: 1280
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 998244353;
const ll INF = 1e18;
const int MX = 100001;

namespace ModOp {
    ll po (ll b, ll p) { return !p?1:po(b*b%MOD,p/2)*(p&1?b:1)%MOD; }
    ll inv (ll b) { return po(b,MOD-2); }
    
    int ad(int a, int b) { return (a+b)%MOD; }
    int sub(int a, int b) { return (a-b+MOD)%MOD; }
    int mul(int a, int b) { return (ll)a*b%MOD; }
    
    int AD(int& a, int b) { return a = ad(a,b); }
    int SUB(int& a, int b) { return a = sub(a,b); }
    int MUL(int& a, int b) { return a = mul(a,b); }
}

using namespace ModOp;

void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }


int K,N;

int comb[4001][4001], po2[4001];

int getComb(int a, int b) {
    if (a < b || b < 0) return 0;
    return comb[a][b];
}

void io(string s = "") {
    ios_base::sync_with_stdio(0); cin.tie(0);
    if (sz(s)) {
    	setIn(s+".in");
    	setOut(s+".out");
    }
}

int solve(int x) {
    int a = 0, b = 0, c = 0;
    FOR(j,1,K+1) 
        if (x-j >= 1 && x-j <= K) {
            if (2*j == x) {
                c ++;
            } else {
                a ++;
            }
        } else b ++;
        
    a /= 2;
    // cout << a << " " << b << " " << c << "\n";
    int ans = 0;
    F0R(i,a+1) F0R(j,c+1) AD(ans,mul(getComb(a,i),mul(po2[i],getComb((N-i-j)+(i+b-1),i+b-1))));
    return ans;
}

int main() {
    io();
    po2[0] = 1; FOR(i,1,4001) po2[i] = mul(2,po2[i-1]);
    comb[0][0] = 1;
    FOR(i,1,4001) {
        F0R(j,i+1) {
            comb[i][j] = comb[i-1][j];
            if (j) AD(comb[i][j],comb[i-1][j-1]);
        }
    }
    cin >> K >> N;
    FOR(i,2,2*K+1) cout << solve(i) << "\n";
    // K choose x * 2^x * stuff
}

/* 
* (Actually read this pls)
    * Rlly bad errors: int overflow, array bounds
    * Less bad errors: special cases (n=1?), set tle
    * Common sense: do smth instead of nothing
*/

Measured memory_bytes: 61312
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		sc.close();
		
		boolean flag = true;
		Map<Character, Character> map = new HashMap<>();
		Map<Character, Integer> sMap = new HashMap<>();
		Map<Character, Integer> tMap = new HashMap<>();
		for(int i = 0;i < S.length();++i) {
			if(map.containsKey(S.charAt(i))) {
				if(map.get(S.charAt(i)) != T.charAt(i)) {
					flag = false;
					break;
				}
			} else {
				map.put(S.charAt(i), T.charAt(i));
			}
			if(sMap.containsKey(S.charAt(i)))
				sMap.put(S.charAt(i), sMap.get(S.charAt(i)) + 1);
			else
				sMap.put(S.charAt(i), 1);
			if(tMap.containsKey(T.charAt(i)))
				tMap.put(T.charAt(i), tMap.get(T.charAt(i)) + 1);
			else
				tMap.put(T.charAt(i), 1);
		}
		if(flag) {
			if(sMap.size() != tMap.size()) {
				flag = false;
			} else {
				int size = sMap.size();
				int[] sQty = new int[size];
				int[] tQty = new int[size];
				Character[] sKeyset = new Character[size];
				sMap.keySet().toArray(sKeyset);
				Character[] tKeyset = new Character[size];
				tMap.keySet().toArray(tKeyset);
				for(int i = 0;i < size;++i) {
					sQty[i] = sMap.get(sKeyset[i]);
					tQty[i] = tMap.get(tKeyset[i]);
				}
				Arrays.sort(sQty);
				Arrays.sort(tQty);
				if(!Arrays.equals(sQty, tQty)) {
					flag = false;
				}
			}
		}
		
		if(flag)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}


Measured memory_bytes: 34720
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
    if i != n // i:
      divisors.append(n//i)

  divisors.sort(reverse=True)
  return divisors

N,K = II()
A = III()

sumA = sum(A)
kouho = make_divisors(sumA)

for i in kouho:
  if sumA%i != 0:
    continue
  r = [0]*N
  for j in range(N):
    r[j] = A[j]%i
  sumr = sum(r)
  if sumr%i != 0:
    continue
  r.sort(reverse=True)
  num = 0
  for k in range(sumr//i):
    num += i-r[k]
  if num <= K:
    print(i)
    exit()

Measured memory_bytes: 42860
X,K,D=map(int,input().split())
if X<0:
    X=-X
if X >= K*D :
    print(X-K*D)
else: #通りすぎる
    C=X-D*(X//D) #最寄りかつ通り越していない１回は残っている
    A=K-(X//D) #残りの移動回数
    if A%2==0:
        print(C)
    else:
        print(D-C)

Measured memory_bytes: 9172
import java.util.*;

public class Main{
    Scanner in = new Scanner(System.in);

    void solve(){
        int n = in.nextInt();
        while(n != 0){
            int[][] a = new int[n][n];
            for(int i = 0; i < n; i++){
                for(int j = 0; j < n; j++){
                    a[i][j] = in.nextInt();
                }
            }
            int[] cSum = new int[n];
            for(int i = 0; i < n; i++){
                int rSum = 0;
                for(int j = 0; j < n; j++){
                    rSum += a[i][j];
                    cSum[j] += a[i][j];
                    System.out.printf("%5d", a[i][j]);
                }
                System.out.printf("%5d\n", rSum);
            }
            int sum = 0;
            for(int i = 0; i < n; i++){
                sum += cSum[i];
                System.out.printf("%5d", cSum[i]);
            }
            System.out.printf("%5d\n", sum);
            n = in.nextInt();
        }
    }
    
    public static void main(String[] args){
        new Main().solve();    
    }
}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
}

int ans = 0;
bool check = 0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{
  int a, b, c, n, x, y;
  x = 0, y = 0;
  cin >> a >> b;
  int g[4] = {4, 6, 9, 11};
  int k[7] = {1, 3, 5, 7, 8, 10, 12};
  if (a == 2 || b == 2)
    No();
  else
  {
    rep(i, 4) if (a == g[i] || b == g[i]) x++;
    rep(i, 7) if (a == k[i] || b == k[i]) y++;
    if (x == 2 || y == 2)
      Yes();
    else
      No();
  }
  return 0;
}

Measured memory_bytes: 3632
def resolve():
    (N, K) = list(map(int, input().split(" ")))
    Hs = [int(input()) for i in range(N)]
    Hs.sort()
    diffmin = float('inf')
    for i in range(0, N-K+1):
        diff = Hs[i+K-1] - Hs[i]
        if diffmin > diff:
            diffmin = diff
    print(diffmin)

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 7384
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define makei(N) int N; cin >> N;
#define makel(N) ll N; cin >> N;
#define makes(s) string s; cin >> s;
#define maked(d) double d; cin >> d;
#define makev(v, N) vi v(N); rep(N)cin >> v[i];
#define mod 1000000007
#define re return 0
#define distance(x1,y1,x2,y2) sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));

using namespace std;
using ll = long long int;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("Yes");
	else say("No");
}

template<typename T>
void maxi(T &a, T b) {
	a = max(a, b);
}

template<typename T>
void mini(T &a, T b) {
	a = min(a, b);
}

int main() {
	makei(N);
	makes(s);
	vi ans;
	rep(N)ans.push_back(0);
	rep(26) {
		int Min = -1;
		int Max = -1;
		For(j, N) {
			if (s[j] == i + 'a') {
				if (Min == -1)Min = j;
				else Max = j;
			}
		}
		if (Max != -1)FOR(j, Min, Max + 1)++ans[j];
	}
	sort(rev(ans));
	say(ans[0]);

}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
  string S,s,es;
  s = 's';
  es = "es";
  int slong;
  cin >> S;
  
  slong = S.size();
  if(S[slong-1]=='s'){
    S = S + es;
  }else{
    S = S + s;
  }
  
  cout <<S;
}
  

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			int a = sc.nextInt();
			A[i] = a - i + 1;
		}

		Arrays.sort(A);

		int median = A[(N - 1) / 2];
		long answer = 0;

		for (int i = 0; i < N; i++) {
			answer += (long)Math.abs(A[i] - median);
		}

		System.out.println(answer);
	}
}


Measured memory_bytes: 66128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int ac = 0;
			int wa = 0;
			int tle = 0;
			int re = 0;

			for (int i = 0; i < n; i++) {
				String s = sc.next();
				if ("AC".equals(s)) {
					ac++;
				} else if("WA".equals(s)) {
					wa++;
				} else if("TLE".equals(s)) {
					tle++;
				} else if("RE".equals(s)) {
					re++;
				}
			}
			System.out.println("AC x " + ac);
			System.out.println("WA x " + wa);
			System.out.println("TLE x " + tle);
			System.out.println("RE x " + re);
		}
	}
}


Measured memory_bytes: 58644
N = int(input())

S = ''
if N == 0:
    S = '0'

i=0
while abs(N) > 0:
    if (N % 2 ** (i+1)) == 0:
        S = '0' + S
    else:
        S = '1' + S
        N -= (-2) ** i
    i+=1
print(S)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define ios() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
constexpr ll MOD = 1e9+7;
constexpr ll INF = 1LL << 60;
constexpr int Inf = 1e9;
inline int in() {int x; cin >> x; return x;}
template <typename T> inline void out(const T& x) {cout << x << endl;}
template <class T> inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}
template <class T> inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
//UP = 0;RIGHT = 1; DOWN = 2; LEFT =3;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b)
{
  if (a < b)
    gcd(b, a);
  int r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}
void eratos(bool * isPrime,int max){
  fill(isPrime,isPrime + max,true);
  isPrime[0] = false; 
  isPrime[1] = false; 
  for(int i=2; i<=max/i; ++i) 
      if(isPrime[i]) 
          for(int j=2; j<=max/i; ++j) 
              isPrime[i*j] = false;    
}
//

signed main()
{
  ios();
  int A,B;
  cin >> A >> B;
  if(A == B)
  {
    cout << 2*A << endl;
    return 0;
  }
  cout << 2*max(A,B) -1 << endl;
  return 0;
  
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007

int main() {
    fastio
	ll n,t,i,j,x,k;
    cin>>n;
    
    ll a[n],b[n];
    for(i=0;i<n;i++)
    cin>>a[i];
    
    b[n-1]=a[n-1];
    
    for(i=n-2;i>=0;i--)
    b[i]=(a[i]+b[i+1])%mod;
    
    ll ans=0;
    
    for(i=0;i<n-1;i++)
    ans=(ans+a[i]*b[i+1])%mod;
    cout<<ans%mod;
    
	return 0;
}

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

int main(){
  string s;
  cin>>s;
  int count0=0,count1=0;
  for(int i=0;i<s.size();i++){
    if(s.at(i)=='0')
      count0++;
    else
      count1++;
  }
  if(count0>count1)
    cout<<count1*2<<endl;
  else
    cout<<count0*2<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<pi, int> pii;
typedef pair<pi, pi> pipi;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define disc(v) sort(all(v)); v.resize(unique(all(v)) - v.begin());
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sandybridge __attribute__((optimize("Ofast"), target("arch=sandybridge")))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss

string s, t;
int n, m, ans = INF;

int main() {
	fastio; cin >> s >> t;
	n = s.length(), m = t.length();
	FOR(i, 0, n-m) {
		int cur = 0;
		FOR(j, 0, m-1) cur += (s[i+j] != t[j]);
		ans = min(ans, cur);
	}
	cout << ans;
}


Measured memory_bytes: 3628
#include<stdlib.h>
#include<stdio.h>
#define TRUE 1
#define FALSE 0
#define MAX 501

int main(void) {
	int n;
	int w,h;
	int map[MAX][MAX];
	int s,t;
	int i,j;
	int x, y;
	int count;
	int max;
	
	while(TRUE) {
		scanf("%d", &n);
		if(n==0) break;
		scanf("%d %d", &w, &h);
		
		for(i=0; i<MAX; i++) {
			for(j=0; j<MAX; j++) {
			map[i][j] = 0;
			}
		}
		
		j=1;
		for(i=0; i<n; i++) {
			scanf("%d %d", &x, &y);
			map[x][y] = 1;
		}
		
		scanf("%d %d", &s, &t);
		max = 0;
		for(x=1; x<=w-s+1; x++) {
			for(y=1; y<=h-t+1; y++) {
				count = 0;
				
				for(i=0; i<s; i++) {
					for(j=0; j<t; j++) {
						if(map[x+i][y+j]==1)
							count++;
					}
				}
				if(count > max) max = count;
				
			}
		}
		printf("%d\n", max);
	}
	
	exit(0);
}

Measured memory_bytes: 1580
#include <stdio.h>
int main(void){
   int v;
   int n;
   int b[3];
   scanf("%d\n",&n);
   int ans=0;
   long long e[15],f[15];
   int a[10];
   e[0]=1;f[0]=1;
   for(int i=1;i<15;i++)e[i]=10*e[i-1];
   for(int i=1;i<15;i++)f[i]=3*f[i-1];
   for(int g=1;g<10;g++){
   for(int i=0;i<f[g];i++){
       v=i;
       for(int i=0;i<g;i++){
           a[i]=v%3;
           v-=v%3;
           v/=3;
       }b[0]=0;b[1]=0;b[2]=0;
       for(int i=0;i<g;i++){
           b[a[i]]++;
       }
       if(b[0]&&b[1]&&b[2]){
            v=0;
            for(int i=0;i<g;i++){
                v+=(a[i]*2+3)*e[i];
            }
            if(v<=n)ans++;
       }
   }
   }
   printf("%d\n",ans);
}

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

int main(void) {
	int a, b;
	cin >> a >> b;
	if (6 <= a && a < 13)  b /= 2;
	else if (5 >= a) b = 0;
	cout << b << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fo(i,a,n) for(i=a;i<n;i++)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define sortrev(x) sort(all(x),greater<int>())
#define pi 3.1415926535897932384626

typedef pair<int,int> pii;
typedef pair<ll, ll> pl;
typedef vector<int>	vi;
typedef vector<ll>	vl;
typedef vector<pii>	vpii;
typedef vector<pl>	vpl;
typedef vector<vi>	vvi;
typedef vector<vl>	vvl;


const int mod = 100000007;
const int inf = 100000005;
const int N = 3e5, M = N;
ll i,j,n,m;


void solve() {
   ll n,k;
   cin>>n>>k;

   ll x;
   string s;

   vi vec(n+1,0);

   ll ans = 0 , cnt = 0;
   fo(i,0,k) {
    cin>>x>>s;
    if(vec[x]<0) continue;
    
    if(s == "AC") ans++, cnt += vec[x] , vec[x] = -1;
    else vec[x]++;
   }
   cout<<ans<<" "<<cnt<<"\n";
}


int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    int t = 1;
    //cin >> t;
    while(t--) {
      solve();
    }

    return 0;
}




Measured memory_bytes: 3716
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for i in range(len(b)):
    al = 0
    ar = n-1
    while True:
        if a[-1] < b[i]:
            an = n
            break
        if a[0] >= b[i]:
            an = 0
            break
        am = (al+ar)//2
        if a[am] < b[i]:
            al = am
        else:
            ar = am
        an = al + 1
        if al+1 == ar:
            break
    cl = 0
    cr = n-1
    while True:
        if c[0] > b[i]:
            cn = n
            break
        if c[-1] <= b[i]:
            cn = 0
            break
        cm = (cl+cr)//2
        if c[cm] <= b[i]:
            cl = cm
        else:
            cr = cm
        cn = n - cr
        if cl+1 == cr:
            break
    ans += an*cn
print(ans)

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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greater<int>()

using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;

const int INF = 1001001001;
const int MOD = 1000000007;
const long long INFL = (1LL << 60);
const double EPS = 1e-9;

int main() {
  int c[3][3];
  rep(i, 3) rep(j, 3) cin >> c[i][j];

  string res = "No";
  rep(k, 101) rep(m, 101) rep(n, 101) {
    int a[3], b[3];
    a[0] = k, a[1] = m, a[2] = n;
    b[0] = c[0][0] - a[0], b[1] = c[1][1] - a[1], b[2] = c[2][2] - a[2];
    rep(i, 3) if (b[i] < 0) continue;
    int cnt = 0;
    rep(i, 3) rep(j, 3) {
      if (c[i][j] != a[i] + b[j]) break;
      cnt++;
    }
    if (cnt == 9) {
      res = "Yes";
      goto RES;
    }
  }

RES:
  cout << res << endl;
}

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

using namespace std;

#define DIM 5009
#define INF ((long long)1e18+9ll)
#define pairll pair<long long,long long>
#define fi first
#define se second
#define ld long double
#define amen exit(0)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define endl '\n'
#define y1 trymax_lox
#define y2 sijgkvdfbo
#define eps 1000000

long long h,w,n;

int main(){

    //freopen("threesum.in","r",stdin);
    //freopen("threesum.out","w",stdout);

    fast;

    cin>>w>>h>>n;

    if(w<h)swap(w,h);

    cout<<n/w+(n%w!=0)<<endl;    

    amen;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define mod 1000000007
#define exp pow(10,-9)
#define F first
#define S second
#define PB push_back 
#define MP make_pair
#define daman ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define lowercase(str) transform(str.begin(), str.end(), str.begin(), ::tolower);
#define uppercase(str) transform(str.begin(), str.end(), str.begin(), ::toupper);
int main(){
	daman;
	lli n,k;
	cin>>n>>k;
	lli arr[n];
	for(int i=0;i<n;i++)
		cin>>arr[i];
		
	for(int i=k;i<n;i++){
		if(arr[i] > arr[i-k])
			cout<<"Yes\n";
		else
			cout<<"No\n";
	}
}

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

int main() {
  int n;
  long long a[11000];
  cin >> n;
  for (int i=0;i<n;i++)
    cin >> a[i];

  long long min = a[0], max = a[0], sum = 0;
  for (int i=0;i<n;i++) {
    if (min > a[i])
      min = a[i];
    if (max < a[i])
      max = a[i];
    sum += a[i];
  }

  cout << min << " " << max << " " << sum << endl;
}



Measured memory_bytes: 3128
n = int(input())
a = list(map(int, input().split()))
ans = 1
flag = 0
for i in range(n):
    ans *= a[i]
    if ans > 1e18:
        flag = 1
        ans = 1
    if a[i] == 0:
        flag = 0
        ans = 0

if flag:
    print(-1)
else:
    print(ans)



Measured memory_bytes: 21584
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


template <typename T>
T amarinasi(T a,T b){
    if(a%b==0)
{
    return a/b;
}
else if(a%b>0)
{
    return a/b+1;
}
else
{
    return a/b-1;
}
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main(){
ll n,m;
cin>>n>>m;
ll x[m];
for(ll i=0;i<m;i++){
    cin>>x[i];
}
sort(x,x+m);
ll dist[m-1];
for(ll i=0;i<m-1;i++){
    dist[i]=x[i+1]-x[i];
}
sort(dist,dist+m-1,greater<ll>());
ll ans=0;
for(ll i=n-1;i<m-1;i++){
    ans+=dist[i];
}
cout<<ans<<endl;

}










Measured memory_bytes: 1792
#include<cstdio>
#include<vector>
std::vector<int> a[100005];
int n,k,cnt,used[100005];
int ans[100005],p[100005],pp[100005],q[100005],qq[100005],g[100005],gg[100005],gk[100005],ggk[100005],f[10][100005],ff[10][100005];
int main()
{
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;i++) scanf("%d",&p[i]);
	for (int i=1;i<=n;i++) scanf("%d",&q[i]);
	for (int i=1;i<=n;i++) f[0][i]=i;
	for (int i=1;i<=n;i++) ff[0][i]=i;
	for (int i=1;i<=n;i++) f[1][i]=p[i];
	for (int i=1;i<=n;i++) f[2][i]=q[i];
	for (int i=1;i<=n;i++) ff[1][f[1][i]]=i;
	for (int i=1;i<=n;i++) ff[2][f[2][i]]=i;
	for (int r=3;r<=6;r++)
	{
		for (int i=1;i<=n;i++) f[r][i]=f[r-1][ff[r-2][i]];
		for (int i=1;i<=n;i++) ff[r][f[r][i]]=i;
	}
	for (int i=1;i<=n;i++) pp[p[i]]=i;
	for (int i=1;i<=n;i++) qq[q[i]]=i;
	for (int i=1;i<=n;i++) g[i]=q[pp[qq[p[i]]]];
	for (int i=1;i<=n;i++) gg[g[i]]=i;
	for (int i=1;i<=n;i++)
	    if (!used[i])
	    {
			int x=++cnt;
			used[i]=1;
			a[x].push_back(i);
	    	for (int j=g[i];!used[j];j=g[j])
	    	{
	    		a[x].push_back(j);
	    		used[j]=1;
			}
	    }
	for (int i=1;i<=cnt;i++)
	{
		int sz=a[i].size();
		for (int j=0;j<a[i].size();j++)
		{
			int x=a[i][j],y=a[i][(j+(k-1)/6)%sz];
			gk[x]=y;
		}
	}
	for (int i=1;i<=n;i++) used[i]=0;
	for (int i=1;i<=cnt;i++) a[i].clear();cnt=0;
	for (int i=1;i<=n;i++)
	    if (!used[i])
	    {
			int x=++cnt;
			used[i]=1;
			a[x].push_back(i);
	    	for (int j=gg[i];!used[j];j=gg[j])
	    	{
	    		a[x].push_back(j);
	    		used[j]=1;
			}
	    }
	for (int i=1;i<=cnt;i++)
	{
		int sz=a[i].size();
		for (int j=0;j<a[i].size();j++)
		{
			int x=a[i][j],y=a[i][(j+(k-1)/6)%sz];
			ggk[x]=y;
		}
	}
	for (int i=1;i<=n;i++) used[i]=0;
	for (int i=1;i<=cnt;i++) a[i].clear();cnt=0;
	for (int i=1;i<=n;i++) ans[i]=gk[f[(k-1)%6+1][ggk[i]]];
	for (int i=1;i<=n;i++) printf("%d ",ans[i]);
	puts("");
	return 0;
}

Measured memory_bytes: 15052
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#include <time.h>
#include <chrono>
#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(ll i=a;i>b;i--)
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,l,r) for(int i=(1);i<(r);i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = (1LL << 31) - 1;
const ll mod = 1e9 + 7;

ll n, m, q;

ll D[501][501];


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

	cin >> n>>m>>q;
	FOR(i, 0, m) {
		ll l, r; cin >> l >> r;
		D[l][r]++;
	}
	FOR(i, 1, n+1)FOR(j,1, n+1) {
		D[i][j] += D[i - 1][j] + D[i][j - 1] - D[i - 1][j - 1];
	}

	FOR(i, 0, q) {
		ll  l, r; cin >> l >> r;
		cout << D[r][r] - D[l - 1][r] - D[r][l - 1] + D[l - 1][l - 1] << endl;
	}


}

Measured memory_bytes: 5556