akhauriyash/Code-Regression huggingface dataset:
// from https://blog.csdn.net/qq_37383726/article/details/79564065
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

const int N = 5e5 + 11;
const int M = 500000 + 11;
const int MAX = 5e5 + 11;

int readint()  //用于整数
{
    char c;
    while (c = getchar(), '-' != c && !isdigit(c))
        if (c == EOF) return EOF;
    int f = 1;
    if ('-' == c) f = -1, c = getchar();
    int x = c - '0';
    while (isdigit(c = getchar())) x = x * 10 + c - '0';
    return x * f;
}

void write(int a)
{  //用于正整数
    if (a > 9) write(a / 10);
    putchar(a % 10 + '0');
}

int B;
struct Query
{
    int le, ri;
    int id;
    bool operator<(const Query& b) const
    {
        if (le / B == b.le / B)
            return ri < b.ri;
        else
            return le / B < b.le / B;
    }
} Q[M];
int ANS[M];

int cnt[MAX];
int a[N];
int ans;
void Add(int x)
{
    x = a[x];
    if (cnt[x] == 0) ans++;
    cnt[x]++;
}
void Del(int x)
{
    x = a[x];
    cnt[x]--;
    if (cnt[x] == 0) ans--;
}

void solve(int q)
{
    sort(Q + 1, Q + q + 1);
    // memset(cnt, 0, sizeof(cnt));
    int L = 1, R = 0;
    ans = 0;
    for (int i = 1; i <= q; i++)
    {
        while (R < Q[i].ri) Add(++R);
        while (R > Q[i].ri) Del(R--);
        while (L < Q[i].le) Del(L++);
        while (L > Q[i].le) Add(--L);

        ANS[Q[i].id] = ans;
    }
    for (int i = 1; i <= q; i++)
    {
        write(ANS[i]);
        puts("");
    }
}

int n, q;
int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
#endif
    n = readint();
    q = readint();
    B = (int)sqrt(n * 1.0);
    for (int i = 1; i <= n; i++) a[i] = readint();
    for (int i = 1; i <= q; i++)
    {
        Q[i].le = readint();
        Q[i].ri = readint();
        // scanf("%d%d", &Q[i].le, &Q[i].ri);
        Q[i].id = i;
    }
    solve(q);
    return 0;
}

Measured memory_bytes: 15456
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
mod = 10**9+7
if N<2:
    print(0)
    exit()

full = pow(10, N, mod)
# 0を含まない
zero = pow(9, N, mod)
# 9を含まない
nine = pow(9, N, mod)
# 0, 9を一つも含まない
zero_nine = pow(8, N, mod)

ans = (full-zero-nine+zero_nine)%mod
print(ans)


Measured memory_bytes: 61740
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(),v.end()
#define pii pair< ll,ll>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define ll long long int
#define mod 1000000007
#define mxn 100010
#define sqr 700
#define mx 600003
ll arr[mx],dp[mx][2];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll n;
  cin>>n;
  string s;
  ll i;
  for(i=1;i<=n;i++)
    cin>>arr[i];
  ll su=0 ,xo=0 , len=0,ans=0;
  ll tol=0;
  for(i=1;i<=n;i++)
  {
    dp[i][0]=dp[i-1][0]+arr[i];
    dp[i][1]=dp[i-1][1]^arr[i];
  }
  for(i=1;i<=n;i++)
  {
    ll lo=i,hi=n+1;
    while(hi-lo>1)
    {
      ll mid=(lo+hi)/2;
      if((dp[mid][0]-dp[i-1][0])==(dp[mid][1]^dp[i-1][1]))
        lo=mid;
       else
       hi=mid-1;
        //cout<<i<<" "<<mid<<' '<<(dp[mid][0]-dp[i-1][0])<<" "<<(dp[mid][1]^dp[i-1][1])<<endl;

    }

    if(lo!=n and (dp[lo+1][0]-dp[i-1][0])==(dp[lo+1][1]^dp[i-1][1]))
    lo=lo+1;
    if(tol<i)
    ans+=(lo-i+1)*(lo-i+2)/2;
    else
    {
      if(tol>=lo)
        continue;
      else
    {
     ans+=(tol-i+1)*(lo-tol)+(lo-tol)*(lo-tol+1)/2; 
    }
    }
    tol=max(tol,lo);
  }
  cout<<ans;
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int A, B, M;
int a[112345], b[112345];

int main() {
	cin >> A >> B >> M;
	REP(i, A) scanf("%d", a + i);
	REP(i, B) scanf("%d", b + i);
	
	ll ans = *min_element(a, a + A) + *min_element(b, b + B);
	while (M--) {
		int x, y, c;
		scanf("%d %d %d", &x, &y, &c);
		--x; --y;
		chmin(ans, a[x] + b[y] - c);
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	string res = "Yay!";
    int n = 5;
    int k;
    vector<int> nums;
	for (int i = 0; i < n; i++) {
        int num;
        cin >> num;
        nums.push_back(num);
    }
    cin >> k;
    for (int i = 0; i < n - 1; i++) {
        for (int j = i+1; j <= n; j++) {
            if (nums[j] - nums[i] > k) {
                res = ":(";
                break;
            }
        }
    }
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int> l(n);
  for(int i=0;i<n;i++)
    cin >> l.at(i);
  
  int x=0,sum=0;
  for(int i=0;i<n;i++){
    sum += l.at(i);
    x = max(x,l.at(i));
  }

  //--output--
  if(sum - x > x)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

#define n_l '\n'
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]: "; cout << to_string(__VA_ARGS__) << endl
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(const string s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c){ return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgm(){;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgm(T...); } 
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    // ll s,w;
    // cin>>s>>w;
    // if(s>w)
    //     cout<<"safe";
    // else 
    //     cout<<"unsafe";
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    for(ll i=0;a>0 and c>0;i++)
    {
        if(i%2==0)
        c-=b;
        else
        {
            a-=d;
        }
        
    }
    if(a<=0)
    {
        cout<<"No";
    }
    else
    {
        cout<<"Yes";
    }
    
    return 0;
}

Measured memory_bytes: 3656
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<cstdio>

using namespace std;
/*
int find(int x, vector<int> &p) {
if (p[x] == x)return x;
return p[x] = find(p[x], p);
}

void uni(int x, int y, vector<int> &p) {
x = find(x, p);
y = find(y, p);
p[x] = y;
}

int same(int x, int y, vector<int> p) {
if (find(x, p) == find(y, p))return 1;
return 0;
}
*/

//long long a[1002];


int main()
{
	long long N, K, cnt = 0, tmp, ans = 0;
	cin >> N >> K;

	if (N%K!=0) {
		ans = 1;
	}
		cout << ans;

	char qq;
	cin >> qq;
	return 0;
}

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

int main(void){
    int N,K;
    cin >> N;
    cin >> K;
    int now = 1;
    for (size_t i = 0; i < N; i++)
    {
        if (now*2<now+K)
        {
            now = now*2;
        }
        else
        {
            now = now+K;
        }
    }
    cout << now << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	
	// test #A
//	public static void main(String args[]) {
//		System.out.println("staring #1");
//		Scanner sc = new Scanner(System.in);
//		
//		int a = sc.nextInt();
//		
//		int b = sc.nextInt();
//		int c = sc.nextInt();
//		String s = sc.next();
//		
//		System.out.println(a+b+c+" "+s);
//		sc.close();
//	}

	// test #1  0322
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		String input = sc.next();		
		
		char array[] = input.toCharArray();
		
		boolean like = false;
		
		if ( (array[2] == array[3]) && (array[4]==array[5] ) )
			like = true;
		
		
		log( like ? "Yes" : "No" );
		sc.close();
	}

	static void log(String s) {
		System.out.println(s);
	}

	static void log(int i) {
		System.out.println(i);
	}
	
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
int main(){
    int ans=700;
    string S;
    cin>>S;
    char c=S.at(0);
    char d=S.at(1);
    char e=S.at(2);
    if(c=='o')ans+=100;
    if(d=='o')ans+=100;
    if(e=='o')ans+=100;
    cout <<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXV = 1010;
const int MAXE = 2010;
const int64_t INF = (1LL << 62);
struct edge
{
  int from, to, cost;
};
edge es[MAXE];

vector<int64_t> d(MAXV, INF);
bool BellmanFord(int s, int V, int E)
{
  d[s] = 0;
  for (int i = 0; i < V; i++)
  {
    for (int j = 0; j < E; j++)
    {
      edge e = es[j];
      if (d[e.from] == INF)
        continue;
      if (d[e.to] > d[e.from] + e.cost)
      {
        d[e.to] = d[e.from] + e.cost;
        if (i == V - 1)
        {
          return false;
        }
      }
    }
  }
  return true;
}

int main()
{
  int V, E, r, v, u, c;
  cin >> V >> E >> r;
  for (int i = 0; i < E; i++)
  {
    cin >> v >> u >> c;
    es[i] = {v, u, c};
  }
  if (BellmanFord(r, V, E))
  {
    for (int i = 0; i < V; i++)
    {
      if (d[i] == INF)
        cout << "INF" << endl;
      else
        cout << d[i] << endl;
    }
  }
  else
  {
    cout << "NEGATIVE CYCLE" << endl;
  }
}


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

int chck(int arra){
  int s=0;
  for(int i=0;i<8;i++){
  	s+=arra%2;
    arra/=2;
  }
  return s;
}

int min6(vector<int> Ldmy,int N,int A,int B,int C){
  int ans=0,sipi,w,ww,mini,ind,siz=0;
  
  vector<int> L(N,0);
  for(int i=0;i<N;i++){
    L[i]=Ldmy[i];
  }
  
  siz=(1<<N)-1;
  vector<vector<int>> x = vector<vector<int>>(siz, vector<int>(2,0));
  vector<int> LL(N,0);

  x[0][0]=L[0];
  x[0][1]=1<<0;
  w=1;
  ww=0;
  for (int j=1;j<N;j++){
    x[w][0]=L[j];
    x[w][1]=1<<j;
    w++;
    ww=w;
    for(int i=0;i<ww-1;i++){
        x[w][0]=x[i][0]+L[j];
        x[w][1]=x[i][1]+(1<<j);
      w++;
    }
  }
  
  mini=2000000000;
  ind=0;
  for (int i=0;i<siz;i++){
    if ((abs(x[i][0]-A)+chck(x[i][1])*10-10)<mini){
      if ((chck(x[i][1])+2)<=N){
        ind=x[i][1];
        mini=abs(x[i][0]-A)+chck(x[i][1])*10-10;
      }
    }
  }
  
  
  ans+=mini;
  N-=chck(ind);
  
  w=0;
  for(int i=0;i<N+chck(ind);i++){
    if ((ind&(1<<i))==0){
      LL[w]=L[i];
      w++;
    }
  }
  
  for(int i=0;i<N;i++){
    L[i]=LL[i];
  }
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  siz=(1<<N)-1;
  x[0][0]=L[0];
  x[0][1]=1<<0;
  w=1;
  ww=0;
  for (int j=1;j<N;j++){
    x[w][0]=L[j];
    x[w][1]=1<<j;
    w++;
    ww=w;
    for(int i=0;i<ww-1;i++){
        x[w][0]=x[i][0]+L[j];
        x[w][1]=x[i][1]+(1<<j);
      w++;
    }
  }
  
  
  
  mini=2000000000;
  ind=0;
  for (int i=0;i<siz;i++){
    if ((abs(x[i][0]-B)+chck(x[i][1])*10-10)<mini){
      if ((chck(x[i][1])+1)<=N){
        ind=x[i][1];
        mini=abs(x[i][0]-B)+chck(x[i][1])*10-10;
      }
    }
  }
  
  
  ans+=mini;
  N-=chck(ind);
  
  
  w=0;
  for(int i=0;i<N+chck(ind);i++){
    if ((ind&(1<<i))==0){
      LL[w]=L[i];
      w++;
    }
  }
  
  for(int i=0;i<N;i++){
    L[i]=LL[i];
  }
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  siz=(1<<N)-1;
  x[0][0]=L[0];
  x[0][1]=1<<0;
  w=1;
  ww=0;
  for (int j=1;j<N;j++){
    x[w][0]=L[j];
    x[w][1]=1<<j;
    w++;
    ww=w;
    for(int i=0;i<ww-1;i++){
        x[w][0]=x[i][0]+L[j];
        x[w][1]=x[i][1]+(1<<j);
      w++;
    }
  }
  
  
  
  mini=2000000000;
  ind=0;
  for (int i=0;i<siz;i++){
    if ((abs(x[i][0]-C)+chck(x[i][1])*10-10)<mini){
      if ((chck(x[i][1])+0)<=N){
        ind=x[i][1];
        mini=abs(x[i][0]-C)+chck(x[i][1])*10-10;
      }
    }
  }
  
  
  ans+=mini;
  N-=chck(ind);
  
  
  w=0;
  for(int i=0;i<N+chck(ind);i++){
    if ((ind&(1<<i))==0){
      LL[w]=L[i];
      w++;
    }
  }
  
  for(int i=0;i<N;i++){
    L[i]=LL[i];
  }
  
 
   return ans;
}


int main(){
  int N,A,B,C,rans;
  cin>>N>>A>>B>>C;
  
  
  vector<int> L(N,0);
  for(int i=0;i<N;i++){
    cin>>L[i];
  }
  
  vector<int> LL(N,0);
  for(int i=0;i<N;i++){
    LL[i]=L[i];
  }
  
  rans=min6(LL,N,A,B,C);
  rans=min(min6(LL,N,A,C,B),rans);
  rans=min(min6(LL,N,B,A,C),rans);
  rans=min(min6(LL,N,B,C,A),rans);
  rans=min(min6(LL,N,C,A,B),rans);
  rans=min(min6(LL,N,C,B,A),rans);
  
  
  
  cout<<rans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1e9;
typedef pair<int,int> P;
int main(){
    int n;
    cin >> n;
    vector<pair<string,P>> r(n);
    string s;
    int p;
    rep(i,n){
        cin >> s >> p;
        r[i] = make_pair(s,P(100-p,i+1));
    }
    SORT(r);
    rep(i,n) PRINT(r[i].second.second);
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;


int main()
{
	int x,y,z;
	cin >> x;
	if (x / 100 >= 20)cout << 1 << endl;
	else {
		y = x / 100;
		z = x % 100;
		if (5 * y >= z)cout << 1 << endl;
		else cout << 0 << endl;
	}

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#include <iomanip>


#define rep(i,n) for(int i=0; i< (n); ++i)

using namespace std;
int main()
{
  int N;
  cin >> N;

  cout << std::setprecision(10) << (N-(N / 2)) / (double)N << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;
using MIte = multimap<long, long, greater<long> >::iterator;

void Zalgo(string& S, vector<int>& vA) {
	vA.resize(S.length());
	vA[0] = S.size();
	int i = 1, j = 0;
	while (i < S.size()) {
		while (i + j < S.size() && S[j] == S[i + j]) ++j;
		vA[i] = j;
		if (j == 0) { ++i; continue; }
		int k = 1;
		while (i + k < S.size() && k + vA[k] < j) vA[i + k] = vA[k], ++k;
		i += k; j -= k;
	}
}

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

	// long long?
	int N;
	string S;
	cin >> N >> S;

	int ans = 0;
	rep(i, N) {
		string stmp = S.substr(i, S.length() - i);
		vector<int> vAtmp;
		Zalgo(stmp, vAtmp);

		int nmax = 0;
		for(int j = 1; j != stmp.length(); ++j) {
			if (vAtmp[j] > j) continue;
			nmax = max(vAtmp[j], nmax);
		}
		ans = max(ans, nmax);
	}
	
	cout << ans << endl;

	return 0;

}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::collections::VecDeque;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::collections::HashMap;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_variables)]
        #[allow(unused_mut)]
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("parse error")
    };
}

fn main() {
    input!{
        n: usize,
        m: usize,
        xx: i64,
        bd: [(i64, [i64; m]); n]
    }
    let mut f = false;
    let mut ans = std::i64::MAX;
    for i in 0..1<<n {
        let mut hold = 0;
        let mut ar = vec![0; m];
        for k in 0..n {
            let t = i & (1<<k);
            if t > 0 {
                let (c, d) = &bd[k];
                hold += c;
                (0..m).for_each(|x| ar[x] += d[x]);
            }
        }
        if !ar.iter().any(|&x| x < xx) {
            f = true;
            ans = cmp::min(ans, hold);
        }
    }
    println!("{}", if f {ans} else {-1})
}


Measured memory_bytes: 2176
#include<iostream>

using namespace std;

int main(){
    string S;
    cin >> S;
    int n = S.size();

    int ans = 0;

    for(int i=0; i<n/2; i++){
        if(S[i] != S[n-i-1]) ans ++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)

using namespace std;
typedef long long int ll;
typedef pair <int, int> P;
const ll MOD=1e9+7;
int par[1000];
int height[1000];
void init (int n){
    for (int i=0;i<n;i++){
        par[i]=i;
        height[i]=0;
    }
}
int find (int x){
    if (par[x]==x){
        return x;
    }
    else{
        return par[x] = find(par[x]);
    }
}
void unite (int x, int y){
    x=find(x);
    y=find(y);
    if (x==y) return;
    
    if (height[x] < height[y]){
        par[x]=y;
    }
    else {
        par[y]=x;
        if (height[x]==height[y]) height[x]++;
    }
}
bool same (int x, int y){
    return find(x) == find(y);
}
const int MAX_V=1000;
const int MAX_E=2000;
struct edge {int u, v; ll cost; };
bool comp(const edge& e1, const edge& e2){
    return e1.cost < e2.cost;
}
edge es[MAX_E];
int V, E;
ll X;
ll kruscal(int i){
    init(V);
    ll res=0;
    unite(es[i].u, es[i].v);
    res+=es[i].cost;
    rep(i,0,E){
        edge e=es[i];
        if (!same(e.u, e.v)){
            unite(e.u, e.v);
            res+=e.cost;
        }
    }
    return res;
}
ll mod_pow(ll x, ll n){
    if (n==0) return 1;
    ll res=mod_pow(x*x%MOD, n/2);
    if (n%2==1) res=res*x%MOD;
    return res;
}
ll extgcd(ll a, ll b, ll& x, ll&y){
    ll d=a;
    if(b!=0){
        d=extgcd(b, a%b, y, x);
        y-=(a/b)*x;
    }
    else {
        x=1; y=0;
    }
    return d;
}

ll mod_inverse(ll a){
    ll x,y;
    extgcd(a,MOD,x,y);
    return (MOD+x%MOD)%MOD;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>V>>E;
    cin>>X;
    rep(i,0,E){
        int u,v;
        ll w;
        cin>>u>>v>>w;
        es[i]=(edge{u-1,v-1,w});
    }
    int a=0, b=0;
    bool t=false;
    sort(es, es+E, comp);
    rep(i,0,E){
        ll s=kruscal(i);
        if(s==X){
            a++;
            if(i==0) t=true;
        }
        if(s>X) b++;
    }
    if(t) cout<<((mod_pow(ll(2),a)-2)*mod_pow(ll(2), b))%MOD<<"\n";
    else cout<<((mod_pow(ll(2),a)-1)*mod_pow(ll(2), b+1))%MOD<<"\n";
}

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

using namespace std;


int main(){

    int N;
    cin >> N;

    vector <int> ans;

    while(N > 0){
        int sum = 0;
        for (int i = 1; i <= N; i++){
            sum += i;
            if (sum >= N){
                ans.push_back(i);
                N = N - i;
                break;
            }
        }
    }

    for (int i = 0; i < ans.size(); i++){
        cout << ans[i] << endl;
    }
    

    return 0;
}

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

int main()
{
    double a , b , c ;
    cin >> a >> b >> c ;
    c = PI*c/180 ;
    double area = (a*b*sin(c))/2 ;
    double h = (2*area)/a ;
    double l = a + b + sqrt(a*a + b*b - 2*a*b*cos(c)) ;
    printf("%.8lf\n" , area) ;
    printf("%.8lf\n" , l) ;
    printf("%.8lf\n" , h) ;
}


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


using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 1010;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}



// Main Code
int main()
{
	int n, m;
	cin>>n>>m;
	ll x[n], y[n], z[n];
	rep(i, 0, n)
	{
		cin>>x[i]>>y[i]>>z[i];
	}
	ll ans = LONG_MIN;
	for(int i=-1; i <= 2; i+=2)
	{
		for(int j=-1; j<=2; j+=2)
		{
			for(int k=-1; k<=2; k+=2)
			{
				vector<ll> s(n);
				rep(q, 0, n) s[q] = x[q]*i + y[q]*j + z[q]*k;
				sort(s.rbegin(), s.rend());
				ll tans = 0;
				rep(i, 0, m) tans+= s[i];
				chmax(ans, tans);
			}
		}
	}
	cout<<ans<<endl;
}


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

int main() {
	int a, s, d, f, g;
	cin >> a >> s >> d >> f >> g;

	int sum = a + s + d + f + g;
	cout << 15 - sum << endl;
}


Measured memory_bytes: 3624
//Be Name Khoda
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma optimize O3
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using ordered_multiset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long int LL;
typedef LL ll;
typedef long double ld;
typedef string str;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef stringstream strs;
 
#define X first
#define Y second
#define PB push_back
#define For(i,a,b) for (int i=a;i<b;i++)
#define Ford(i,a,b) for (int i=a;i>=b;i--)
#define smax(a,b) a=max(a,b)
#define smin(a,b) a=min(a,b)
#define SZ(a) ((ll)a.size())
#define ER(a) cout << #a << ' ' << a << endl
#define LB(a,n,x) (lower_bound(a,(a)+(n),x)-(a))
#define RET(x) { cout << x; exit(0); } 
#define RETD(x) { cout << fixed << setprecision(15) << x; exit(0); }
const ll M=2e5+5,LG=32,SM=600+5,inf=1e18+5;
ll mod=1e9+7;

ll n;
ll lf[M],rf[M];
ll parv[M];
vector<pll> s[M];
ll V=0;

bool dfs(ll x)
{
    s[x].clear();
    if (lf[x]==-1)
    {
        s[x].PB({0,0});
        return 1;
    }
    ll a=lf[x],b=rf[x];
    if (!dfs(a) || !dfs(b))
        return 0;
    For(i,0,SZ(s[a]))
    {
        s[a][i].X+=parv[a];
        s[a][i].Y+=parv[a];
    }
    For(i,0,SZ(s[b]))
    {
        s[b][i].X+=parv[b];
        s[b][i].Y+=parv[b];
    }
    if (SZ(s[a])>SZ(s[b]))
        swap(a,b);
    vector<pll> sx;
    For(i,0,SZ(s[a]))
    {
        ll l=-1,r=SZ(s[b]);
        while (r-l>1)
        {
            ll mid=(l+r)>>1;
            if (s[a][i].X+s[b][mid].Y<=V) r=mid;
            else l=mid;
        }
        if (r!=SZ(s[b]))
            sx.PB({s[b][r].X,s[a][i].Y});
        l=-1,r=SZ(s[b]);
        while (r-l>1)
        {
            ll mid=(l+r)>>1;
            if (s[a][i].Y+s[b][mid].X<=V) l=mid;
            else r=mid;
        }
        if (l!=-1)
            sx.PB({s[a][i].X,s[b][l].Y});
    }
    if (SZ(sx)==0) return 0;
    sort(sx.begin(),sx.end());
    s[x].PB(sx[0]);
    For(i,1,SZ(sx))
    {
        if (sx[i].Y<s[x].back().Y)
        {
            s[x].PB(sx[i]);
        }
    }
    return 1;
}

int main()
{
    cin >> n;
    memset(lf,-1,sizeof lf);
    memset(rf,-1,sizeof rf);
    For(i,1,n)
    {
        ll p;
        cin >> p >> parv[i];
        p--;
        if (lf[p]!=-1) rf[p]=i;
        else
            lf[p]=i;   
    }     
    ll l=-1,r=1e18;     
    while (r-l>1)
    {
        V=(l+r)>>1;
        if (dfs(0)) r=V;
        else l=V;
    }    
    RET(r);
}    


Measured memory_bytes: 35340
import java.util.ArrayList;
import java.util.Scanner;


public class Main {
	public static void main(String args[]){
		Scanner input = new Scanner(System.in);
		while(input.hasNext()){
			String st = Integer.toBinaryString(input.nextInt());
			int index = 0;
			ArrayList<Integer> lst = new ArrayList<Integer>();
			for(int i = st.length()-1; i >= 0 ; i--){
				if(st.charAt(i) == '1')lst.add((int)(Math.pow(2, index)));
				index++;
			}
			for(int i = 0 ; i < lst.size() ; i++){
				if(i != lst.size()-1){
					System.out.print(lst.get(i)+" ");
				}else{
					System.out.println(lst.get(i));
				}
			}
		}
		String st = Integer.toBinaryString(5);
	}

}

Measured memory_bytes: 17244
n = int(input())
h = list(map(int, input().strip().split(" ")))
sum_v = 0
max_v = 0


for i in range(n-1):
    if  h[i+1] <= h[i]:
        sum_v += 1
                
    else:
        if sum_v > max_v:
            max_v = sum_v
        sum_v = 0

if sum_v > max_v:
    max_v = sum_v
        
    
print(max_v)   

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i = x; i < n; i++)
#define MAX 114514

int Q;

// char X[100][100];
// int dp[1000000001];
bool dp[MAX] = {};
int acc[MAX] = {};

int main(void){
    dp[0] = false;
    dp[1] = false;
    REP(i,2,MAX) {
        dp[i] = 1;
    }
    
    
    int limit = sqrt(MAX);
    REP(i,2,limit) {
        if (dp[i] == 1) {
            for(int j = 2; i*j <= MAX; j++) {
                dp[i*j] = 0;
            }
        }
        
    }
    
    REP(i,2,MAX) {
        if (dp[i] == 1 && dp[(i+1)/2] == 1) {
            acc[i] = acc[i-1] + 1;
        }
        else {
            acc[i] = acc[i-1];
        }
    }
    
    // REP(i,0,MAX) {
    //     cout << acc[i] << endl;
    // }
    // const size_t size = sizeof(dp[0]);
    // cout << "taa2";
    cin >> Q;
    REP(i,0,Q) {
        int l,r;
        cin >> l >> r;
        int sum = acc[r] - acc[l-1];
        cout << sum << endl;
        
    }


    // cout << acc[19] << " " << acc[51] << endl;
    // cout << acc[13] << " " << acc[49] << endl;

}

Measured memory_bytes: 1152
#include <bits/stdc++.h> 
    #include<ext/pb_ds/assoc_container.hpp> 
    #include<ext/pb_ds/tree_policy.hpp>
    using namespace __gnu_pbds;
    using namespace std;
    template <typename T>
    using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
    #define int long long  
    typedef long double ld;
    #define pb push_back
    #define f(i,a,b) for(int i=a;i<b;i++)
    #define fd(i,a,b) for(int i=a-1;i>=b;i--)
    #define pf push_front
    #define fi first
    #define se second
     int mn=1e9+7;
    int cnt=0;
    vector<pair<int ,int >> v1,v2;  
    signed main() {
    ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("INPUT.txt", "r", stdin);
    // for writing output to output.txt
    freopen("OUTPUT.txt", "w", stdout);
    #endif
 
    // -------------------------------------Code starts here--------------------------------------------------------------------- 

   int n;
   cin>>n;
   int a[n-1];
   int b[n+1]={0};
   f(i,0,n-1)
   {
    cin>>a[i];
    b[a[i]]++;
   }
  
   f(i,1,n+1)
   {
    cout<<b[i]<<endl;
   }
}

Measured memory_bytes: 6716
N=int(input())
A=[int(x) for x in input().split()]
dic={}
for i in range(N):
  if A[i] in dic:
    dic[A[i]]+=1
  else:
    dic[A[i]]=1
cnt=0
for x,y in dic.items():
  if y%2==0:
    cnt+=1
if cnt%2==0:
  print(len(dic))
else:
  print(len(dic)-1)

Measured memory_bytes: 17312
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
char ma[1000][1001];
int d[1000][1000];
int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  ll n, m;
  cin >> n >> m;
  // ll n, m, k;
  // cin >> n >> m >> k;
  qp q;
  negative(d);
  fi(0, n) {
    cin >> ma[i];
    fj(0, m)
      if(ma[i][j] == '#') {

        d[i][j] = 0;
        q.push(pii(i, j));
      }
  }
  while(q.size()) {
    int i = q.front().first;
    int j = q.front().second;
    q.pop();
    fk(0, 4) {
      int ni = i + di[k];
      int nj = j + dj[k];
      if(ni < 0 || nj < 0 || ni >= n || nj >= m) continue;
      if(ma[ni][nj] == '#' || d[ni][nj] >= 0) continue;
      d[ni][nj] = ans = d[i][j] + 1;
      q.push(pii(ni, nj));
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 13328
#include<iostream>
#include<string>
using namespace std;
int main()
{string st;
 cin >> st;
 if(st[2]==st[3]&&st[4]==st[5])
 {
   cout << "Yes" << endl;
 }
 else
 { cout << "No" << endl;
 }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)


const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE a(n), b(n), c(n);
	rep(i, n)cin >> a[i];
	rep(i, n)cin >> b[i];
	rep(i, n)cin >> c[i];
	sort(ALL(a)); sort(ALL(b)); sort(ALL(c));
	int ans = 0;
	rep(i, n) {
		int tmp = lower_bound(ALL(a), b[i]) - a.begin();
		int tmp2 = c.end() - upper_bound(ALL(c), b[i]);
		ans += tmp * tmp2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2688
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>

using namespace std;

#define ll long long
#define LLMAX 1E+9+7

int main(){
	int n,l;
	string s;
	vector<string> str;
	cin >> n >> l;
	for (int i = 0; i < n; ++i){
		cin >> s;
		str.push_back(s);
	}
	sort(str.begin(),str.end());
	for (int i = 0; i < n; ++i){
		cout << str[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> as(n); cin >> as;
    auto ass = as;
    sort(ass.begin(), ass.end());
    int ans = M;
    for(int i = 0; i < n; i++){
        vector<int> nums, avs;
        for(int j = 0; j < n; j++){
            if(as[j] >= ass[i]){
                nums.push_back(as[j]);
            }
            if(as[j] < ass[i] || j == n - 1){
                if((int)nums.size() >= k){
                    sort(nums.begin(), nums.end());
                    nums.resize(nums.size() - k + 1);
                    avs.insert(avs.end(), nums.begin(), nums.end());
                }
                nums.clear();
            }
        }
        printd(i, avs);
        if((int)avs.size() >= q){
            sort(avs.begin(), avs.end());
            ans = min(ans, avs[q - 1] - avs[0]);
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		int n=sc.nextInt();

		int a[]=new int[n];
		for(int i=0;i<n;i++)		a[i]=sc.nextInt();

		int min=a[0];
		for(int i=0;i<n;i++){
			if(a[i]<min)	min=a[i];
		}

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

		long sum=0;
		for(int i=0;i<n;i++)	sum=sum+a[i];

		System.out.println(min+" "+max+" "+sum);
	}
}

Measured memory_bytes: 41244
import java.util.Scanner;

public class Main {

	static long []fac ;
	static long []finv;
	static int n;
	
	static int mod = 998244353;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		
		fac = new long [n+1];
		finv = new long [n+1];
		
		COMinit();
		
		long ans = (Modpow(m-1,n-1)*m)%mod;
		
		for(int i = 1 ; i <= k ;i++) {
			long temp = (((m*Modpow(m-1,n-1-i))%mod)*COM(n-1,i))%mod;
			ans = (ans +temp)%mod;
		}
		System.out.println(ans);
	}
	
	public static void COMinit() {
	    fac[0] = fac[1] = 1;
	    finv[0] = finv[1] = 1;
	    for (int i = 2; i <= n; i++){
	        fac[i] = fac[i - 1] * i % mod;
	        finv[i] = finv[i - 1] * Modpow(i,mod-2) % mod;
	    }
	}
 
	// 二項係数計算
	public static  long COM(int n,int k){
	    if (n < k) return 0;
	    if (n < 0 || k < 0) return 0;
	    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
	}
 
	//a^n mod
	public static long Modpow(long a, long n) {
		long res = 1;
		while(n > 0) {
			if((n & 1) == 1) {
				res = res * a % mod;
			}
			a = a * a % mod;
			n >>= 1;
		}
		return res;
	}
	
}




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

int main() {
  string a;
  int b=0;
  cin >> a;
  
  for(int i=0; i<a.size(); i+=2){
    if(a.at(i)=='h' && a.at(i+1)=='i' && a.size()%2==0) {
      b=1;
    }
    else {
      b=0;
      break;
    }
  }
  if(b) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import itertools
import math

N = int(input())
x = [0]*N
y = [0]*N
for i in range(N):
    x[i], y[i] = map(int, input().split())
    
a = list(itertools.permutations([i for i in range(1, N+1)]))

n = math.factorial(N)
road = 0
for i in range(n):
    for j in range(N-1):
        road += math.sqrt((x[a[i][j]-1]-x[a[i][j+1]-1])**2+(y[a[i][j]-1]-y[a[i][j+1]-1])**2)
print(road/n)

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

#define rep(i,n) for(int i=0; i<(n); ++i)
#define reps(i,f,n) for(int i=(f); i<=(n); ++i)
#define outl(x) cout << x << '\n';

#define INF (1 << 29)

#define FAST cin.tie(0), ios::sync_with_stdio(false)
inline int chmax(int &a, int b){return b>a ? a=b,1 : 0;}
inline int chmin(int &a, int b){return b<a ? a=b,1 : 0;}
//________

main(){
 int x,y,z;
 cin >> x >> y >> z;
 x -= z, y+=z;
 outl(x/y);
}


Measured memory_bytes: 256
N=int(input())
A=[None]*N
for i in range(N):
  A[i]=input()
A.sort()
A.append('x')
cnt=0
c=A[0]
cc=1
for i in range(1,N+1):
  if A[i]==c:
    cc+=1
  else:
    cnt+=cc%2
    c=A[i]
    cc=1
print(cnt)

Measured memory_bytes: 10676
#include <bits/stdc++.h>
#define INF (1LL<<60)
#define MOD7 1000000007LL
#define PREP(i, s, x) for(ll (i) = (s); (i) < (x); (i) ++)
#define MREP(i, s, x) for(ll (i) = (s); (i) >= (x); (i) --)
#define REP(i, x) PREP(i, 0, x)
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;
template <typename T> inline bool chmax(T &a, T b){
    if (a < b){
        a = b;
        return true;
    }
    return false;
}
template <typename T> inline bool chmin(T &a, T b){
    if(a > b){
        a = b;
        return true;
    }
    return false;
}

int main(){
    char vec[4] = {'A', 'T', 'C', 'G'};
    string s;
    cin >> s;
    ll n = s.length();
    ll ans = 0;
    REP(i, n){
        REP(j, n){
            for (int k = i; k <= j; k ++){
                bool flag = false;
                REP(index, 4){
                    if(s[k] == vec[index]){
                        flag = true;
                    }
                }
                if(!flag){
                    k = 100;
                }
                if(k == j){
                    chmax(ans, j - i + 1);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
void print(int n, int k)
{
    map<int, int> mp;
    cout << k << endl;
    vector<vector<int>> g(k, vector<int>(k, -1));
    int cur = 0;
    rep(i, k) rep(j, i + 1, k)
    {
        if (g[i][j] == -1)
        {
            g[i][j] = cur;
            g[j][i] = cur;
            cur++;
        }
    }
    rep(i, k)
    {
        int cur = 0;
        cout << k - 1 << " ";
        rep(j, k)
        {
            if (g[i][j] != -1)
            {
                cout << g[i][j] + 1 << " ";
            }
        }
        cout << endl;
    }
}
int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    int k = 2;
    while (k * (k - 1) / 2 <= n)
    {
        if (k * (k - 1) / 2 == n)
        {
            cout << "Yes" << endl;
            print(n, k);
            return 0;
        }
        k++;
    }
    cout << "No" << endl;
    return 0;
}


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

int main(){
  
  int a,b,c,d;
  int l;

  cin >> l >> a >> b >> c >> d;

  while(a>0 || b>0){
    l--;
    a-=c , b-=d;
  }

  cout << l << endl;

  return 0;
}

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

using namespace std;

string S;

int main(void) {

	string alpha = "abcdefghijklmnopqrstuvwxyz";
	string ans = "None";
	int flag = 0;
	cin >> S;

	sort(S.begin(), S.end());
	for (int i = 0; i < alpha.length();) {
		for (int j = 0; j < S.length(); j++) {
			if (alpha[i] == S[j]) {
				++i;
				flag = 1;
				break;
			}
			else if (j == (S.length() - 1) && flag == 0) {
				ans = alpha[i];
				cout << ans << endl;
				return 0;
			}
			flag = 0;
		}

	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    int N; cin >> N;
    vector<int> as(N); for (auto &ai : as) cin >> ai;
    // 書き換え先を-100~+100で全探索
    // N<=100と小さいので総当りで間に合う:O(10^4)
    int minCost = 4000000;
    for (int x = -100; x <= 100; ++x)
    {
        int cost = 0;
        for (const int ai : as)
        {
            cost += (ai - x) * (ai - x);
        }
        minCost = min(minCost, cost);
    }
    cout << minCost << endl;
}


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

int main(){
  int H,W,c;
  cin >> H >> W;
  int dp[1411][1411];
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> c;
      if(c==1){
        dp[i][j]=0;
     }else{
       dp[i][j]=100000011;
     }
      if(i==0 && dp[i][j]!=0) dp[i][j]=1;
      if(j==0 && dp[i][j]!=0) dp[i][j]=1;
    }
  }
  int ans=0;
  for(int i=1;i<H;i++){
    for(int j=1;j<W;j++){
      if(dp[i][j]!=0){
        dp[i][j]=min(min(dp[i-1][j-1],dp[i][j-1]),dp[i-1][j])+1;

      }
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){

      if(dp[i][j]>ans) ans=dp[i][j];

    }
  }

  cout<<ans*ans<<endl;
  return 0;
}




Measured memory_bytes: 10820
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    for(int i=1;i<=3500;i++){
      for(int j=1;j<=3500;j++){
        long x = n*i*j;
        long y = 4*i*j-n*(i+j);
        if(y!=0&&x%y==0&&x/y>=1&&x/y<=3500){
          System.out.println(i+" "+j+" "+x/y);
          return;
        }
      }
    }
  }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n,k;

int main(){
	cin>>n>>k;
	cout<<min(1,n%k)<<endl;
}

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

typedef long long ll;

#define PrintLn(X) cout << X << endl
#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define For(i, a, b) for(int i = a; i < (int)(b); ++i)

int main(void)
{
	int N;
	cin >> N;
	int num[1000] = {0};
	For(i, 1, N + 1){
		int n = i;
		while(n != 1){
			for(int j = 2; j <= n; j++){
				if(n % j == 0){
					num[j]++;
					n /= j;
					break;
				}
			}
		}
	}
	ll ans = 1;
	Rep(i, 999){
		ans *= (num[i] + 1);
		ans %= 1000000007;
	}
	PrintLn(ans);
	return 0;
}


Measured memory_bytes: 256