akhauriyash/Code-Regression huggingface dataset:
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------

S = input()


n=len(S)
R=[0]*n
L=[0]*n

ANS=[0]*n

r0=0
r1=0
for i in range(n):
	
	if S[i]=="R":
		if i%2==0:
			r0+=1
		else:
			r1+=1
	
	
	if S[i]=="L":
		if i%2==0:
			ANS[i  ]+=r0
			ANS[i-1]+=r1
		else:
			ANS[i  ]+=r1
			ANS[i-1]+=r0
		
		r0=0
		r1=0


p("S   ",S)
p("ANS ",ANS)

l0=0
l1=0
for i in range(n-1, -1, -1):
	
	if S[i]=="L":
		if i%2==0:
			l0+=1
		else:
			l1+=1
	
	if S[i]=="R":
		if i%2==0:
			ANS[i  ]+=l0
			ANS[i+1]+=l1
		else:
			ANS[i  ]+=l1
			ANS[i+1]+=l0
		
		l0=0
		l1=0


p("S   ",S)
p("ANS ",ANS)

print(*ANS)







Measured memory_bytes: 8360
import sys
input = sys.stdin.readline
#N, K = (int(i) for i in input().split())
#B = [int(x) for x in input().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]
X = int(input())
maxnum = 1800
if X >= 1800:
    print(1)
elif X >= 1600:
    print(2)
elif X >= 1400:
    print(3)
elif X >= 1200:
    print(4)
elif X >= 1000:
    print(5)
elif X >= 800:
    print(6)
elif X >= 600:
    print(7)
else:
    print(8)


Measured memory_bytes: 61632
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
//*********************************************DO IT NOW****************************************************************
#include<bits/stdc++.h> 
#include<random>
#define int long long   
#define pp pair<int,int> 
#define ss second 
#define ff first 
#define pb push_back
#define mod 1000000007
#define pi 3.14159265359
#define mk(arr,n,type)  type *arr=new type[n];
#define sl s1.length();
#define yes cout<< "YES"<<endl
#define no  cout<< "NO"<<endl
#define all(v) (v).begin(),(v).end()
#define s(v)   sort(v,v+n)
#define  mt mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define read(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define print(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" "
#define for1(i,a,n)  for(int i=0;i<n;i++)
#define rep(i, c) for(int i = 0; i < (int)c; i++)
#define set(x) cout<<fixed<<setprecision(x);
#define cone(x) (__builtin_popcountll(x))        // zero indexed
#define fone(x) (__builtin_ffsll(x) -1LL)        //give wrong answer if x==0;(zero indexed)
#define mone(x) (63LL-__builtin_clzll(x))  
using namespace std;
//**********************************************DO IT NO****************************************************************
void fastio()
{  
  #ifndef ONLINE_JUDGE
  freopen("INPUT.txt","r",stdin);
  freopen("OUTPUT.txt","w",stdout); 
  #endif
  ios_base :: sync_with_stdio(false); 
  cin.tie(NULL) ; 
  cout.tie(NULL);
}
int dp[101][1001],ans1=1e9,dp1[1000001];
int num[10];
int a[1000000];
signed main()
{   
    fastio();
    int t=1,x1=1;
   // cin>>t;
    while(t--)
    {  
      int k;
      cin>>k;
      while(k--)
      cout<<"ACL";
    }
}
// 🍪 🍪 🍪


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main() {
int n,m;
cin>>n>>m;
vector<int> cnt(m,0);
for(int i=0; i<n; i++)
{
int k; cin>>k;
for(int j=0; j<k; j++)
{
    int a; cin>>a; --a; //配列の数字と合わせるため1引いてる
    ++cnt[a];
}
}
int ans=0;
REP(i,m){
    if(cnt[i]==n) ++ans;

}
cout<<ans<<endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N = int(input())
    X = list(enumerate(map(int,input().split())))
    X.sort(key = lambda x:x[1])
    
    M = N*N
    ans = [None] * M
    now = 0
    for i,x in X:
        ans[x - 1] = i + 1
        count = i
        while count > 0:
            while ans[now]:
                now += 1
            if now >= x:
                print('No')
                return
            ans[now] = i + 1
            count -= 1
    
    now = M - 1
    for i,x in X[::-1]:
        count = N - i - 1
        while count > 0:
            while ans[now]:
                now -= 1
            if now < x:
                print('No')
                return
            ans[now] = i + 1
            count -= 1
    print('Yes')
    print(' '.join(map(str,ans)))
if __name__ == '__main__':
    main()

Measured memory_bytes: 25764
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << x << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 30;
constexpr lint   INFL = 1LL << 62;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n;
  cin >> n;
  vector<int> l(n);
  rep (i, n) cin >> l[i];
  sort(all(l));
  lint sum = 0;
  rep (i, n) {
    rep (j, n) {
      if (i == j) continue;
      int  mini = min(l[i], l[j]), maxi = max(l[i], l[j]), ab = mini + maxi, diff = maxi - mini;
      auto litr = upper_bound(all(l), diff);
      auto ritr = lower_bound(all(l), ab);
      int  lpos = litr - l.begin(), rpos = ritr - l.begin(), dist = ritr - litr;
      if (lpos <= i && i <= rpos) --dist;
      if (lpos <= j && j <= rpos) --dist;
      sum += dist;
    }
  }
  sum /= 6;
  cout << sum << endl;
  return 0;
}

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

#define inf 1000000007
int dp[20000];

int main(){
    int n,W;
    cin >> n >> W;
    vector<int>v(n),w(n),m(n);
    for(int i=0;i<n;i++)cin >> v[i] >> w[i] >> m[i];
    
        for(int j=0;j<20000;j++){
            dp[j] = -inf;
        }
    
    dp[0] = 0;
    for(int i=0;i<n;i++){
        for(int k=1;k<=m[i];k*=2){
            int bit;
            if(k*2-1>m[i]){
                bit = m[i]-k+1;
            }else{
                bit = k;
            }
            for(int j=W;j>=bit*w[i];j--){
                dp[j] = max(dp[j],dp[j-bit*w[i]]+bit*v[i]);
            }
        }
    }
    int ans = 0;
    for(int i=0;i<=W;i++){
        ans = max(ans,dp[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3184
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out)) {
            new Main().solve(in, out);
            out.flush();
        }
    }

    private void solve(InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int numOfOdd = 0;
        for (int i = 0; i < n; i++) {
            int a = in.nextInt();
            int tmp = (a % 2 == 0) ? 2 : 1;
            numOfOdd = (numOfOdd == 0) ? tmp : tmp * numOfOdd;
        }

        out.println(((int) Math.pow(3, n)) - numOfOdd);
    }
}

class InputReader implements AutoCloseable {
    private final Scanner sc = new Scanner(System.in);

    String next() {
        return this.sc.next();
    }

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

    long nextLong() {
        return Long.parseLong(this.sc.next());
    }

    double nextDouble() {
        return Double.parseDouble(this.sc.next());

    }

    @Override
    public void close() {
        this.sc.close();
    }
}


Measured memory_bytes: 22100
#include<cstdio>
#include<cmath>
using namespace std;

int main(int argc, char const *argv[]) {
    int n,i;
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    int all=abs(a[0])+abs(a[n-1]),sum[n];
    for(i=0;i<n-1;i++){
        all+=abs(a[i+1]-a[i]);
    }
    for(i=1;i<n-1;i++){
        sum[i]=all+abs(a[i-1]-a[i+1])-abs(a[i]-a[i-1])-abs(a[i]-a[i+1]);
    }
    sum[0]=all+abs(a[1])-abs(a[0])-abs(a[1]-a[0]);
    sum[n-1]=all+abs(a[n-2])-abs(a[n-1])-abs(a[n-2]-a[n-1]);
    for(i=0;i<n;i++){
        printf("%d\n",sum[i]);
    }
    return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1000000000
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repX(i, n ,x) for (int i = x; i < (int)(n); i++)
#define repBack(i, n) for (int i = n; i >= 0; i--)

int main() {
    int N;
    cin >> N;
    vector<int> H(N);
    rep(i,N)cin >> H[i];
    int ans = 0;
    vector<int> DP(N);
    DP[N-1] = 0;
    repBack(i,N-2){
        if(H[i]>=H[i+1]){
            DP[i] = DP[i+1]+1;
        }else{
            DP[i] = 0;
        }
        ans = max(DP[i],ans);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <vector>
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstring>
#include <queue>
#include <string>

using namespace std;

const double PI = 3.14159265358979;

class Disjoint_set {
public:
	vector<int> rank;	//树高
	vector<int> p;		//树根，父节点

	Disjoint_set() {}
	Disjoint_set(int size) {
		rank.resize(size, 0);
		p.resize(size, 0);
		for (int i = 0; i < size; i++) {
			make_set(i);
		}
	}

	void make_set(int x) {	//初始化 自己是根，高度为 0
		p[x] = x;
		rank[x] = 0;
	}

	bool same(int x, int y) {
		return find_set(x) == find_set(y);
	}

	void unite(int x, int y) {
		link(find_set(x), find_set(y));
	}

	void link(int x, int y) {	//两树合并，树低者合并入树高者
		if (rank[x] > rank[y])
			p[y] = x;
		else {
			p[x] = y;
			if (rank[x] == rank[y])
				rank[y]++;
		}
	}

	int find_set(int x) {	//查询并路径压缩
		if (x != p[x]) {
			p[x] = find_set(p[x]);
		}
		return p[x];
	}
};

int main() {
	
	int n, a, b, q;
	int t;

	cin >> n >> q;

	Disjoint_set ds = Disjoint_set(n);

	for (int i = 0; i < q; i++)
	{
		cin >> t >> a >> b;
		if (t == 0) ds.unite(a, b);
		else if (t == 1) {
			if (ds.same(a, b)) cout << 1 << endl;
			else cout << 0 << endl;
		}
	}
	

	return 0;
}



Measured memory_bytes: 3180
#include <functional>
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;

const ll INF = 100000000000000000;

template<typename Monoid>
struct SegmentTree {
    using F = function<Monoid(Monoid, Monoid)>;

    int sz;
    vector<Monoid> seg;

    const F f;
    const Monoid M1;

    SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
        sz = 1;
        while(sz < n) sz <<= 1;
        seg.assign(2 * sz, M1);
    }

    void set(int k, const Monoid &x) {
        seg[k + sz] = x;
    }

    void build() {
        for(int k = sz - 1; k > 0; k--) {
            seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
        }
    }

    void update(int k, const Monoid &x) {
        k += sz;
        seg[k] = x;
        while(k >>= 1) {
            seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
        }
    }

    Monoid query(int a, int b) {
        Monoid L = M1, R = M1;
        for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
            if(a & 1) L = f(L, seg[a++]);
            if(b & 1) R = f(seg[--b], R);
        }
        return f(L, R);
    }

    Monoid operator[](const int &k) const {
        return seg[k + sz];
    }
};

int main()
{
    ll n, m;
    cin >> n >> m;
    ll l[100002], r[100002], c[100002];
    PP pp[100002];
    SegmentTree<ll> seg(n, [](ll a, ll b){return min(a, b);}, INF);
    for(int i = 0; i < n; i++) seg.set(i, INF);
    seg.build();
    seg.update(0, 0);
    for(int i = 0; i < m; i++){
        cin >> l[i] >> r[i] >> c[i];
        l[i]--;
        r[i]--;
        pp[i] = PP(P(l[i], r[i]), c[i]);
    }
    sort(pp, pp + m);
    for(int i = 0; i < m; i++){
        ll st = seg.query(pp[i].first.first, n);
        ll les = seg.query(pp[i].first.second, n);
        seg.update(pp[i].first.second, min(les, pp[i].second + st));
    }
    if(seg[n - 1] < INF) cout << seg[n - 1] << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;

int sum(int a, int b) {
    return a + b >= MOD ? a + b - MOD : a + b;
}
int sub(int a, int b) {
    return a - b < 0 ? a - b + MOD : a - b;
}
int mul(int a, int b) {
    return (1LL*a*b)%MOD;
}

const int MAXN = 5007;
int df[MAXN];

vector< int >edg[MAXN];
int sbtr[MAXN];

int dp[MAXN][MAXN][2];

void dfs(int u, int bap) {
    sbtr[u] = 1;

    dp[u][1][0] = 1;
    dp[u][1][1] = 0;
    for (int v : edg[u]) {
        if (v==bap) continue;
        dfs(v, u);

        int s0 = 0;
        int s1 = 0;
        for (int niche = 2; niche <= sbtr[v]; niche += 2) {
            s0 = sum(s0, mul(dp[v][niche][0], df[niche]));
            s1 = sum(s1, mul(dp[v][niche][1], df[niche]));
        }

        for (int total = sbtr[u]+sbtr[v]; total > 0; total--) {
            int _0 = dp[u][total][0];
            int _1 = dp[u][total][1];

            for (int p = 0; p < 2; p++) {
                int &ans = dp[u][total][p];
                ans = 0;
                for (int niche = max(total-sbtr[u], 1); niche <= sbtr[v] && niche < total; niche++) {
                    int bam = total-niche;
                    ans = sum(ans, mul(dp[u][bam][0], dp[v][niche][p]));
                    ans = sum(ans, mul(dp[u][bam][1], dp[v][niche][p^1]));
                }

                if (total <= sbtr[u]) {
                    if (p == 1) {
                        ans = sum(ans, mul(_0, s0));
                        ans = sum(ans, mul(_1, s1));
                    } else {
                        ans = sum(ans, mul(_0, s1));
                        ans = sum(ans, mul(_1, s0));
                    }
                }
            }
        }
        sbtr[u] += sbtr[v];
    }

//    for (int total = 1; total <= sbtr[u]; total++) {
//        for (int p = 0; p < 2; p++) {
//            cout << "dp[" << u << "][" << total << "][" << p << "] = " << dp[u][total][p] << endl;
//        }
//    }
//    cout << endl;
}

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

    for (int i = 1; i < n; i++) {
        int u, v;
        cin >> u >> v;
        edg[u].push_back(v);
        edg[v].push_back(u);
    }

    df[0] = 1;
    for (int i = 2; i <= n; i += 2) {
        df[i] = mul(i-1, df[i-2]);
//        cout << "df[" << i << "] = " << df[i] << endl;
    }


    dfs(1, 0);

    int ans = 0;
    for (int sz = 2; sz <= n; sz++) {
        ans = sum(ans, mul(sub(dp[1][sz][0], dp[1][sz][1]), df[sz]));
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 92860
reader = list(map(int, input().split()))
D = reader[0]
N = reader[1]

cnt = 0
index = 0
while cnt < N:
    index += 1
    if pow(100,D)*index % pow(100,D+1) == 0:
        continue
    cnt += 1

print(str(pow(100,D)*index))


Measured memory_bytes: 38276
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m = map(int,input().split())
uf = UnionFind(n)
for _ in range(m):
  a,b = map(int,input().split())
  uf.union(a-1,b-1)
root = [0]*n
for i in range(n):
  root[uf.find(i)] += 1
cnt = 0
for v in root:
  if v!=0:
    cnt += 1
print(cnt-1)

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

int main()
{
  int N;
  cin >> N;
  
  vector<ll> A(N);
  rep(i, N)
  {
    cin >> A[i];
    
    if (A[i] == 0)
    {
      cout << 0 << endl;
      return 0;
    }
  }
  
  ll ans = 1;
  rep(i, N)
  {
    if (A[i] <= 1000000000000000000 / ans)
    {
      ans *= A[i];
    }
    else
    {
      cout << -1 << endl;
      return 0;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 4028
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
struct UnionFind {
    vector<ll> par;

    UnionFind(ll n) : par(n, -1) { }

    ll root(ll x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    bool merge(ll x, ll y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    ll size(ll x) {
        return -par[root(x)];
    }
};

struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
vector<ll> divisor(ll n){
  vector<ll> res;
  for(ll i=1; i*i<=n ; i++){
    while(n%i==0){
      ++res[i];
      n /= i;
    }
  }
  if(n!=1) res[n]=1;
  return res;
}
int main(){
  ll N,M; cin>>N>>M;
  vector<ll> a(M), b(M);
  UnionFind uf(N);
  ll n=0;
  rep(i,0,M){
    cin>>a[i]>>b[i];
    a[i]--; b[i]--;
    uf.merge(a[i], b[i]);
  }
  ll cnt=0;
  vector<ll> v;
  ll mi = INF;
  ll ma = 0;
  rep(i,0,N){
    if(uf.root(i)==i){
      //cout<<uf.root(i)<<endl;
      cnt++;
      v.push_back(uf.size(i));
      chmin(mi, uf.size(i));
      chmax(ma, uf.size(i));
      //cout<<uf.size(i)<<endl;
    }
  }
  ll k=mi;
  //cout<<cnt<<endl;
  rep(i,0,N){
    if(uf.root(i)==i){
      k += uf.size(i) - mi;
    }
  }
  cout<<ma<<endl;
  return 0;
}


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

int main() {
	vector<int> a(4), b(4);
	while( cin >> a[0] >> a[1] >> a[2] >> a[3] ){
		for( int i=0; i<4; ++i ) cin >> b[i];
		
		int hit = 0, blow = 0;
		for( int i=0; i<4; ++i ){
			for( int j=0; j<4; ++j ){
				if( a[i] == b[j] ){
					( i==j ? hit : blow ) += 1;	
				}
			}
		}
		cout << hit << ' ' << blow << endl;
	}
}

Measured memory_bytes: 3068
mod = 10**9 + 7
from collections import Counter

N = int(input())
A = list(map(int,input().split()))

c = Counter(A)
ans = 1

if N % 2 == 1:
    if c[0] != 1:
        print(0)
        exit()
    for i in range(2, N, 2):
        if c[i] != 2:
            print(0)
            exit()
        ans *= 2
        ans %= mod
else:
    for i in range(1, N, 2):
        if c[i] != 2:
            print(0)
            exit()
        ans *= 2
        ans %= mod

print(ans)

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

int main(){
  int N,i,j,count=0,ans;
  cin >> N;
  vector<int> D(N+1),check(N+1);
  for(i=0;i<N;i++){
    cin >> D[i];
    check[i] = 0;
  }
  for(i=0;i<N;i++){
    if(check[i] == 0){
      for(j=i+1;j<N;j++){
        if(D[i] == D[j]){
          count++;
          check[j] = 1;
        }
      }
    }
  }
  ans = N-count;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
long long MAX(long long a,long long b){return a<b?b:a;}
long long  n,m,i,a,b,c,s,max,d[(1<<16)+10];
int main(){
  while(scanf("%lld",&n),n){  
    for(i=0;i<(1<<16);i++)d[i]=0;
    while(n--){
      scanf("%lld %lld",&m,&c);
	s=0;
      while(m--){
	scanf("%lld %lld",&a,&b);
	for(i=a;i<b;i++)s+=1<<(i-6);
      }
      for(i=0;(i|s)<(1<<16);i++){
	if((i&s)==0)d[i+s]=MAX(d[i+s],d[i]+c);
      }
    }
    for(i=max=0;i<(1<<16);i++)max=MAX(max,d[i]);
    printf("%lld\n",max);
  }
  return 0;
}
  

Measured memory_bytes: 1112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

using pi = pair<int,int>;

const int A = 111;
const int INF = 191919;
int dp[A][A];

int main()
{
    int n,m;
    cin >>n >>m;
    vector<pi> p(m);
    rep(i,m)
    {
        int a,b;
        cin >>a >>b;
        p[i] = {a-1,b-1};
    }
    sort(all(p));

    rep(i,A)rep(j,A) dp[i][j]=INF;
    dp[0][0]=0;
    rep(i,m)rep(j,n+1)
    {
        dp[i+1][j] = min(dp[i+1][j],dp[i][j]);
        if(p[i].fi<=j) dp[i+1][p[i].se+1] = min(dp[i+1][p[i].se+1],dp[i][j]+1);
    }

    int ans = dp[m][n];
    if(ans==INF) cout << "Impossible" << endl;
    else cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3176
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

string S;

int main(){
    cin>>S;

    int ans=1001001001;
    rep(i,S.size()-2){
        string t;
        rep(j,3) t+=S[i+j];
        int n=atoi(t.c_str());
        ans=min(ans,abs(n-753));
    }

    cout<<ans<<endl;
}

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

using namespace std;

const int MAX = 2000 * 100 + 11;
vector<int > a[MAX];
vector<bool > vis(MAX);
int n, m;
int res = 0, curr = 0;

void dfs(int currNode)
{
	if(vis[currNode]) 
	{
		return;
	}
	
	curr++;
	vis[currNode] = true;
	for(auto it: a[currNode]){
		dfs(it);
	}
}

int main()
{
	cin >> n >> m;
	for(int i = 0; i < m; i++)
	{
		int x, y;
		cin >> x >> y;
		x--; y--;
		a[x].push_back(y);
		a[y].push_back(x);	
	}			
	
	for(int i = 0; i < n; i++)
	{
		dfs(i);
		res = max(res, curr);
		curr = 0;
	}
	
	cout << res;
	return 0;
}


Measured memory_bytes: 20792
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<P,P> PP;
const ll MOD=10000;
const ll INF=1000000010;
const int MAX=100001;
int dx[8]={0,1,0,-1,1,-1,1,-1};
int dy[8]={1,0,-1,0,1,-1,-1,1};
int r[20][100010];
int main(){
	int n,m;
	cin>>n>>m;
	int a[100010];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	ll sum[300010]={};
	ll ans=0;
	for(int i=0;i<n-1;i++){
		int l=a[i];
		int r=a[i+1];
		if(a[i]>=a[i+1]){
			r+=m;
		}
		ans+=r-l;
		sum[l+2]--;
		sum[r+1]+=r-l;
		sum[r+2]-=r-l-1;
	}
	for(int i=1;i<=2*m+3;i++){
		sum[i]+=sum[i-1];
	}
	for(int i=1;i<=2*m+3;i++){
		sum[i]+=sum[i-1];
	}
	ll s=ans;
	for(int i=1;i<=m;i++){
		ans=min(ans,s+sum[i]+sum[i+m]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define mp make_pair
using namespace std;
int main(){
	ll n,a,b,c,d;
	cin>>n>>a>>b>>c>>d;
	ll las = b-a;
	for(int i=0;i<=n-1;i++){
		ll ma = d*i - c*(n-1-i);
		ll mi = c*i - d*(n-1-i);
		if(mi <= las && las<=ma){
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}

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

#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

const int N = 1000010;


double n , m , d;
double ans = 0;
vector<int> all;

int calc(int idx, int prev,int cnt) {
	if (idx == m){
		ans += cnt;
		return 0;
	}
	int ret = 0;
	if (idx == 0) {
		for (int i = 1; i <= n ; ++i) {
			all.push_back(i);
			ret += calc(idx + 1, i,0);
			all.pop_back();
		}
	} else {
		for (int i = 1; i <= n ; ++i) {
			all.push_back(i);
			ret += (abs(prev - i) == d) + calc(idx + 1, i,cnt+(abs(prev - i) == d));
			all.pop_back();
		}
	}
	return ret;
}
int main() {
	cin >> n >> m >> d;
	/*if(m==1){
		printf("%.9lf\n",0.0 );
		return 0;
	}*/
	double fn = ((2*n-2*d)/(n*n))*(m-1);
	if(d == 0)
		fn /= 2.0;
	printf("%.9lf\n", fn);
/*	for(m = 1 ; m < 10 ; m++){
		ans = 0;
		calc(0,0,0);
		printf("%.9lf %.9lf\n",ans/pow(n,m),fn);

	}*/
	
	return 0;
}

Measured memory_bytes: 764
#include<stdio.h>
int main(void) {int n,a,b,c,d,e,f,g;scanf("%d",&n);a=n/100;b=n%100;c=b/10;d=b%10;if(a==7||c==7||d==7)printf("Yes\n");else printf("No\n");return 0;}

Measured memory_bytes: 1660
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

// int d[10010];
int n, m;
vector<int> G[100010];
int reached[100010];
int color[100010];
int color_id = 0;

void bfs(int s, int color_id) {
  // cout << "--------------" << endl;
  // cout << "s:" << s << ", color:" << color_id <<endl;
  queue<int> Q;
  Q.push(s);
  while(!Q.empty()) {
    int u = Q.front(); Q.pop();
    // cout << "G[u].size():" << G[u].size() << endl;
    for (int i = 0; i < G[u].size(); i++) {
      // cout << u << "->" << G[u][i] << endl;
      if (reached[G[u][i]] == -1) {
        // cout << "reached at:" << G[u][i] << endl;
        Q.push(G[u][i]);
        reached[G[u][i]] = 1;
        color[G[u][i]] = color_id;
      }
    }
  }
}

void assignColor() {
  for (int i = 0; i < n; i++) {
    color[i] = -1;
  }

  for (int i = 0; i < n; i++) {
    if (color[i] == -1) {
      for (int j = 0; j < n; j++) {
        reached[j] = -1;
      }
      bfs(i, ++color_id);
    }
  }
}

int main() {
  cin >> n >> m;
  int s, t;

  // 初期化
  for (int i = 0; i < m; i++) {
    cin >> s >> t;
    G[s].push_back(t);
    G[t].push_back(s);
  }
  // お絵かき
  assignColor();

  // 質問
  int q;
  cin >> q;
  // cout << "number of question:" << q << endl;
  for (int i = 0; i < q; i++) {
    cin >> s >> t;
    if (color[s] == -1 || color[t] == -1) {
      cout << "no" << endl;
    } else {
      if (color[s] == color[t]) {
        cout << "yes" << endl;
      } else {
        cout << "no" << endl;
      }
    }
  }
  // お絵かきの確認
  // cout << "----------" << endl;
  //
  // for (int i = 0; i < n; i++) {
  //   cout << i << ": " << color[i] << endl;
  // }

}



Measured memory_bytes: 9412
//(・ω・)
#include <stdio.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, atoi
#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 <iomanip> //setprecision
#include <limits>
#include <sstream> //istringstream
#include <stdlib.h>
#include <list>
#include <iterator>//std::advance()
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a==b && a!=c) cout << "Yes" << endl;
    else if(b==c && b!=a) cout << "Yes" << endl;
    else if(a==c && a!=b) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3608
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long M = sc.nextLong();
    sc.close();
  
    long d = M / N;

    Set<Long> v = divisor(M);

    long answer = 0;
 
    for (Long value : v) {
      if (value <= d) {
        answer = Math.max(answer, value);
      }
    }

    System.out.println(answer);

  }

  static Set<Long> divisor (long N) {
    Set<Long> res = new HashSet<Long>();
    for (long i = 1; i * i <= N; i++) {
      if (N % i == 0) {
        res.add(i);
        if (i != N / i) {
          res.add(N / i);
        }
      }
    }
    return res;
  }

}

Measured memory_bytes: 21972
inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
N = inp.shift() * 1
a = inp.shift().split(' ').map(x => x - 0)
min = a[0]
c = 1
for (i=1;i<N;i++) {
    if (min > a[i]) {
        c++
        min = a[i]
    }
}
console.log(c)

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

using namespace std;

const int N = 2000000;

int n;
long long res;
long long a[N + 1];

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%lld", &a[i]);
	if(a[1]) { puts("-1"); return 0; }
	for(int i = 2; i <= n; i++)
		if(a[i] > a[i - 1] + 1)
			{ puts("-1"); return 0; }
	for(int i = n; i >= 1; i--)
		if(a[i] >= a[i + 1])
			res += a[i];
	printf("%lld\n", res);
	return 0;
}

Measured memory_bytes: 1920
#include <iostream>

using namespace std;
using ll = long long;

int main()
{
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    ll ans = 0LL;

    for (ll i = 0LL; i < k; ++i) {
        if (a) {
            ++ans;
            --a;
        } else if (b) {
            --b;
        } else {
            --ans;
            --c;
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3544
n, q = map(int, input().split())

plist = []
tlist = []

for _ in range(n):
    p, t = map(str, input().split())
    plist.append(p)
    tlist.append(int(t))

time = 0

ans_p = []
ans_t = []

while(1):
    if plist == []:
        break

    p = plist[0]
    t = tlist[0]
    plist.pop(0)
    tlist.pop(0)

    if t <= q:
        time += t
        ans_p.append(p)
        ans_t.append(time)
    else:
        time += q
        t -= q
        plist.append(p)
        tlist.append(t)

for p, t in zip(ans_p, ans_t):
    print(p, t)


Measured memory_bytes: 11104
input_line = input()
N = list(input_line)

if N[-1] == '2' or N[-1] == '4' or N[-1] == '5' or N[-1] == '7' or N[-1] == '9':
    print('hon')
elif N[-1] == '0' or N[-1] == '1' or N[-1] == '6' or N[-1] == '8':
    print('pon')
else:
    print('bon')

Measured memory_bytes: 61672
#include<stdio.h>
int N,M,T;
int main(void){
    int a[101]={0};
    scanf("%d%d%d",&N,&M,&T);
    for(int i=0;i<N;i++){
        scanf("%d",&a[i]);
    }
    int sum=0;
    sum+=a[0]-M;
    for(int i=1;i<N;i++){
        if(a[i]-a[i-1]>2*M){
            sum+=a[i]-a[i-1]-2*M;
        }
    }
    if((T-a[N-1])>M)
        printf("%d\n",sum+T-a[N-1]-M);
    else
        printf("%d\n",sum);
}



Measured memory_bytes: 2104
#include <stdio.h>
#include <string.h>

#define MAX_CH 11

int
main(void)
{
	char A[MAX_CH], B[MAX_CH], C[MAX_CH];
	scanf("%s %s %s", A, B, C);

	int lenA = strlen(A);
	int lenB = strlen(B);

	if (A[lenA - 1] == B[0] && B[lenB - 1] == C[0])
		puts("YES");
	else
		puts("NO");
	return 0;
}


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

int main(){
    int n, m, c;
    cin >> n >> m >> c;


    vector<int> b(m);
    for(int i = 0; i < m; i++){
        cin >> b.at(i);
    }

    vector<vector<int> > a(n, vector<int>(m));
    for(int i = 0; i < n; i++){
        for(int j = 0;j < m; j++){
            cin >> a.at(i).at(j);
        }
    }

    int counter = 0;
    for(int i = 0; i < n; i++){
        int total = 0;
        for(int j = 0;j < m; j++){
            total += (b.at(j) * a.at(i).at(j));
        }
        total += c;
        if(total > 0)
            counter++;
    }
    cout << counter << endl;


}

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

typedef unsigned uint;
typedef long long ll;

using namespace std;

ll comb2(ll ini, ll all){
  return ini * (all + 1) - ini * (ini + 1) / 2;
}

int main(void){
  int n;
  cin >> n;
  vector<uint> v;
  vector<int> z;
  int zcnt = 0;
  for(int i = 0; i < n; ++i){
    uint tmp;
    cin >> tmp;
    if (tmp == 0){
      ++zcnt;
    }else{
      if (zcnt > 0){
        v.push_back(0);
        z.push_back(zcnt);
      }
      v.push_back(tmp);
      z.push_back(1);
      zcnt = 0;
    }
  }
  if (zcnt > 0){
    v.push_back(0);
    z.push_back(zcnt);
  }
  ll sum = 0;
  for(int l = 0; l < v.size(); ++l){
    uint x = v[l];
    ll cnt = z[l];
    int r = l + 1;
    for(; r < v.size(); ++r){
      if ((x & v[r]) == 0){
        x |= v[r];
        cnt += z[r];
      }else{
        break;
      }
    }
    sum += comb2(z[l], cnt);
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 2036
import java.util.Scanner;
import java.util.Random;
import java.util.Arrays;

class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
    	int b = sc.nextInt();
    	int c = sc.nextInt();
    	if (a <= c && b >= c) {
    		System.out.println("Yes");
    	} else {
    		System.out.println("No");
    	}
}
}

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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;
typedef tuple<long long, long long, long long> tllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
bool compTuple(const tllint& arg1, const tllint& arg2) { return get<2>(arg1) > get<2>(arg2); }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

    vector<int> d1(n);
    vector<int> d2(n);
    for(int in=0;in<n;++in) {
       cin >> d1[in] >> d2[in];
    }

    bool flg = false;
    for(int in=0;in<n-2;++in) {
       if(d1[in]==d2[in]&&d1[in+1]==d2[in+1]&&d1[in+2]==d2[in+2]) flg = true;
    }

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


Measured memory_bytes: 3628
#include <stdio.h>
#include <string>
#include <iostream>
using namespace std;

int main(void){
    int n;
    cin >> n;
    string ans="";
    if(n==0)ans="0";
    while(n!=0){
        if(n%(-2)!=0){
            ans= "1" +ans;
            n--;
        }
        else ans= "0" +ans;
        n /= (-2);
    }
    cout << ans <<endl;
}

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

bool	issmall(char c)
{
	return (c >= 'a' && c <= 'z');
}

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

	string	s, t;
	cin >> s >> t;
	bool	flag;
	rep(i, s.size()) // s starting point
	{
		flag = true;
		rep(j, s.size()) // check each letter
		{
			int tempi;
			tempi = i + j < s.size() ? i + j : i + j - s.size();
			if (s.at(tempi) != t.at(j))
			{
				flag = false;
				break;
			}
		}
		if (flag == true)
		{
			cout << "Yes" << endl;
			return (0);
		}
	}
	cout << "No" << endl;
}


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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};
 
int main(){
  int a, b;
  cin >> a >> b;
  int ans = a-1;
  if(a<=b) ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

template <class T, class T2>
class LazySegTree {
    using F = function<T(T, T)>;
    using G = function<T(T, T2)>;
    using H = function<T2(T2, T2)>;
    using P = function<T2(T2, int)>;
    int n;
    vector<T> data;
    vector<T2> lazy;
    const F f;
    const G g;
    const H h;
    const P p;
    const T e;
    const T2 e2;

public:
    LazySegTree(const vector<T>& as, const F f, const G g, const H h, const P p, const T& e, const T2 e2) : f(f), g(g), h(h), p(p), e(e), e2(e2) {
        n = 1;
        while (n < as.size()) n <<= 1;
        data.assign(2 * n, e);
        lazy.assign(2 * n, e2);
        for (int i = 0; i < as.size(); i++) {
            data[n + i] = as[i];
        }
        for (int i = n - 1; i > 0; i--) {
            data[i] = f(data[2 * i], data[2 * i + 1]);
        }
    }

    void propagate(int k, int len) {
        if (lazy[k] != e2) {
            if (k < n) {
                lazy[2 * k] = h(lazy[2 * k], lazy[k]);
                lazy[2 * k + 1] = h(lazy[2 * k + 1], lazy[k]);
            }
            data[k] = g(data[k], p(lazy[k], len));
            lazy[k] = e2;
        }
    }

    T update(int a, int b, const T2& x, int k, int l, int r) {
        propagate(k, r - l);
        if (r <= a || b <= l) {
            return data[k];
        } else if (a <= l && r <= b) {
            lazy[k] = h(lazy[k], x);
            propagate(k, r - l);
            return data[k];
        } else {
            return data[k] = f(update(a, b, x, 2 * k, l, (l + r) >> 1), update(a, b, x, 2 * k + 1, (l + r) >> 1, r));
        }
    }

    T update(int a, int b, const T2& x) {
        return update(a, b, x, 1, 0, n);
    }

    T query(int a, int b, int k, int l, int r) {
        propagate(k, r - l);
        if (r <= a || b <= l) {
            return e;
        } else if (a <= l && r <= b) {
            return data[k];
        } else {
            return f(query(a, b, 2 * k, l, (l + r) >> 1), query(a, b, 2 * k + 1, (l + r) >> 1, r));
        }
    }

    T query(int a, int b) {
        return query(a, b, 1, 0, n);
    }
};

int main() {
    int n;
    cin >> n;
    vi as(n, (i64(1) << 31) - 1);

    // RUQ, RMQ
    auto f = [](i64 a, i64 b) {return min(a, b);};
    auto g = [](i64 a, i64 b) {return b < 0 ? a : b;};
    auto h = [](i64 a, i64 b) {return b < 0 ? a : b;};
    auto p = [](i64 a, int b) {return a;};
    LazySegTree<i64, i64> tree(as, f, g, h, p, 1e18, -1);

    int q;
    cin >> q;
    while (q--) {
        int c;
        cin >> c;
        if (c == 0) {
            int s, t, x;
            cin >> s >> t >> x;
            tree.update(s, t + 1, x);
        } else {
            int s, t;
            cin >> s >> t;
            cout << tree.query(s, t + 1) << endl;
        }
    }
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    map<string, int> mem;
    int n;
    cin >> n;
    rep(i,0,n) {
    	string s;
    	cin >> s;
    	mem[s] += 1;
    }
    int max_v;
    for(const auto& x: mem){
    	int v = x.second;
    	if(v > max_v) max_v = v;
    }
    for(auto i = mem.begin(); i!=mem.end(); ++i){
    	if(i->second == max_v) cout << i->first << "\n";
    }
    



}

Measured memory_bytes: 23808
//解説pdf既読
//分割代入が未対応だった(´･ω･`)
function Main(input) {
    var tmp = [];
    var path = (array, index, num) => array[index + num - 1] - array[index];
    input = input.split("\n");
    NK = input[0].split(" ").map(Number);
    N = NK[0]; K = NK[1];
    x = input[1].split(" ").map(Number);
    for (var i = 0; i < N - K + 1; i++) tmp.push(Math.min(Math.abs(x[i]), Math.abs(x[i+K-1])) + path(x, i, K));
    console.log(Math.min(...tmp));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 28924
import math
a,b,c=map(int,input().split())
s=a*b*math.sin(math.radians(c))/2
print(s)
c_l=math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(c)))
print(a+b+c_l)
h=2*s/a
print(h)


Measured memory_bytes: 5704
/************************************************
*Author        :  xzj213
*Created Time  :  2019.10.27.20:06
*Mail          :  xzj213@qq.com
*Problem       :  B
************************************************/
#include <bits/stdc++.h>
using namespace std;
int n=9,ask,vis[100+5];
int read() {
    int x=0,f=1;
    char ch=getchar();
    while(ch>57 || ch<48){if(ch==45)f=-1;ch=getchar();}
    while(ch<=57 && ch>=48){x=x*10+ch-48;ch=getchar();}
    return x*f;
}
int main() {
    for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			vis[i*j]=1;
	ask=read();
	if(vis[ask])puts("Yes");
	else puts("No");
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static readonly int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//int n = int.Parse(Console.ReadLine());
			//string s = Console.ReadLine();
			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int h = vs[0];
			int w = vs[1];
			int[][] grid = new int[h][];
			for (int i = 0; i < h; i++) {
				grid[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
			}
			//for (int i = 0; i < h; i++) {
			//	System.Diagnostics.Debug.WriteLine(string.Join(" ", grid[i]));
			//}
			//System.Diagnostics.Debug.WriteLine("");
			List<Data> ans = new List<Data>();
			for (int y = 0; y < h; y++) {
				for (int x = 0; x < w; x++) {
					if (grid[y][x] % 2 == 1) {
						if (x + 1 < w) {
							ans.Add(new Data() { x1 = x, y1 = y, x2 = x + 1, y2 = y });
							grid[y][x]--;
							grid[y][x + 1]++;
						} else if (y + 1 < h) {
							ans.Add(new Data() { x1 = x, y1 = y, x2 = x, y2 = y + 1 });
							grid[y][x]--;
							grid[y + 1][x]++;
						}
					}
				}
			}
			//for (int i = 0; i < h; i++) {
			//	System.Diagnostics.Debug.WriteLine(string.Join(" ", grid[i]));
			//}
			//System.Diagnostics.Debug.WriteLine("");
			Console.WriteLine(ans.Count);
			foreach (var item in ans) {
				Console.WriteLine(item);
			}


			Console.Out.Flush();
		}
	}

	class Data
	{
		public int x1;
		public int y1;
		public int x2;
		public int y2;
		public override string ToString()
		{
			return $"{y1 + 1} {x1 + 1} {y2 + 1} {x2 + 1}";
		}
	}

}


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

int main() 
{
	int n,l,closest = 1000000000,sum=0;
	cin >> n >> l ;
	for(int i=0;i<n;i++)
	{
		int x = l+i;
		if(abs(x)<abs(closest))
			closest = x;
		sum+=x;
	}
	cout << sum-closest;
	return 0;
}

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

using ll = long long;
using ld = long double;

signed main(){
	ll a,b,c;
	cin >> a >> b >> c;

	if((c-a-b)*(c-a-b) > 4*a*b && (c-a-b)>0){
		cout << "Yes\n";
	}
	else{
		cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

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


int main() {
    int n, d;
    cin >> n >> d;
    d = 2 * d + 1;
    int cnt = 0;
    while(n > 0) {
        n -= d;
        cnt++;
    }
    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 256
w = list(input())

w.sort()
c = 1
p = w[0]
for i in range(1,len(w)):
    if p == w[i]:
        c += 1
    else:
        if c%2 == 1:
            print('No')
            exit()
        c = 1
        p = w[i]

if len(w) == 1:
    print('No')
    exit()

print('Yes')


Measured memory_bytes: 9116
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,ma=0;
  cin>>n;
  vector<int> a(n);
  for(int &i:a){
    cin>>i;
    ma=max(ma,i);
  }
  int j=ma/2,k=(ma+1)/2,mi=1000000000,l;
  for(int i:a)
    if(i!=ma && mi>min(abs(i-j),abs(i-k)))
      mi=min(abs(i-j),abs(i-k)),l=i;
  cout<<ma<<' '<<l<<endl;
}

Measured memory_bytes: 3728
def factorial(n):
    return n * factorial(n - 1) if n > 0 else 1

def rank(P):
    N = len(P)
    r = list(range(N))
    result = 0
    for i in range(N):
        result += r[P[i]] * factorial(N - 1 - i)
        for j in range(P[i] + 1, N):
            r[j] -= 1
    return result

N = int(input())
P = list(map(lambda s: int(s) - 1, input().split()))
Q = list(map(lambda s: int(s) - 1, input().split()))

print(abs(rank(P) - rank(Q)))

Measured memory_bytes: 3064
n = int(input())
*a, = map(int, input().split())

res = 0
r = 0
s = 0
for l in range(n):
    while r < n and (s ^ a[r]) == (s + a[r]):
        s += a[r]
        r += 1

    res += r - l
    if l == r:
        r += 1
    else:
        s -= a[l]
print(res)


Measured memory_bytes: 24712
#define _USE_MATH_DEFINES
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<long long>> VVLL;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;

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

const int MOD = 1000000007;

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(a>b){
		a=b;
		return true;
	}
	return false;
}

void debug(VI &arr){
	int n=arr.size();
	rep(i,n){
		cout<<arr.at(i)<<endl;
	}
}

void debug(VVI &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout << board.at(i).at(j) << " ";
		}
		cout<<endl;
	}
}

void debug(VVLL &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout<<board.at(i).at(j)<<" ";
		}
		cout<<endl;
	}
}

void debug(VS &board){
	int h = board.size();
	rep(i,h){
		cout<<board.at(i)<<endl;
	}
	return;
}

LL gcd(LL a,LL b){
	return b==0?a:gcd(b,a%b);
}

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

int main(){
	//cout<<fixed;
	//cout<<setprecision(9)<<...
	int n,k;
	cin>>n>>k;
	VI p(n);
	rep(i,n){
		cin>>p[i];
	}
	sort(all(p));
	int ans = 0;
	rep(i,k){
		ans+=p[i];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3636