akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<b;++i)
int main() {
    ll N, M, X;
    cin >> N >> M >> X;
    vector<ll> C(N);
    vector<vector<ll>>A(N, vector<ll>(M));
    for (int i = 0; i < N; i++) {
        cin >> C[i];
        for (int j = 0; j < M; j++) {
            cin >> A[i][j];
        }
    }
    ll ans = 1e18;
    FOR(s, 0, 1 << N) {
        ll ret = 0;
        vector<ll> U(M);
        FOR(i, 0, N) {
            if (s & (1 << i)) {
                ret += C[i];
                FOR(j, 0, M) {
                    U[j] += A[i][j];
                }
            }
        }

        bool ok = true;
        FOR(j, 0, M) {
            ok &= U[j] >= X;
        }

        if (ok) {
            ans = min(ans, ret);
        }
    }
    if (ans == 1e18)ans = -1;
    cout << ans << endl;

}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define forr(i,n,a) for(ll i=n-1;i>=a;i--)
#define scan(arr,a,n) for(int i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(int i=(a);i<(n);i++)cout<<(arr)[i]<<' ';

const ll inf = 1e18;

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}

int main(){
	fast;
	ll n, m;
	cin>>n>>m;
	ll mx = max(m/2, n);
	if(mx == n){
		cout<<m/2<<endl;
	} else {
		cout<<n +((m/2 - n)/2)<<endl;
	}
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define oo 0x3f3f3f3f

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,m;
    cin>>n>>m;
    vector<vector<int>>g(n+1);
    for(int i=0; i<m; i++)
    {
        int u,v;
        cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    int res = 0;
    vector<int>vis(n+1);
    for(int i=1; i<=n; i++)
        if(!vis[i])
    {
        vis[i]=1;
        int cnt = 0;
        queue<int>q;
        q.push(i);
        while(!q.empty())
        {
            cnt++;
            int c = q.front();
            q.pop();
            for(auto&u:g[c])
                if(!vis[u])
            {
                vis[u]=1;
                q.push(u);
            }
        }
        res=max(res,cnt);
    }
    cout<<res;
}


Measured memory_bytes: 15548
#include<iostream>
using namespace std;
int main () {
  int key[] = {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};
  int k;
  cin >> k;
  cout << key[--k] << endl;
}


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

using namespace std;

const int NMAX = 1e5 + 5, MOD = 1e9 + 7;
const int ROOT = 1;

int N;

int dp[NMAX][2];

vector < int > G[NMAX];

bool Sel[NMAX];

static inline void Read ()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> N;

    for(int i = 1; i < N; ++i)
    {
        int u = 0, v = 0;

        cin >> u >> v;

        G[u].push_back(v);
        G[v].push_back(u);
    }

    return;
}

static inline void Update (int &X, int s)
{
    long long Nr = 1LL * (X % MOD) * (s % MOD);

    Nr %= (1LL * MOD);

    X = Nr;

    return;
}

static inline void DFS (int Node)
{
    Sel[Node] = 1;

    vector < int > List;

    for(auto it : G[Node])
        if(!Sel[it])
            List.push_back(it), DFS(it);

    dp[Node][0] = dp[Node][1] = 1;

    for(auto it : List)
    {
        Update(dp[Node][0], (dp[it][0] + dp[it][1]));

        Update(dp[Node][1], dp[it][0]);
    }

    return;
}

int main()
{
    Read();

    DFS(ROOT);

    cout << (dp[ROOT][0] + dp[ROOT][1]) % MOD << '\n';

    return 0;
}


Measured memory_bytes: 14976
#include <iostream>
#include <vector>
#include <set>
#include <deque>
#include <map>
#include <iomanip>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <utility>
using namespace std;
int ky[8] = {-1,1,-2,2,-2,2,-1,1}; 
int kx[8] = {-2,-2,-1,-1,1,1,2,2};
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int ddy[8] = {-1,0,1,-1,1,-1,0,1};
int ddx[8] = {-1,-1,-1,0,0,1,1,1};
typedef long long ll;
#define pi pair
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define rep1(i,a,b) for(int i = a; i < b; i++)
#define rep2(i,a,b) for(int i = a; i <= b; i++) 
#define INF 999999999999
const double PI = acos(-1.0); 
const ll m = (1e9 + 7);
ll n;
ll a[200000];
ll ans;
ll ret = 0;
 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin >> n;
    rep1(i,0,n){
        cin >> a[i];
        ret += a[i];
        ret %= m;
    }    
 
    rep1(i,0,n){
        ret -= a[i];
        if(ret < 0) ret += m;
        ans += (ret * a[i]) % m;
    }
    cout << ans % m << '\n';
	return 0;
}

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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >>d;
  while(a > 0){
    a=a-d;
    c=c-b;
  }
  if(c<=0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  

}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll N = 2000009;
const ll p = 31;
const ll m = 1e9 + 7;
const ll inf= 1e14;
ll mod = 1e9+7;
ll powm(ll a, ll b) { ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }
vector<ll> g[N];
ll score[N];
void dfs(ll v,ll p){
     score[v]+=score[p];
     for(auto u:g[v]){
          if(u==p)continue;
          dfs(u,v);
     }
}
 int main() {   
     ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
     // #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
     // #endif
     ll t = 1;
     // cin>>t;
     while(t--){
          ll n;cin>>n;
          map<vector<ll>,ll> a;
          for(int i = 0;i<n;i++){
               string s;cin>>s;
               vector<ll> ct(26,0);
               for(int i = 0;i<10;i++){
                    ct[s[i]-'a']++;
               }
               a[ct]++;
          }
          ll ans = 0;

          map<vector<ll>,ll>::iterator i;
          for(i = a.begin();i!=a.end();i++){
               ll temp = i->second*(i->second-1);
               temp = temp/2;
               ans+=temp;
          }
          cout<<ans;

     }
}            


Measured memory_bytes: 78080
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b / gcd(a,b);}

int main() {
    char x,y;
    cin >> x >> y;
    vector<int> vc = {'A','B','C','D','E','F'};
    vector<int>::iterator itr_x = find(vc.begin(), vc.end(), x);
    vector<int>::iterator itr_y = find(vc.begin(), vc.end(), y);
    int index_x = distance(vc.begin(), itr_x);
    int index_y = distance(vc.begin(), itr_y);
    if (index_x < index_y) {
        cout << '<' << "\n";
    }
    if (index_x > index_y) {
        cout << '>' << "\n";
    }
    if (index_x == index_y) {
        cout << '=' << "\n";
    }
}


Measured memory_bytes: 384
S = input()
dp = [0 for i in range(2019)]
dp[0] = 1

num = 0
for i,j in enumerate(S[::-1]):
    num += int(j)*(pow(10,i,2019))
    dp[num%2019] += 1

ans = 0
for m in dp:
    if m >= 2:
        ans += int(m*(m-1)/2)
print(ans)

Measured memory_bytes: 68772
#include<bits/stdc++.h>
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; }

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll N, K;
    cin >> N >> K;

    double lose_prob_sum = 0;
    FOR(i, 1, min(N+1, K)){
        // double prob = 1.0/N;

        // 何回連続で表を出す必要があるか
        ll count = 0;
        ll j = i;
        while(j<K){
            j *= 2;
            count++;
        }
        double win_prob = pow(0.5, count);
        double lose_prob = 1 - win_prob;
        lose_prob_sum += (1.0/N) * lose_prob;
    }

    cout << setprecision(20);
    p(1-lose_prob_sum);
    
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)

using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll ans = 1e9;
  ll L, R;
  cin >> L >> R;
  if (L / 2019 != R / 2019) {
    cout << 0 << endl;
    return 0;
  }
  for (ll i = L; i <= R; i++) {
    for (ll j = i + 1; j <= R; j++) {
      ans = min(ans, i * j % 2019);
    }
  }
  cout << ans << endl;
}

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

int main(){
  int k,a,b,flag=0;
  cin >> k >> a >> b ;
  for(int i=a;i<=b;i++){
    if(i%k==0){
      flag = 1;
    }
  }
  if(flag){
    cout << "OK";
  }
  else{
    cout << "NG";
  }
  return 0;
}

Measured memory_bytes: 3632
# 英小文字からなる文字列Sの文字数と数値Kを比較して出しわけ
# →S>Kなら K文字目までのS+...を出力、それ以外はそのまま

K = int(input())
S = input()

if K < len(S):
    S = S[:K] + '...'

print(S)

Measured memory_bytes: 8992
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a);i<=(b);i++)
#define ROF(i,a,b) for(int i = (a);i>=(b);i--)
#define MST(a,x) memset(a,x,sizeof(a))
#define ll long long
#define PB push_back
#define PH push
#define MP make_pair
#define Fint first
#define SD second
#define N 100005
#define M 51
#define INF 1000000007
#define MOD 1000000007
#define MOD2 1000000009
#define eps 1e-14
using namespace std;
inline int Max(int a,int b)
{
    return (((b-a)>>(32-1))&(a^b))^b;
}
inline int Min(int a,int b)
{
    return (((b-a)>>(32-1))&(a^b))^a;
}

int rt;
vector<int>e[N];
int a[N],up[N],dg[N];
int dfs(int u,int fa)
{
    if(e[u].size() == 1)
    {
        up[u] = a[u];
        return 1;
    }
    int ret = 1;
    ll tot = 0;
    int mx = 0;
    for(int i = 0;i<e[u].size();i++)
    {
        int v = e[u][i];
        if(v == fa)continue;
        ret&=dfs(v,u);
        tot+=up[v];
        mx = max(mx,up[v]);
    }
    ll x = tot-a[u];
    ll y = 2*a[u]-tot;
    up[u] = y;
    if(x<0||y<0||tot-mx<x||(u == rt&&y!=0))ret = 0;
    return ret;
}
int main()
{
    int n;
    while(cin>>n)
    {
        MST(dg,0);
        FOR(i,1,n)e[i].clear();
        FOR(i,1,n)
        {
            cin>>a[i];
        }

        FOR(i,1,n-1)
        {
            int x,y;
            cin>>x>>y;
            e[x].PB(y);
            e[y].PB(x);
            ++dg[x];
            ++dg[y];
        }
        if(n == 2)
        {
            if(a[1] == a[2])cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
            continue;
        }
        FOR(i,1,n)
        {
            if(dg[i]>1)
            {
                rt = i;
                break;
            }
        }
        if(dfs(rt,-1))cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 14848
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MyAtCoderTestList
{
    class ABC049C
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split('/');
            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);
            int c = int.Parse(s[2]);
            string ans;

            if(a <= 2019 && b <= 4 && c <= 30)
            {
                ans = "Heisei";
               // Console.WriteLine("Heisei");
                //return 0;
            }
            else
            {
                ans = "TBD";
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
 
		Scanner sc = new Scanner(System.in);
		
		int [] x= {0,1,2,3,4,5};
		
		for(int i=1; i<=5; i++) {
			x[i]=sc.nextInt();
		}
		
		for(int i=1; i<=5; i++) {
			if(x[i]==0) {
				System.out.println(i);
			}
		}
		
 
	}
 
}


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

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10
#define MAX_N 100000

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int dp[MAX_N+1];
int n, a[MAX_N];

int main(){
  scanf("%d", &n);
  rep(i, n) scanf("%d", a+i);

  fill(dp, dp + n, INF);
  rep(i, n){
    *lower_bound(dp, dp + n, a[i]) = a[i];
  }
  printf("%d\n", lower_bound(dp, dp + n, INF) - dp);

  return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

LL comb(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;

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

typedef long double ldbl;

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

    ldbl a, b, x;
    cin >> a >> b >> x;
    ldbl res;
    if( a * a * b / 2.0 <= x ) {
        res = atan(2 * (a * a * b - x) / (a * a * a));

    } else {
        res = M_PI / 2 - atan(2 * x / (a * b * b));

    }
    res = res * 180 / M_PI;
    printf("%.10Lf\n", res);
    return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define REP(i,x,n) for(int i = (x); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

ll f(ll a, ll b){
    string s=to_string(a),t=to_string(b);
    ll na=s.size(),nb=t.size();
    return max(na,nb);
}

int main(void)
{
    ll n,ans=INF; cin>>n;
    for(int i=1; i<=sqrt(n); i++){
        if(n%i==0){
            ll j = n/i;
            ans = min(ans, f(i,j));
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3712
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#define itn int
#define reaD read
#define N 100005
#define mod 1000000007
#define int long long
using namespace std;

int n, m, cnt, a[N], b[N], d[N], t[N];  
struct node { int x, y; bool operator < (const node &p) const { return x < p.x || (x == p.x && y > p.y); }
	bool operator==(const node &b)const{return x==b.x && y==b.y;}} c[N]; 
long long ans = 1; 

inline int read()
{
	int x = 0, w = 1; char c = getchar();
	while(c < '0' || c > '9') { if (c == '-') w = -1; c = getchar(); }
	while(c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
	return x * w;
}

int lowbit(int x) { return x & (-x); }

void add(int x, long long y) { for(int i = x; i <= cnt; i += lowbit(i)) t[i] = (t[i] + y) % mod; }

long long query(int x) { long long res = 0; for(int i = x; i; i -= lowbit(i)) res = (res + t[i]) % mod; return res; }

signed main()
{
	n = read(); m = read();
	for(int i = 1; i <= n; i++) a[i] = read();
	for(int j = 1; j <= m; j++) b[j] = read();
	for(int i = 1; i <= n; i++)
		if(a[i] > b[1] && a[i] < b[m])
		{
			int pos = lower_bound(b + 1, b + m + 1, a[i]) - b;
			if(b[pos] == a[i]) continue;
			c[++cnt] = (node) { a[i] - b[pos - 1], b[pos] - a[i] };
			d[cnt] = b[pos] - a[i]; 
		}
	sort(d + 1, d + cnt + 1); n = unique(d + 1, d + cnt + 1) - d - 1;
	for(int i = 1; i <= cnt; i++) c[i].y = lower_bound(d + 1, d + n + 1, c[i].y) - d;
	sort(c + 1, c + cnt + 1); cnt=unique(c+1,c+cnt+1)-c-1;
	for(int i = 1; i <= cnt; i++)
	{
		long long t = query(c[i].y - 1) + 1;
		ans = (ans + t) % mod; add(c[i].y, t); 
	}
	printf("%lld\n", ans % mod); 
	return 0;
}

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

int main() {
	int n, m; scanf("%d%d", &n, &m);
	if (n & 1) {
		rep(i, n) {
			if (i < n / 2)printf("0");
			else printf("%d", m);
			if (i != n - 1)printf(" ");
		}
		printf("\n");
	}
	else {
		rep(i, n) {
			if (i < n / 2 - 1)printf("0");
			else printf("%d", m);
			if (i != n - 1)printf(" ");
		}
		printf("\n");
	}
}

Measured memory_bytes: 3220
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
//**デバッグ準備**//
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, divisor, modinv, bitSearch, bitList, dfs, bfs//
//dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z;
ll MOD = 1000000007; ll INF = 9999999999999; ll ans = 0;
vl flag, color; vll path; ll start = 0;
//***********//
int main() {
	string S;
	cin >> S;
	for (i = 0; i < 3; i++) {
		if (S[i] == '7') {
			cout << "Yes";
			exit(0);
		}
	}
	cout << "No";
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n, a, b;
  cin >> n >> a >> b;
  int mx = min(a, b);
  int mn = max(0, b + a - n);
  cout << mx << " " << mn << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 28;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

//二部グラフ判定。頂点をc(1か-1(黒か白))で塗る
bool dfs(vector<vector<int>> &graph, vector<int> &color, int v, int c)
{
    color[v] = c; //まず頂点vをcで塗る
    for (int i = 0; i < (int)graph[v].size(); i++)
    {
        // 隣り合う頂点が同じ色ならダメ
        if (color[graph[v][i]] == c)
        {
            return false;
        }
        // 隣り合う頂点がまだ塗られてないなら塗る
        if (color[graph[v][i]] == 0 && !dfs(graph, color, graph[v][i], -c))
        {
            return false;
        }
    }
    return true;
}

// d[u][v]は辺e = (u, v)のコスト（存在しない場合はINF、ただしd[i][i] = 0とする。）
// Vは頂点数
void warshall_floyd(vector<vector<int>> &d, int V)
{
    for (int k = 0; k < V; k++)
    {
        for (int i = 0; i < V; i++)
        {
            for (int j = 0; j < V; j++)
            {
                chmin(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<string> s(n);
    for (int i = 0; i < n; i++)
    {
        cin >> s[i];
    }
    vector<vector<int>> g(n);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (s[i][j] == '1')
            {
                g[i].push_back(j);
            }
        }
    }
    vector<int> color(n, 0);
    bool flg = dfs(g, color, 0, 1);
    if (!flg)
    {
        cout << -1 << endl;
        return 0;
    }
    vector<vector<int>> d(n, vector<int>(n, INF));
    for (int i = 0; i < n; i++)
    {
        d[i][i] = 0;
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (s[i][j] == '1')
            {
                d[i][j] = 1;
            }
        }
    }
    warshall_floyd(d, n);
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (d[i][j] == INF)
            {
                continue;
            }
            // cout << d[i][j] << endl;
            chmax(ans, d[i][j]);
        }
    }
    cout << ans + 1 << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 2 - 170;

int main() {
    int n;
    cin >> n;
    using P = pair<int, int>;
    vector<P> v;
    for (int i = 0; i < n; ++i) {
        int a, b;
        scanf("%d%d", &a, &b);
        v.emplace_back(a%b, b);
    }
    ll ans = 0, k = 0;
    for (int i = n-1; i >= 0; --i) {
        k = ans % v[i].second;
        if((k+v[i].first)%v[i].second){
            ans += v[i].second - (k+v[i].first)%v[i].second;
        }
    }
    cout << ans << "\n";
    return 0;
}


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

int x, i = 1;
int n;

void check_num();
void include3();
void end_check_num();

void check_num() {
	x = i;
	if (x % 3 == 0){
		cout << " " << i;
		end_check_num();
	}else include3();
}

void include3() {
	if (x % 10 == 3){
		cout << " " << i;
		end_check_num();
	}else{
		x /= 10;
		if (x)include3();
		else end_check_num();
	}
}

void end_check_num() {
	if (++i <= n) check_num();
}


int main() {
	cin >> n;
	check_num();
	cout << endl;
	char c;
	cin >> c;
}

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

struct Prime {
    vector<int> p_list;
    vector<bool> memo;
 
    Prime (int N) : memo(N+1, true) {
        init(N);
    }
 
    void init(int N){
        memo[0] = false;
        if(1 <= N) memo[1] = false;
        if(N < 2) return;
 
        int idx = 2;
        while(idx <= N) {
            if(memo[idx]){
                p_list.push_back(idx);
                LL x = 2;
                while(idx * x <= N) {
                    memo[idx*x] = false;
                    x++;
                }
            }
 
            idx += (idx == 2 ? 1 : 2);
        }
    }
 
    bool isPrime(int i) {
        return memo[i];
    }
};

void solve(long long X){
    Prime p(111111);

    while(true) {
        if(p.isPrime(X)){
            cout << X << endl;
            break;
        }

        X++;
    }
}

int main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}


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

#define ll long long
#define forr(i,n) for(ll i=0;i<n;i++)
#define f(i,a,b) for(ll i=a;i<b;i++)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define vi vector<ll>
#define endl '\n'
#define ce(ele) cout<<ele<<' '
#define cs(ele) cout<<ele<<'\n'
#define CASE(t) ll t; cin>>t; while(t--)
#define sor(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())

ll power(ll a,ll b){ll r=1;while(b--)r*=a;return r;}

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

    ll n,W;cin>>n>>W;
    vector<ll> dp(W+1,0);
    
    f(i,1,n+1){
        ll wt,val;cin>>wt>>val;
        for(ll j=W-wt;j>=0;j--){
            dp[j+wt]=max(dp[j+wt],dp[j]+val);
        }
    }
    ll mx=0;
    for(int i=1;i<=W;i++)mx=max(mx,dp[i]);cs(mx);
    

  }


Measured memory_bytes: 3988
#include<bits/stdc++.h>
using namespace std;
 
 const int MAX_SIZE = 1e6; 
  
bool prime[MAX_SIZE + 1]; 
  
void sieve() 
{ 
  
    memset(prime, true, sizeof(prime)); 
  
    for (int p = 2; p * p <= MAX_SIZE; p++) { 
  
        if (prime[p] == true) { 
  
            for (int i = p * p; i <= MAX_SIZE; i += p) 
                prime[i] = false; 
        } 
    } 
} 
int PrimeGreaterThanN(int n) 
{ 
  
     
    for (int i = n; i < MAX_SIZE; i++) { 
  
        if (prime[i] == true) 
        
  
    return i; 
}
} 
int main()
{
	//int t;
	//cin >> t;
	//while(t--)
	//{
		sieve();

		long long a;
		cin >> a ;
		long long temp = PrimeGreaterThanN(a);
		cout << temp << endl;
	//}
	return 0;
}

Measured memory_bytes: 1280
//
//  A - Infinite Coins.cpp
//  AtCoder Beginner Contest 088
//
//  Created by Huang,Zhiqiang on 2018/2/18.
//  Copyright © 2018年 Huang,Zhiqiang. All rights reserved.
//

#include <iostream>
using namespace std;

int main() {
    int N, A;
    cin >> N >> A;
    if (N % 500 > A) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

int main()
{
	int w, h, n;
	cin >> w >> h >> n;

	vector<vector<int>> p(w, vector<int>(h));

	for (int i = 0; i < n; i++)
	{
		int x, y, a;
		cin >> x >> y >> a;

		if (a == 1)
		{
			for (int j = 0; j < x; j++)
			{
				for (int k = 0; k < h; k++)
				{
					p.at(j).at(k) = 1;
				}
			}
		}
		else if (a == 2)
		{
			for (int j = x; j < w; j++)
			{
				for (int k = 0; k < h; k++)
				{
					p.at(j).at(k) = 1;
				}
			}
		}
		else if (a == 3)
		{
			for (int j = 0; j < w; j++)
			{
				for (int k = 0; k < y; k++)
				{
					p.at(j).at(k) = 1;
				}
			}
		}
		else if (a == 4)
		{
			for (int j = 0; j < w; j++)
			{
				for (int k = y; k < h; k++)
				{
					p.at(j).at(k) = 1;
				}
			}
		}
	}

	int s = 0;
	for (int i = 0; i < w; i++)
	{
		for (int j = 0; j < h; j++)
		{
			if (p.at(i).at(j) == 0)
			{
				s++;
			}
		}
	}

	cout << s << endl;
}

Measured memory_bytes: 256
s = input()
n = len(s)
s_half = s[:(n-1)//2]
s_half2 = s[(n-1)//2 +1:]
# print(s_half,s_half2)

if n%2 ==1:
    if s == s[::-1]:
        if s_half == s_half[::-1] and s_half2 == s_half[::-1]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int A,B,C;
    cin>>A>>B>>C;
    if(A <= C&&C <= B){
        cout<<"Yes"<<endl;
    }else if(B <= C&&C <= A){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
      return 0;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  int N, K; cin >> N >> K;
  string S; cin >> S; vector<pair<char, int>> vp;
  int a = 0;
  REP(i, N - 1) if(S[i] != S[i + 1]) a++;
  cout << N - 1 - max(a - 2 * K, 0) << endl;
}


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

using namespace std;
#define int long long
#define pb push_back 

int n, k;
vector<int> h;
int dp[100001];
int v[100001];

int s1(int i){
	if(i==n){
		return 0;
	}
	if(v[i]){
		return dp[i];
	}

	v[i]=1;

	int mainmin=INT_MAX;

	int count = 0;

	for(int j=1; j<=k && i+j<=n; j++){
		mainmin=min(mainmin, abs(h[i]-h[i+j])+s1(i+j));
	}

	dp[i] = mainmin;
	return dp[i];

}

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>k;
	h.resize(n+1);
	h[0]=0;	
	for(int i=1; i<=n; i++){
		cin>>h[i];
	}		

	cout<<s1(1)<<'\n';
}


Measured memory_bytes: 10368
n=int(input())
XY=[tuple(map(int,input().split())) for _ in range(n)]
XY.sort()
PQset=set()
for i in range(n):
    for j in range(i+1,n):
        p=XY[j][0]-XY[i][0]
        q=XY[j][1]-XY[i][1]
        if p!=0 or q!=0:
            PQset.add((p,q))
ans=n
for p,q in PQset:
    cost=1
    for i in range(1,n):
        x,y=XY[i]
        if (x-p,y-q) not in XY:
            cost+=1
    ans=min(cost,ans)
print(ans)

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> B(100001, 0);
    for (int i = 0; i < N; i++){
        cin >> A.at(i);
        B.at(A.at(i))++;
    }
    
    int count_1 = 0, count_2 = 0;
    for (int i = 1; i <= 100000; i++){
        if (B.at(i) != 0){
            B.at(i) %= 2;
            if (B.at(i) == 0) count_1 ++;
            count_2++;
        }
    }
    if (count_1 % 2 ==  1) count_2--;
    cout << count_2 << endl;
}

Measured memory_bytes: 1024
//循环-折扣券1张抵扣最大值 
#include <iostream>
#include <algorithm>
using namespace std;
const int N = 1e5 + 5;
int a[N];

int main()
{
	int n,k;
	cin >> n >> k;
	for(int i = 0;i < n;i++)
		cin >> a[i];
	sort(a,a + n);
	int ans = 1e9 + 5;
	for(int i = 0;i <= n - k;i++){
		int t = i + k - 1;
		if(a[t] - a[i] < ans)
			ans = a[t] - a[i];
	} 
	cout << ans << endl;
	return 0;
} 

Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>
#include <stack>
using namespace std;
typedef pair<int, int> ii;
int main() {
	int N;
	scanf("%d", &N);
	int A[N + 1];
	A[0] = 0;
	for (int i = 1; i <= N; ++i) scanf("%d", &A[i]);
	int l = 1, u = N, m;
	while (l != u) {
		m = (l + u) / 2;
		stack<ii> st;
		bool can = true;
		for (int i = 1; i <= N; ++i) {
			if (A[i] > A[i - 1]) continue;
			else if (m == 1) {
				can = false;
				break;
			}
			while (!st.empty() && st.top().first > A[i]) st.pop();
			int lidx = A[i];
			while (!st.empty() && st.top().first == lidx && st.top().second == m - 1) st.pop(), --lidx;
			if (lidx == 0) {
				can = false;
				break;
			} else if (!st.empty() && st.top().first == lidx) {
				ii a = st.top();
				++a.second;
				st.pop();
				st.push(a);
			} else st.push(ii(lidx, 1));
		}
		if (can) u = m;
		else l = m + 1;
	}
	printf("%d", l);
	return 0;
}


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

a=[0]*n
from collections import defaultdict
tail=defaultdict(int)
for i in range(n-1):
    if t[i]=="A"and t[i+1]=="C":
        a[i+1]+=1
        tail[i]+=1
from itertools import accumulate
a=list(accumulate(a))
for _ in range(q):
    l,r=map(int,input().split())
    l,r=l-1,r-1
    if l==0:print(a[r])
    else:
        print(a[r]-a[l-1]-tail[l-1])

Measured memory_bytes: 18936
//Dragon_warrior7(IITK)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define deb(x) cout << #x << " " << x << "\n"
#define pll pair<ll, ll> 
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
typedef  tree < int ,  null_type ,  greater<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > oset;
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
		cin >> v[i];
}

void print(vector<ll> v)
{
	for (int i = 0; i < v.size(); i++)
		cout << v[i] << " ";
}
ll n,m,a,b,c,t,temp,x,y;
string str;
ll fun(ll n,ll r)
{
    if(r==0)
    return 1;
    if(r==1)
    return n;
    return ((n)*(n-1))/2;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	string s;
	cin>>s;
	ll k;
	cin>>k;
	ll ans=0;
	const int value=pow(9,k);
	for(int i=k;i<=s.size();i++)
	{
	  if(i!=s.size())
	  {
	      ans+=value*fun(i-1,k-1);
	  }
	  if(i==s.size())
	  {
	      string str;
	      str.resize(s.size());
	      for(int x=0;x<str.size();x++)
	      str[x]='0';
	     for(int x=1;x<=9;x++)
	     {
	        str[0]=x+'0';
	        if(k==1)
	        {
	            if(str<=s)
	            ans++;
	        }
	        else if(k==2)
	        {
	            
	            for(int j=1;j<s.size();j++)
	            {
	                if(j!=1)
	                {
	                    str[j-1]='0';
	                }
	                for(int y=1;y<=9;y++)
	                {
	                    str[j]='0'+y;
	                    if(str<=s)
	                    ans++;
	                }
	            }
	        }
	        else
	        {
	            for(int j=1;j<s.size();j++)
	            {
	                if(j!=1)
	                {
	                    str[j-1]='0';
	                }
	                for(int y=1;y<=9;y++)
	                {
	                    str[j]='0'+y;
	                    for(int x=j+1;x<s.size();x++)
	                    {
	                      if(x!=j+1)
	                      {
	                         str[x-1]='0';
	                      }
	                      for(int val=1;val<=9;val++)
	                         {
	                             str[x]='0'+val;
	                             if(str<=s)
	                             ans++;
	                         }
	                    }
	                }
	            }
	        }
	     }
	  }
	}
	cout<<ans;
}

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

typedef long long ll;
using namespace std;
int main (){
    string a,b;
    cin >> a >> b;
    if(a.size()>b.size()) cout << "GREATER\n";
    else if (a.size()<b.size()) cout << "LESS";
    else{
        if     (a>b) cout << "GREATER\n";
        else if(a<b) cout << "LESS\n";
        else         cout << "EQUAL\n";
    }
}

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

using namespace std;

const int INF = 1 << 29;

struct edge
{
  int u, v, cost;
};

void solve()
{
  int V, E, R;
  cin >> V >> E >> R;
  vector< edge > edges;
  while(E--) {
    int s, t, d;
    cin >> s >> t >> d;
    edges.emplace_back((edge) {s, t, d});
  }
  vector< int > v(V, INF);
  v[R] = 0;

  for(int i = 0; i <= V; i++) {
    for(auto &e : edges) {
      if(v[e.u] == INF) continue;
      if(v[e.u] + e.cost < v[e.v]) {
        v[e.v] = v[e.u] + e.cost;
        if(i == V) {
          cout << "NEGATIVE CYCLE" << endl;
          return;
        }
      }
    }
  }

  for(int i = 0; i < V; i++) {
    if(v[i] >= INF) cout << "INF" << endl;
    else cout << v[i] << endl;
  }
}

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

Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int A, B, C, D; cin >> A >> B >> C >> D;

    while(A>0){
        C -= B;
        if(C<=0){
            cout << "Yes" << endl;
            return 0;
        }

        A -= D;

    }

    cout << "No" << endl;

}

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

using namespace std;
using ll=long long;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, a, n) for(int i = (n); i < (a); i++)

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int r;cin>>r;
  cout<<3*pow(r,2)<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int i,j,x;
	int max=0;
	int min=0;
	long sum=0L;
	
	scanf("%d",&j);
	
	for(i=0;i<j;i++){
		scanf("%d",&x);
		sum+=(long)x;
		if(i==0){
			max=x;
			min=x;
		}
		if(x>max){
			max=x;
		}else if(x<min){
			min=x;
		}
		x=0;
	}
	printf("%d %d %ld\n",min,max,sum);
	
	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007


int main() {
  
  string S;
  cin >> S;

  for(int i = 0;i < S.size()-1;i++) {
    if(S.substr(i,2) == "AC") {
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;

}

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

class UnionFind {
	vector<int> par;
	vector<int> rank;
public:
	UnionFind(int n) : par(n, -1), rank(n, 1) {}
	int find(int a) {
		return par[a] < 0 ? a : par[a] = find(par[a]);
	}
	bool same(int a, int b) {
		return find(a) == find(b);
	}
	void unite(int a, int b) {
		a = find(a);
		b = find(b);
		if (a == b) return;
		if (rank[a] > rank[b]) {
			par[a] += par[b];
			par[b] = a;
		}
		else {
			par[b] += par[a];
			par[a] = b;
			if (rank[a] == rank[b]) rank[b]++;
		}
	}
	int size(int a) {
		return -par[find(a)];
	}
};

template <typename T>
struct Heap {
	Heap *l, *r;
	T val;
	Heap() {}
	Heap(int v) : l(nullptr), r(nullptr), val(v) {}
	void Init(int v) {
		l = nullptr; r = nullptr; val = v;
	}
};

template <typename T>
Heap<T>* meld(Heap<T>* a, Heap<T>* b) {
	if (a == nullptr) return b;
	if (b == nullptr) return a;
	if (a->val > b->val) swap(a, b);
	a->r = meld(a->r, b);
	swap(a->l, a->r);
	return a;
}

template <typename T>
Heap<T>* pop(Heap<T>* a) {
	return meld(a->l, a->r);
}

const int MAX = 1e5;

Heap<ll> pool[MAX];
int it;

int main()
{
	int N, M;
	cin >> N >> M;
	if (M == N - 1) {
		cout << 0 << endl;
		return 0;
	}
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	UnionFind uf(N);
	vector<Heap<ll>*> heap(N);
	for (int i = 0; i < N; i++) {
		heap[i] = &pool[i];
		heap[i]->Init(a[i]);
	}
	for (int i = 0; i < M; i++) {
		int u, v;
		cin >> u >> v;
		int ru = uf.find(u), rv = uf.find(v);
		uf.unite(u, v);
		int rt = uf.find(u);
		heap[rt] = meld(heap[ru], heap[rv]);
		if (ru != rt) {
			heap[ru] = nullptr;
		}
		if (rv != rt) {
			heap[rv] = nullptr;
		}
	}
	Heap<ll> *all = nullptr;
	ll res = 0;
	for (int i = 0; i < N; i++) {
		if (uf.find(i) == i) {
			res += heap[i]->val;
			all = meld(all, pop(heap[i]));
		}
	}
	for (int i = 0; i < (N - 1) - M - 1; i++) {
		if (all == nullptr) {
			cout << "Impossible" << endl;
			return 0;
		}
		res += all->val;
		all = pop(all);
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 4608
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb emplace_back
#define koto_memory(a) cout<<(sizeof(a)/1048576.0)<<" MB";
#define res(v) sort(all(v)),v.erase(unique(all(v)), v.end());
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
#define deb(x) cout<<"\n["<<#x<<" = "<<x<<"]\n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
int n,x,y,z,t,a[N];
void solve(){
  cin>>n;
  if(n<=599){cout<<8;return;}
  if(n<=799){cout<<7;return;}
  if(n<=999){cout<<6;return;}
  if(n<=1199){cout<<5;return;}
  if(n<=1399){cout<<4;return;}
  if(n<=1599){cout<<3;return;}
  if(n<=1799){cout<<2;return;}
  if(n<=1999){cout<<1;return;}
}
int32_t main()
{
  ibs;cti;
  solve();return 0;
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000007;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string s, t;
	cin >> s >> t;

	vector<Int> S(26,-1);//Sの置換表
	vector<Int> T(26,-1);//Tの置換表

	Int len = s.size();

	Int flag = 0;
	for (Int i = 0; i < len; i++) {
		if (S[s[i]-'a'] == -1) {
			S[s[i] - 'a'] = t[i] - 'a';
			continue;
		}
		else if (S[s[i] - 'a'] != t[i] - 'a') {
			flag = 1;
			break;
		}
	}

	for (Int i = 0; i < len; i++) {
		if (T[t[i] - 'a'] == -1) {
			T[t[i] - 'a'] = s[i] - 'a';
			continue;
		}
		else if (T[t[i] - 'a'] != s[i] - 'a') {
			flag = 1;
			break;
		}
	}

	cout << (flag ? "No" : "Yes") << endl;

}

Measured memory_bytes: 916
#include<bits/stdc++.h>
using namespace std;
main(){
  string s;
  int k,i=0;
  cin>>s>>k;
  for(;s[i]-'\0'&&k>0;++i)k>'z'-s[i]&&s[i]-'a'?k-='z'-s[i]+1,s[i]='a':0;
  if(k>0)s[i-1]=(s[i-1]-'a'+k)%26+'a';
  cout<<s;
}

Measured memory_bytes: 512
#F - Tree and constraints
import itertools
from collections import defaultdict
N = int(input())
G = [[] for i in range(N+1)]
edge = defaultdict(int)
for i in range(N-1):
    a, b = map(int, input().split())
    edge[(min(a, b), max(a, b))] = i+1
    G[a].append(b)
    G[b].append(a)
M = int(input())
que = [tuple(map(int, input().split())) for i in range(M)]
Data = [set([]) for i in range(M)]


def dfs(node):
    visited[node] = True
    for child in G[node]:
        if visited[child] == False:
            parent[child] = node
            dfs(child)


for i in range(M):
    s, g = que[i]
    visited = [False for i in range(N+1)]
    parent = [-1 for i in range(N+1)]
    dfs(s)
    now = g
    while parent[now] > 0:
        number = edge[(min(now, parent[now]), max(now, parent[now]))]
        Data[i].add(number)
        now = parent[now]
ans = 2**(N-1)
seq = [i for i in range(M)]
for i in range(1, M+1):
    # Mこからi+1こを選ぶ
    S = 0
    subset = set([])
    for v in itertools.combinations(seq, i):
        subset.clear()
        for x in v:
            subset = subset | Data[x]
        S += 2**(N-1-len(subset))
    ans -= (-1)**((i-1) % 2)*S
print(ans)

Measured memory_bytes: 69876
import java.util.*;

class Main{
  public static void main(String args[]){
    
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();  
    
    int sum = 0;
    while (scan.hasNextInt()) {
    	int a = scan.nextInt();
    	int b = scan.nextInt();
    	sum += b - a + 1;
    }
	System.out.println(String.valueOf(sum));
	return;
  }  
}


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

#define MAX 10000010

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

    vector<long long> cnt_div(MAX);
    for (int i = 1; i < MAX; i++)
        for (int j = i; j < MAX; j += i)
            ++cnt_div[j];
    for (int i = 2; i < MAX; i++)
        cnt_div[i] = cnt_div[i - 1] + i * cnt_div[i];

    int n;
    while (cin >> n)
        cout << cnt_div[n] << '\n';
    return 0;
}


Measured memory_bytes: 81228
N,Q=map(int,input().split())
S=input()
li=[0]
A=False
ans=0
import copy
for i in range(N):
    if A==True:
        if S[i]=="C":
            ans+=1
        A=False
    if S[i]=="A":
        A=True
    li.append(copy.copy(ans))
for j in range(Q):
    a,b=map(int,input().split())
    print(li[b]-li[a])


Measured memory_bytes: 11656
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int N,X;
  cin>>N>>X;
  
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec[i];
  }
  sort(vec.begin(),vec.end());
  
  
  int sum=0;
  for(int i=0;i<N;i++){
    sum+=vec[i];
  }
  
  int x=X-sum;
  
  int ans=0;
  
  while(x>=vec[0]){
    x-=vec[0];
    ans++;
  }
  
  
  cout<<ans+N<<endl;
}

Measured memory_bytes: 3572
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
dic = [0] * 3
for i in range(N):
    if P[i] <= A:
        dic[0] += 1
    elif P[i] <= B:
        dic[1] += 1
    else:
        dic[2] += 1

print(min(dic))


Measured memory_bytes: 3060