akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
//#include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const double EPS = 1e-10;
long long const MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    string S; cin >> S;
    int ans = 0;
    if (S.length() == 1) {
        cout << 1 << endl;
        return 0;
    }
    int flag = 0;
    for (int i = 0; i < S.length()-1; i++) {
        ans++;
        if (S[i] == S[i+1]) {
            if (flag) {
                flag = 0;
            } else {
                if (i == S.length()-2) ans--;
                flag = 1;
                i++;
            }
            continue;
        }
        flag = 0;
    }
    cout << ans+1 << endl;
}

Measured memory_bytes: 1336
N = int(input())
A = input().split(" ")
A = [int(i) for i in A]
list = [min(A)]
A = sorted(A)
iii = 0
while True:
    iii += 1
    if A[N-1] % A[N-2] != 0:
        A[N-1] = A[N-1] % A[N-2]
    elif N >= 3 and A[N-1] % A[N-3] != 0:
        A[N-1] = A[N-1] % A[N-3]

    A = sorted(A)
    list.append(min(A))
    if iii > 32:
        break       
#print(list)
for i in range(N-1):
    if A[i+1]-A[i] > 0:
        list.append(A[i+1]-A[i])
#print(list)
print(min(list))

Measured memory_bytes: 14480
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
  return os<<"{"<<p.fs<<","<<p.sc<<"}";
}
template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
  os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}
template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}

ll n;
VV<ll> e;
VV<ll> ps;
V<ll> deg;


signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  cin>>n;
  deg.assign(n,0);
  e.assign(n,V<ll>(0));
  ps.assign(n,V<ll>(0));

  rep(i,0,n-1){
    int a,b;cin>>a>>b;
    --a;--b;
    e[a].pb(b);
    e[b].pb(a);
    deg[a]++;
    deg[b]++;
  }

  queue<int> q;
  V<int> flag(n,0);
  rep(i,0,n){
    if(deg[i]==1){
      q.push(i);
      q.push(0);
      flag[i]=1;
    }


    while(q.size()){
      int now=q.front();q.pop();
      int len=q.front();q.pop();

      for(auto&& to:e[now]){
        if(flag[to])continue;
        
        if(deg[to]>=3){
          if(len%2){
            deg[to]--;
            continue;
          }
          else {
            q.push(to);
            q.push(len+1);
            flag[to]=1;
          } 
        }else if(deg[to]==1){
          if(len%2){
            cout<<"First"<<ENDL;
            return 0;
          }else{
            q.push(to);
            q.push(len+1);
            flag[to]=1;
          } 
        }else{
          q.push(to);
          q.push(len+1);
          flag[to]=1;
        }
      }
    }
  }
  cout<<"Second"<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 12956
n = int(input())
a = list(map(int,input().split()))
b = [2 ** i for i in range(n)]
c = {}
for i in range(2 ** n):
    k = 0
    k += i
    v = 0
    for j in range(n)[::-1]:
        v += k // b[j] * a[j]
        k %= b[j]
    c[v] = 0
m = int(input())
a = list(map(int,input().split()))
for i in range(m):
    try:
        c[a[i]]
        print("yes")
    except:
        print("no")
    


Measured memory_bytes: 5648
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;
using int32 = __uint32_t;

void solve() {
    string s;
    cin >> s;

    int a = 0, b = 0;
    for(auto &x: s){
        if(x == '1')a++;
        else b++;
    }    
    cout << 2 * min(a, b) << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}


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

#define pb push_back
#define ff first
#define ss second

typedef long long ll;
typedef pair<int, int> pii;

string s, t, u;
int n, m;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> s >> t;
	cin >> n >> m;
	cin >> u;
	if (u == s)
		n--;
	else
		m--;
	cout << n << ' ' << m << endl;
	return 0;
}


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

using namespace std;

const int INFTY = 1001001001;

int main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    for(int i=0;i<N;++i){
        cin >> a[i];
    }

    sort(a.begin(), a.end(), greater<int>());
    int max_v = a[0];
    int ans, dif=INFTY, d=max_v / 2;
    for(int i=1;i<N;++i){
        if(dif > abs(d - a[i])){
            dif = abs(d - a[i]);
            ans = a[i];
        }
    }
    cout << max_v << " " << ans << endl;
}


Measured memory_bytes: 640
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
#define MAX 120
typedef long long ll;

int main(){
  int A,B,C;
  cin>>A>>B>>C;
  if(A==B && B==C && C==A) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


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

class Program
{
    public static IO IO = new IO();
    static void Main(string[] args)
    {
        long[] n = IO.LONG(' ');
        long o = 0;
        if (n[2] >= n[0] && n[2] <= n[1])
        {
            o = 1 + (n[1] - n[2]) / n[2];
        }
        else if (n[2] < n[0])
        {
            o = n[1] / n[2] - n[0] / n[2];
            if (n[0] % n[2] == 0) { o++; }
        }
        if (n[0] == 0) { o++; }
        IO.WRITE(o);
        IO.FLUSH();
    }
}

namespace LIB
{
    public class IO
    {
        private const int WMAX = 1000;
        private StringBuilder S = new StringBuilder();
        private T R<T>(Func<string, T> f) { return f(Console.ReadLine()); }
        private T[] R<T>(Func<string, T> f, char c) { return STRING().Split(c).Select(f).ToArray(); }
        private T[] R<T>(Func<string, T> f, int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = R(f); } return r; }
        private T[][] R<T>(Func<string, T> f, int l, char c) { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = R<T>(f, c); } return r; }
        private void W<T>(Func<T, string> f, T v, bool lf = true) { S.Append(f(v)); if (lf) { S.Append('\n'); } if (S.Length >= WMAX) { FLUSH(); } }
        public string STRING() { return R(s => s); }
        public string[] STRING(char c) { return R(s => s, c); }
        public string[] STRING(int l) { return R(s => s, l); }
        public string[][] STRING(int l, char c) { return R(s => s, l, c); }
        public int INT() { return R(int.Parse); }
        public int[] INT(char c) { return R(int.Parse, c); }
        public int[] INT(int l) { return R(int.Parse, l); }
        public int[][] INT(int l, char c) { return R(int.Parse, l, c); }
        public long LONG() { return R(long.Parse); }
        public long[] LONG(char c) { return R(long.Parse, c); }
        public long[] LONG(int l) { return R(long.Parse, l); }
        public long[][] LONG(int l, char c) { return R(long.Parse, l, c); }
        public double DOUBLE() { return R(double.Parse); }
        public double[] DOUBLE(char c) { return R(double.Parse, c); }
        public double[] DOUBLE(int l) { return R(double.Parse, l); }
        public double[][] DOUBLE(int l, char c) { return R(double.Parse, l, c); }
        public void WRITE(object s, bool lf = true) { W(v => v.ToString(), s, lf); }
        public void FLUSH() { Console.Write(S); S.Length = 0; }
    }
}

Measured memory_bytes: 2904
#include <bits/stdc++.h>
#define il inline
#define RG register
#define ll long long
#define N (100005)

using namespace std;

map<pair<int,int>,int> cnt,vis;
queue<pair<int,int> > Q;
pair<int,int> p;
set<int> S[N];

int fa[N],n;

il int gi(){
  RG int x=0,q=1; RG char ch=getchar();
  while ((ch<'0' || ch>'9') && ch!='-') ch=getchar();
  if (ch=='-') q=-1,ch=getchar();
  while (ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
  return q*x;
}

il int find(RG int x){
  return fa[x]==x ? x : fa[x]=find(fa[x]);
}

il pair<int,int> make(RG int u,RG int v){
  if (u>v) swap(u,v); return make_pair(u,v);
}

int main(){
  n=gi();
  for (RG int i=1;i<=n;++i) fa[i]=i;
  for (RG int i=1,u,v;i<2*n-1;++i){
    u=gi(),v=gi(),p=make(u,v);
    S[u].insert(v),S[v].insert(u);
    if (++cnt[p]>1 && !vis.count(p)) Q.push(p),vis[p]=1;
  }
  for (RG int tim=1,x,y;tim<n;++tim){
    while (1){
      if (Q.empty()) puts("NO"),exit(0);
      p=Q.front(),Q.pop();
      x=find(p.first),y=find(p.second);
      if (x!=y) break;
    }
    if (S[x].size()>S[y].size()) swap(x,y); fa[x]=y;
    for (set<int>::iterator it=S[x].begin();it!=S[x].end();++it){
      RG int v=find(*it); if (v==y) continue;
      S[y].insert(v),S[v].insert(y),p=make(v,y);
      if (++cnt[p]>1 && !vis.count(p)) Q.push(p),vis[p]=1;
      S[v].erase(x);
    }
  }
  puts("YES"); return 0;
}


Measured memory_bytes: 50816
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Map<Character, Integer> l = new HashMap<>();
        l.put('I', 1);
        l.put('V', 5);
        l.put('X', 10);
        l.put('L', 50);
        l.put('C', 100);
        l.put('D', 500);
        l.put('M', 1000);
        while (sc.hasNext()) {
            char[] line = sc.next().toCharArray();
            int sum = l.get(line[0]);
            for (int i = 1; i < line.length; i++) {
                if (l.get(line[i - 1]) < l.get(line[i])) {
                    sum += l.get(line[i]) - l.get(line[i - 1])*2;
                }else {
                    sum += l.get(line[i]);
                }
            }
            System.out.println(sum);
        }
    }
}


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

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SP << " " <<

LL mod = 1000000007;

//昇順ソート
int xcomp(pii& a, pii& b) {
	return a.second < b.second;
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  LL N;
  cin >> N;
  vector<pii> AB;
  REP(i,N){
    LL A, B;
    cin >> A >> B;
    AB.push_back({A, B});
  }

  XSORT(AB);
  
  LL nowt = 0;
  REP(i,AB.size()){
    nowt += AB[i].first;
    if(nowt>AB[i].second){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}


Measured memory_bytes: 6128
#include "bits/stdc++.h"
#define double long double
#define int long long
#define low lower_bound
#define upp upper_bound
#define mod 1e9+7
#define inf 1e16
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec));
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define P pair<int,int>
#define prique priority_queue<P,vector<P>,greater<P>>
struct edge{ int to,cost;};
using namespace std;
int n,q,k;
vector<edge>g[114514];
int d[114514];
void dijkstra(int s) {
	prique que;
	rep(i,n) d[i]=inf;
	d[s]=0;
	que.push(P(0,s));
	while(que.size()) {
		P p=que.top(); que.pop();
		int v=p.second;
		if(d[v]<p.first) continue;
		rep(i,(int)g[v].size()) {
			edge e=g[v][i];
			if(d[e.to]>d[v]+e.cost) {
				d[e.to]=d[v]+e.cost;
				que.push(P(d[e.to],e.to));
			}
		}
	}
}
signed main() {
	scanf("%lld",&n);
	rep(i,n-1) {
		int a,b,c;
		scanf("%lld %lld %lld",&a,&b,&c);
		a--;
		b--;
		g[a].push_back({b,c});
		g[b].push_back({a,c});
	}
	scanf("%lld %lld",&q,&k);
	k--;
	dijkstra(k);
	rep(i,q) {
		int x,y;
		scanf("%lld %lld",&x,&y);
		x--;
		y--;
		printf("%lld\n",d[x]+d[y]);
	}
}


Measured memory_bytes: 11504
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
    int n,m;cin>>n>>m;
    map<int,int>mp;
  int l = n;
    while(n--){
        int k;cin>>k;
        while(k--){
            int a;cin>>a;
            mp[a]++;
        }
    }
    int res = 0;
    for(auto p : mp){
        if(l == p.second)res++;
    }
    cout<<res;
}



Measured memory_bytes: 256
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

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

N, K = In.ints()

P = In.ints()
C = [-1] + In.ints()

connection = [-1 for i in range(N+1)]

for i in range(N):
    connection[i+1] = P[i]

ans = -99999999999

for i in range(1, N+1):
    start = connection[i]
    tempans = C[start]
    tempk = K-1

    ans = max(ans, tempans)
    seen = [False for i in range(N+1)]
    seen[start] = True    

    while tempk > 0:
        nex = connection[start]
        if not seen[nex]:
            start=nex
            seen[start]=True
            tempans += C[start]
            ans = max(ans, tempans)
            tempk-=1            
        else:
            break
    
    if tempk>N:
        if tempans<0:
            continue
        
        
        stepsround = K-tempk
        howManyRounds = (tempk//stepsround)-1

        tempans += tempans*howManyRounds
        tempk-=howManyRounds*stepsround

        ans = max(ans, tempans)
    
    while tempk > 0:        
        start=connection[start]            
        tempans += C[start]
        ans = max(ans, tempans)
        tempk-=1            



Out.int(ans)


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

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Measured memory_bytes: 87648
#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#include <utility>
using namespace std;
#define omajinai ios::sync_with_stdio(false);cin.tie(nullptr);

#pragma region typedef 
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> P;
#pragma endregion

#pragma region define
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#pragma endregion

#pragma region const
const ld PI = 3.141592653589793;
const ll INF18 = 1e18;
#pragma endregion

#pragma region function
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;
}
#pragma endregion

ll h[100010];
ll dp[100010];

int main(){
omajinai;
    int n; cin >> n;
    rep(i, n) cin >> h[i];
    for(int i = 1; i < 100010; i++)
      dp[i] = INF18;
  
    for(int i = 1; i < n; i++){
        chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
        if(i > 1){
            chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
        }
    }
    cout << dp[n-1];
return 0;
}


Measured memory_bytes: 5156
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <climits>
#include <string>
#include <set>
#include <cmath>
#include <map>
#include <unordered_map>
#include <numeric>
#include <random>
#include <memory>
#include <chrono>
#include <functional>
#include <unordered_set>
#include <cstring>
#include <cassert>
#include <bitset>
#ifdef LOCAL
#include "debug.h"
#else
#define debug(x...)
#endif
//#define int ll
//#pragma GCC optimize("Ofast")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
#define sz(x) int((x).size())

mt19937 rng(229);

const int N = 2e5 + 7;
const int inf = INT_MAX / 2;
const ll INF = LLONG_MAX / 3;
const int MOD = 998244353;
const ld eps = 1e-6;
const string cars[] = {"🚗", "🚕", "🚙"};

ll fact[N];

ll modpow(ll b, ll e) {
	if (e == 0) {
		return 1;
	}
	if (e % 2) {
		return (b * modpow(b, e - 1)) % MOD;
	}
	else {
		return modpow((b * b) % MOD, e / 2);
	}
}

ll inv(ll x) {
	return modpow(x, MOD - 2);
}

ll C(ll n, ll k) {
	return (((fact[n] * inv(fact[k])) % MOD) * inv(fact[n - k])) % MOD;
}

signed main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	cout << fixed << setprecision(9);
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	fact[0] = 1;
	for (int i = 1; i < N; i++) {
		fact[i] = (fact[i - 1] * i) % MOD;
	}

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

	ll ans = 0;
	for (int i = 0; i <= k; i++) {
		ll t = C(n - 1, i);
		t = (t * modpow(m - 1, n - i - 1)) % MOD;
		t = (t * m) % MOD;
		//debug(t);
		ans = (ans +  t) % MOD;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5208
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<strings.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	while(a!=0&&b!=0){
		for(int i=0;i<a;i++){
			for(int k=0;k<b;k++){
				cout<<"#";
			}
			cout<<endl;
		}
		cout<<endl;
		cin>>a>>b;
	}
}



Measured memory_bytes: 3088
n = int(input())
s = input()
ans = 0
for i in range(10):
    a = s.find(str(i))
    if a == -1: continue
    for j in range(10):
        b = s.find(str(j), a+1)
        if b == -1: continue
        for k in range(10):
            if s.find(str(k), b+1) != -1:
                ans += 1
print(ans)

Measured memory_bytes: 3188
#include <stdio.h>

int main( void )
{
	int r, c, i, j, a[101][101] = { 0 };
	
	scanf("%d %d", &r, &c);
	
	for(i = 0; i < r; i++){
		for(j = 0; j < c; j++){
			scanf("%d", &a[i][j]);
			a[i][c] += a[i][j];
			a[r][j] += a[i][j];
			a[r][c] += a[i][j];
		}
	}
	
	for(i = 0; i < r+1; i++){
		for(j = 0; j < c; j++){
			printf("%d ", a[i][j]);
		}
		printf("%d\n", a[i][c]);
	}
	
	return 0;
}

Measured memory_bytes: 648
#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;

#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0);
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
	ll r=1;
	a=a%m;
	while(b>0)
	{
	if(b&1)
		r=(r*a)%m;
	b=b/2;
	a=(a*a)%m;
	}
	return r%m;
}

int main() {
   ll n; cin>>n;
   string a,b; cin>>a>>b;
   string ans = "";
   rep(i,0,n)
   {
       ans.pb(a[i]);
       ans.pb(b[i]);
   }
   cout<<ans<<endl;
   return 0;
}
/*

*/


Measured memory_bytes: 256
s = input()
t = input()
cnt = 0
if len(s) + 1 == len(t):
    for i in range(len(s)):
        if s[i] == t[i]:
            cnt += 1
    if cnt == len(s):
        print("Yes")
    else:
        print("No")
else:
    print("No")


Measured memory_bytes: 9136
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // int64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int(void) {
  int num;
  scanf("%d", &num);
  return num;
}

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}

int get_int3(int *a1, int *a2, int *a3) {
  scanf("%d %d %d", a1, a2, a3);
  return 0;
}

#define NUM_MAX 100
#define INF 0x01010101

int main(void) {
    int vs, es;
    get_int2(&vs, &es);
    static int graph[NUM_MAX][NUM_MAX];
    memset(graph, 0x01, sizeof(int)*NUM_MAX*NUM_MAX);
    int i;
    for(i = 0; i < es; i++) {
        int v1, v2, cost;
        get_int3(&v1, &v2, &cost);
        // 1-indexed -> 0-indexed
        v1--; v2--;
        graph[v1][v2] = graph[v2][v1] = cost;
    }
    static int origin[NUM_MAX][NUM_MAX];
    memcpy(origin, graph, sizeof(int)*NUM_MAX*NUM_MAX);

    int j, k;
    // Warshall floyd
    for(k = 0; k < vs; k++) {
        for(i = 0; i < vs; i++) {
            for(j = 0; j < vs; j++) {
                graph[i][j] = min(graph[i][j], graph[i][k]+graph[k][j]);
            }
        }
    }

    int cnt = 0;
    for(i = 0; i < vs; i++) {
        for(j = i+1; j < vs; j++) {
            if(origin[i][j] == INF) continue;
            if(origin[i][j] != graph[i][j]) cnt++;
        }
    }
    printf("%d\n", cnt);
    return 0;
}

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

using namespace std;
int main()
{
	int a, b, c, d;
	vector<int> v, q ;
	string s;
	cin >> s;
	a = s[0] - '0';
	b = s[1] - '0';
	c = s[2] - '0';
	d = s[3] - '0';
	if (a + b + c + d == 7) {
		cout << a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7";
		return 0;
	}
	if (a + b + c - d == 7) {
		cout << a << "+" << b << "+" << c << "-" << d << "=7";
		return 0;
	}
	if (a + b - c + d == 7) {
		cout << a << "+" << b << "-" << c << "+" << d << "=7";
		return 0;
	}
	if (a + b - c - d == 7) {
		cout << a << "+" << b << "-" << c << "-" << d << "=7";
		return 0;
	}
	if (a - b + c + d == 7) {
		cout << a << "-" << b << "+" << c << "+" << d << "=7";
		return 0;
	}
	if (a - b + c - d == 7) {
		cout << a << "-" << b << "+" << c << "-" << d << "=7";
		return 0;
	}
	if (a - b - c + d == 7) {
		cout << a << "-" << b << "-" << c << "+" << d << "=7";
		return 0;
	}
	if (a - b - c - d == 7) {
		cout << a << "-" << b << "-" << c << "-" << d << "=7";
		return 0;
	}
}

Measured memory_bytes: 256
k, n = map(int, input().split())
a = list(map(int, input().split()))
dmax = k - (a[n - 1] - a[0])
for i in range(n - 1):
    if (a[i + 1] - a[i]) > dmax:
        dmax = a[i + 1] - a[i]
print(k - dmax)

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

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

  int a=-1,b=-1,c=-1;
  for(int i=0;i<=n;i++){
  	for(int j=0;j<=n-i;j++){
        	if(10000*i+5000*j+1000*(n-i-j)==y){
              a=i;
              b=j;
              c=n-i-j;
            }
    }
  }

  	cout << a << ' '<< b << ' ' << c;
}



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

int main(){
    int A,B,C;
    string s;
    cin >> A >> B >> C;
    if(A+B+C>=22){
        s="bust";
    }else{
        s="win";
    }
    cout << s<<endl;
}


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

string s;
int joi,ioi;

int main(){
	while(cin >> s){
		joi = ioi = 0;
		for(int i = 0; i < s.size() - 1; i++){
			if(s[i+2] == 'I' && s[i+1] == 'O'){
				if(s[i] == 'J'){
					joi++;
				}
				else if(s[i] == 'I'){
					ioi++;
				}
			}
		}
		cout << joi << endl << ioi << endl;
	}
	return 0;
}

Measured memory_bytes: 3108
import java.util.Scanner

fun main(args: Array<String>) {
	val arr = arrayOf(1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
	val scn = Scanner(System.`in`)
	val k = scn.nextInt()-1
	print(arr[k])
}

Measured memory_bytes: 31388
n,m,c=map(int,input().split())
b=input().split()
a=[input().split()for _ in range(n)]
s=ans=0

for i in range(n):
  for j in range(m):
    s+=int(b[j])*int(a[i][j])

  s+=c
  if s>0:
    ans+=1
  s=0

print(ans)

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

int main(){
  int n,m,k,flag=0;
  cin >> n >> m >> k;
  if(n)
  for(int i=0;i<=n;i++){
    for(int j=0;j<=m;j++){
      if(k==i*m+j*n-i*j*2) flag = 1;
    }
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int main(){
    fastio;
    long long n,a,b;
    cin >> n >> a >> b;
    long long di = b-a;
    if(di%2==0){cout << di/2 <<"\n";}
    else{
        long long ans = (b-a-1)/2;
        cout << ans+min(a-1,n-b)+1 <<"\n";
    }
    return 0;
}


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

n, m = map(int, input().split())
P = list(map(int, input().split()))
P = [p-1 for p in P]
def Find(x, par):
    if par[x] < 0:
        return x
    else:
        par[x] = Find(par[x], par)
        return par[x]

def Unite(x, y, par, rank):
    x = Find(x, par)
    y = Find(y, par)

    if x != y:
        if rank[x] < rank[y]:
            par[y] += par[x]
            par[x] = y
        else:
            par[x] += par[y]
            par[y] = x
            if rank[x] == rank[y]:
                rank[x] += 1

def Same(x, y, par):
    return Find(x, par) == Find(y, par)

def Size(x, par):
    return -par[Find(x, par)]

par = [-1]* n
rank = [0]*n

for i in range(m):
    x, y = map(int, input().split())
    x, y = x-1, y-1
    Unite(x, y, par, rank)

ans = 0
for i, p in enumerate(P):
    if Same(i, p, par):
        ans += 1
print(ans)


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


int main(){
  
  int N, a;
  cin >> N;
  vector<long long> x(N + 1);
  x.at(0) = 2; x.at(1) = 1;
  
  if(N == 0){
    printf("2");
  }
   else if(N == 1){
    printf("1");
  }
  
  else{
  for(int i = 2; i <= N; i++){
    x.at(i) = x.at(i - 1) + x.at(i - 2);
  }
  cout << x.at(N) << endl;
  }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();

        int eCnt = 0;
        for(int i = 1; i < s.length(); i++)
        	if(s.charAt(i) == 'E') eCnt++;

        int[] ws = new int[n];
        int[] es = new int[n];
        ws[0] = 0;
        es[0] = eCnt;

        for(int i = 1; i < n; i++) {
        	char c = s.charAt(i-1);
        	if(c == 'W') 
        		ws[i] = ws[i-1] + 1;
        	else
        		ws[i] = ws[i-1];
        	c = s.charAt(i);
        	if(c == 'E')
        	    es[i] = es[i-1] - 1;
        	else
        	    es[i] = es[i-1];
        }
        int min = n-1;
        for(int i = 0; i < n; i++) {
        	min = Math.min(min, ws[i] + es[i]);
        }
        System.out.println(min);
    }
}


Measured memory_bytes: 31072
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<climits>
#include<queue>

typedef long long LL;
using namespace std;
#define pb push_back
#define mp make_pair
#define x first
#define y second

int read()
{
	int x = 0, f = 1; char c = getchar();
	while(!isdigit(c)) { if(c == '-') f = 0; c = getchar(); }
	while(isdigit(c)) { x = (x * 10) + (c ^ 48); c = getchar(); }
	return f ? x : -x;
}

const int maxn = 8e5 + 10, maxm = maxn;
int to[maxm], nxt[maxm], head[maxn], cap[maxm], e, dep[maxn], flow[maxm], vis[maxn], s, t, cur[maxn];
pair<int, int> p[maxn];

void add(int x, int y, int z)
{
	to[++e] = y; nxt[e] = head[x]; head[x] = e; cap[e] = z;
	to[++e] = x; nxt[e] = head[y]; head[y] = e; cap[e] = 0;
}

int bfs()
{
	for(int i = s; i <= t; ++i) dep[i] = 0;
	queue<int> Q;
	dep[s] = 1; Q.push(s);
	while(!Q.empty())
	{
		int u = Q.front(); Q.pop();
		for(int i = head[u]; i; i = nxt[i])
		{
			int v = to[i];
			if(!dep[v] && cap[i] > flow[i])
			{
				dep[v] = dep[u] + 1;
				Q.push(v);
			}
		}
	}
	if(dep[t]) 
	{
		for(int i = s; i <= t; ++i) cur[i] = head[i];
		return 1;
	}
	return 0;
}

int dfs(int x, int a)
{
	if(x == t || a == 0) return a;
	int FLOW = 0, f;
	for(int &i = cur[x]; i; i = nxt[i])
	{
		int v = to[i];
		if(dep[v] == dep[x] + 1 && (f = dfs(v, min(a, cap[i] - flow[i]))) > 0)
		{
			FLOW += f;
			a -= f;
			flow[i] += f; flow[i ^ 1] -= f;
			if(!a) return FLOW;
		}
	}
	return FLOW;
}

int main()
{

	int n = read();
	e = 1; s = 0; t = n + n;
	for(int i = 1; i < n; ++i)
	{
		int m = read();
		for(int j = 1; j <= m; ++j)
		{
			int x = read();
			add(x, i + n, 1);
		}
	}

	for(int i = 2; i <= n; ++i) add(s, i, 1);
	for(int i = n + 1; i <= n + n - 1; ++i) add(i, t, 1);

	int All = 0;
	while(bfs()) All += dfs(s, 0x3f3f3f3f);
	if(All != n - 1) return puts("-1"), 0;
	for(int u = 2; u <= n; ++u)
		for(int i = head[u]; i; i = nxt[i]) if(cap[i] == flow[i] && to[i] != s)
			p[to[i]].x = u;

	queue<int> Q; Q.push(1);
	int fg = n - 1;
	while(!Q.empty())
	{
		int u = Q.front(); Q.pop();
		for(int i = head[u]; i; i = nxt[i]) if(to[i] != s && !vis[to[i]])
			p[to[i]].y = u, vis[to[i]] = 1, Q.push(p[to[i]].x), --fg;
	}
	if(fg) return puts("-1"), 0;

	for(int i = n + 1; i <= n + n - 1; ++i) printf("%d %d\n", p[i].x, p[i].y);
 
	return 0;
}

Measured memory_bytes: 28228
n, u, v = gets.split.map(&:to_i)
nodes = Array.new(n + 1) { [] }
$stdin.read.split.each_slice(2) do |a, b|
  a = a.to_i
  b = b.to_i
  nodes[a] << b
  nodes[b] << a
end


def distance(nodes, start)
  ary = Array.new(nodes.size)
  ary[0] = -1

  q = [start]
  0.upto(Float::INFINITY) do |m|
    break if q.delete_if { |n| ary[n] }.empty?

    q = q.flat_map do |n|
      ary[n] = m
      nodes[n]
    end
  end

  ary
end


u_dist = distance(nodes, u)
v_dist = distance(nodes, v)

m = u_dist.zip(v_dist).map { |u, v| u < v ? v - 1 : 0 }.max
puts m


Measured memory_bytes: 44284
#include <stdio.h>
#include <stdlib.h>

typedef struct P{
    int num;
    int left;
    int right;
}Node;

void pre(Node node[],int n){
    if(n==-1){return;}
    printf(" %d",node[n].num);
    pre(node,node[n].left);
    pre(node,node[n].right);
}

void ino(Node node[],int n){
    if(n==-1){return;}
    ino(node,node[n].left);
    printf(" %d",node[n].num);
    ino(node,node[n].right);
}

int insert(Node node[],int n,int x,int num){
    int ii=0;
    if(n==-1||node[n].num==-1){
        node[x].num = num;
        return x;
    }else if(node[n].num>num){
        ii = insert(node,node[n].left,x,num);
        if(ii!=0){
            node[n].left = ii;
        }
    }else{
        ii = insert(node,node[n].right,x,num);
        if(ii!=0){
            node[n].right = ii;
        }
    }
    return 0;
}

int find(Node node[],int n,int num){
    if(n==-1){return 0;}
    else if(node[n].num>num){return find(node,node[n].left,num);}
    else if(node[n].num<num){return find(node,node[n].right,num);}
    else{return 1;}
}

int main(void){
    int n,i,j,x,y;
    char str[7];
    Node *node;
    scanf("%d",&n);
    node = (Node*)malloc(sizeof(Node)*n);
    for(i=0;i<n;i++){
        node[i].num = -1;
        node[i].left = -1;
        node[i].right = -1;
    }
    x = 0;
    for(i=0;i<n;i++){
        scanf("%s",str);
        if(str[0]=='i'){
            scanf("%d",&y);
            insert(node,0,x,y);
            x++;
        }else if(str[0]=='f'){
            scanf("%d",&y);
            y = find(node,0,y);
            if(y==1){printf("yes\n");}
            else{printf("no\n");}
        }else{
            ino(node,0);
            printf("\n");
            pre(node,0);
            printf("\n");
        }
    }
    return 0;
}



Measured memory_bytes: 7628
a,b,c = map(int,input().split())
y = 0
for num in range(a + 1):
  s = 0
  x = num
  while x > 0:
    s += int(x % 10)
    x = int(x / 10)
  if s >= b and s <= c:
    y += num
print(y)

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

int main() {
    int a, b;
    cin >> a >> b;
    if(a < b){
        for(int i = 0; i < b; i++){
            cout << a;
        }
    }
    else if (a > b){
        for(int i = 0; i < a; i++){
            cout << b;
        }
    }
    else{
        for(int i = 0; i < a; i++){
            cout << a;
        }
    }

}


Measured memory_bytes: 3648
#include<iostream>
#include<string>
using namespace std;
string s,d;
int main(){
  int n,cnt = 0;
  cin >> n;
  cin >> d;
  while(n--){
    cin >> s;
    for(int i = 0 ; i < s.size() ; i++ ){
      for(int j = 1 ; j < s.size() ; j++ ){
        string tmp;
        for(int k = 0 ;i + j * k < s.size() ; k++ ){
          tmp += s[i + j * k];
          if(tmp == d){
            cnt++;
            goto a;
          }
        }
      }
    }
  a:;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 1212
#include <iostream>
#include <vector>
#include <string>
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;

  cin >> n;
  bool OK = false;
  for(int i = 0; i < 26; i++){ //4dollers
    for(int j = 0; j < 15; j++){ //7dollers
      if(n == 4 * i + 7 * j){
        OK = true;
        break;
      }
    }
  }
  if(OK == false){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
main(){
  int n[10],a,b,i,nsum,m;
  while(scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",&n[0],&n[1],&n[2],&n[3],&n[4],&n[5],&n[6],&n[7],&n[8],&n[9],&a,&b) !=EOF){
    double t=0,x;
    nsum=0;
   for(i=0;i<10;i++){
     nsum+=n[i];
   }
   t=nsum/(double)(a+b);
   x=t*(double)a;
   m=0;
   for(i=0;i<10;i++){
     if((double)x-m>0&&(double)x-m<n[i]){
       i++;
       break;
     }
     else if(x-m==0) break;
     else m+=n[i];
   }
   printf("%d\n",i);

  }
  return 0; 
}

Measured memory_bytes: 0
N,K = map(int,input().split())
S = input()

hm_1 = [0] * N
hm_2 = [0] * N

for i in range(N-1,-1,-1):
	if i == N-1:
		if S[i] == '1':
			hm_1[i] = 1
	else:
		if S[i] == '0':
			hm_1[i] = 0
		else:
			hm_1[i] = hm_1[i+1] + 1
		
for i in range(N-1,-1,-1):
	if i == N-1:
		if S[i] == '0':
			hm_2[i] = 1
	else:
		if S[i] == '1':
			hm_2[i] = 0
		else:
			hm_2[i] = hm_2[i+1] + 1
#print (hm_1)
#print (hm_2)


rl = []
# run length 
# 1 - 0 - 1 - 0 - 1 - ...
i = 0
if hm_1[i] == 0:
	rl.append(0)
while i < N :
	if hm_1[i] != 0:
		rl.append(hm_1[i])
		i += hm_1[i]
	else:
		rl.append(hm_2[i])
		i += hm_2[i]

#print (rl)
# rl: index==even -> '1', index==odd -> '0'
# s : sum list
#rl.append(0)
s = [0] * (len(rl) + 1)


for j in range(len(rl)):
	s[j+1] = s[j] + rl[j]
#print (s)

ans = 0
for ra in range(0,len(s),2):
	tmp = 0
	right = min(ra + 2 * K + 1, len(s)-1)
	tmp = s[right] - s[ra]
	ans = max(tmp,ans)

print (ans)



Measured memory_bytes: 9552
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <bitset>
#include <set>
#include <iomanip>
#include <functional>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'a' = 97

int main()
{
    int x;
    cin >> x;
    if (x == 3 || x == 5 || x == 7) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>

typedef  long long ll;
#define mop 1000000007
#define mop2 998244353

using namespace std;

template <typename T>
map<T, T> prime_factor(T n) {
	map<T, T> res;
	for (T i = 2; i*i <= n; i++) {
		while (n%i == 0) {
			++res[i];
			n /= i;
		}
	}
	if (n != 1) {
		res[n] += 1;
	}
	return res;
}

int main() {
	ll n;
	cin >> n;
	map <ll, ll> primeList = prime_factor(n);
	ll ans = 0;
	for (auto itr = primeList.begin(); itr != primeList.end(); itr++) {
		ll tmp = itr->second;
		ll tmp_int = 1;
		while (true) {
			if (tmp >= tmp_int) {
				ans++;
				tmp -= tmp_int;
				tmp_int++;
			}
			else {
				break;
			}
		}
	}
	cout << ans << endl;
}
	

Measured memory_bytes: 3584
#Union Find
#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]


N,M = map(int,input().split())
#初期化
#根なら-size,子なら親の頂点
par = [-1]*(N+1)

for i in range(0,M,1):
    x,y,z = map(int,input().split())
    unite(x,y)

ans = 0
for i in range(1,N+1,1):
    if par[i] < 0:
        ans +=1
print(ans)


Measured memory_bytes: 67160
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<utility>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<unordered_set>
#include<unordered_map>
#include<set>
#include<map>
#include<list>

using namespace std;
using ll = long long;

#define in(s) cin >> s
#define out(s) cout << s << endl
#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define pcnt __builtin_popcount
#define pcntll(x) __builtin_popcountll(x)
#define DMAX DBL_MAX;
#define IMIN INT_MIN;
#define IMAX INT_MAX;

const long long MOD = 1e9+7;
const long long MAX = 3e5+1;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    int K;
    string S;
    in(K);
    in(S);

    int n = S.size();
    if (n <= K) out(S);
    else {
        S = S.substr(0, K);
        S += "...";
        out(S);
    }

    return 0;
}


Measured memory_bytes: 3656
#include<iostream>
#include<vector>
//#include<math.h>
#include <unordered_map>
using namespace std;

int main()
{
    int a,b;
    int p,q,r;
    int ans;
    cin>>a>>b;
    
    ans=a+b;

    if(ans<a-b)
    {
        ans=a-b;
    }

    if(ans<a*b)
    {
        ans=a*b;
    }
    cout<<ans<<endl;
}

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

using namespace std;
typedef long long ll;
const int N = 1e5 + 10;
ll a[N];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    ll n;
    cin >> n;
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    if (sum % (n * (n + 1) / 2) != 0) {
        cout << "NO\n";
        return 0;
    }
    sum /= n * (n + 1) / 2;
    for (int i = 0; i < n; i++) {
        ll w = sum - a[(i + 1) % n] + a[i];
        if (w < 0 || w % n != 0) {
            cout << "NO\n";
            return 0;
        }
    }
    cout << "YES\n";
    return 0;
}


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

using namespace std;
using LLONG = long long;

int main()
{
    string S;
    cin >> S;
    sort(S.begin(), S.end());
    if (S == "abc")
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 1e9+7;

int mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}


void solve()
{
   int n;
    cin >> n;
    
   int a[n];
    f(i,n) cin >> a[i];
   
   int tot = 0;
    
   f(i,n) tot^=a[i];
    
   f(i,n) cout <<((tot^a[i])) << ' '; 
    
    
}

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

Measured memory_bytes: 5200
n, k = map(int, input().split())
TD = [[] for i in range(n)]
for i in range(n):
  TD[i] = list(map(int, input().split()))
  
TD.sort(key = lambda x:x[1], reverse = True)

ans = 0
huku = []
su = set([])

for i, j in TD[:k]:
  ans += j
  if i in su:
    huku.append([i,j])
  su.add(i)
ans += len(su)**2
huku.sort(key = lambda x:x[1], reverse = True)

ansl = []
ansl.append(ans)
for i,j in TD[k:]:
  if i in su:
    continue
  elif huku == []:
    break
  else:
    temp = ansl[-1] + j - huku.pop()[1] + (len(su)+1)**2 -len(su)**2
    su.add(i)
    ansl.append(temp)

print(max(ansl))


Measured memory_bytes: 32964
function PriorityQueue() {
    this.heap = [];
}

PriorityQueue.prototype = {
    push : function(x){
        var h = this.heap, i = h.length++, j;
        while(i){
            j = i-1 >> 1;
            if(h[j] <= x)break;
            h[i] = h[j];
            i = j;
        }
        h[i] = x;
    },
    pop : function(){
        var h = this.heap, r = h[0], x = h.pop();
        var i = 0, k = h.length >> 1, j;
        while (i < k) {
            j = (i << 1) + 1;
            if(h[j+1] < h[j])++j;
            if(x <= h[j])break;
            h[i] = h[j];
            i = j;
        }
        if(h.length)h[i] = x;
        return r;
    },
    size : function(){return this.heap.length;},
    top : function(){return this.heap[0];},
};



function Main(arg)
{
  var N = arg.split("\n")[0] - 0;
  var a = arg.split("\n")[1].split(" ").map(Number);

  var q = new PriorityQueue();
  for (var i = 0; i < N; i++){
    q.push(a[i]);
  }

  while (q.size() > 1) {
    var x = q.pop();
    var y = q.pop();
    var tmp = (x + y) / 2.0;
    q.push(tmp);
  }

  console.log(q.pop());
  return;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21320
#include <bits/stdc++.h>
#include <map>
#include <cmath>
typedef long long int ll;
using namespace std; 
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	ll n,a,b;cin>>n>>a>>b;
	ll ans=0;
	if(abs(a-b)%2==0){
		ans = abs(a-b)/2;
	}
	else{
		ans = min(a-1,n-b)+1+(b-a-1)/2;
	}
	cout<<ans<<endl;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
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; }
//template end



int main(){
   int n; scanf("%d",&n);
   vector<int> a(n),b(n);
   rep(i,0,n)scanf("%d",&a[i]);
   rep(i,0,n)scanf("%d",&b[i]);
   set<int> res; rep(i,1,51)res.insert(i);
   auto f=[&](const set<int>& st){
      bool g[51][51]={}; rep(i,0,51)g[i][i]=1;
      for(int k:st)rep(i,0,51)g[i][i%k]=1;
      rep(k,0,51)rep(i,0,51)rep(j,0,51)if(g[i][k]&&g[k][j])g[i][j]=1;
      bool res=0;
      rep(i,0,n)if(!g[a[i]][b[i]])res=1;
      return res;
   };
   if(f(res)){puts("-1"); return 0;}
   rrep(rot,50,0){
      set<int> sub=res; sub.erase(rot);
      if(!f(sub))res.erase(rot);
   }
   ll r=0; for(int k:res)r+=(1LL<<k);
   printf("%lld\n",r);
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define P pair<long long, long long>

using namespace std;

int main(){
  long long n, d, a;
  P p[200009];
  cin >> n >> d >> a;
  for(int i=0;i<n;i++){
    long long x, h;
    cin >> x >> h;
    p[i] = P(x, h);
  }
  sort(p, p+n);
  priority_queue<P, vector<P>, greater<P> > q;
  long long total=0;
  long long cnt=0;
  for(int i=0;i<n;i++){
    while(!q.empty()&&q.top().first<p[i].first){
      total -= q.top().second;q.pop();
    }
    if(total<p[i].second){
      long long add = (p[i].second-total-1)/a + 1;
      cnt += add;
      total += add*a;
      q.push(P(p[i].first+2*d, add*a));
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 8376
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

int main() {
	int N; cin >> N;
	map<string, int> mp;
	while (N--) {
		string si; cin >> si;
		++mp[si];
	}
	int mx = 0;
	for (auto& e : mp)
		mx = max(mx, e.second);
	vector<string> res;
	for (auto& e : mp)
		if (e.second == mx)
			res.push_back(e.first);
	sort(res.begin(), res.end());
	for (auto s : res) cout << s << endl;
	return 0;
}

Measured memory_bytes: 26868