akhauriyash/Code-Regression huggingface dataset:
from collections import deque
import heapq

N, K=map(int, input().split())
V=list(map(int, input().split()))
lim=min(N, K)
ans=0
for num in range(lim+1):
    for A in range(num+1):
        B=num-A
        d=deque(V)
        hands=[]
        while d and len(hands)<A:
            hands.append(d.popleft())
        while d and len(hands)<A+B:
            hands.append(d.pop())
        heapq.heapify(hands)
        cnt=K-num
        while len(hands) and hands[0]<0 and cnt>0:
            cnt-=1
            heapq.heappop(hands)
        ans=max(ans, sum(hands))
print(ans)

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
    
#define IOS cin.sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i, n) for (int i = 0; i < n; i++)
#define repn(i, a, b) for (int i = a;i<=b;i++)
#define ll long long int
#define pb push_back
#define mpi map<int,int>
#define mpl map<ll,ll>
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define mem(x,val) memset(x, val, sizeof(x))
#define ritr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define pai pair < int, int> 
#define pal pair < ll, ll> 
#define vi vector <int> 
#define vl vector < ll > 
#define vpai vector < pii > 

const int mod = 1e9+7;
const int INF = INT_MAX;
const int sze = 100;

void identity(ll mat[100][100]){
    for(int i=0;i<99;i++) mat[i][i]=1;
}

void multiply(ll mat[sze][sze],ll temp[sze][sze],int n){
    ll res[sze][sze];
    mem(res,0);
    rep(i,n) rep(j,n) rep(k,n) res[i][j]=(res[i][j]+mat[i][k]*temp[k][j]%mod)%mod;
    rep(i,n) rep(j,n) mat[i][j]=res[i][j];
}

ll power(ll mat[100][100],int n,ll k){
    ll res[100][100];
    identity(res);
    while(k){
        if(k&1) multiply(res,mat,n);
        multiply(mat,mat,n);
        k=k/2;
    }
    ll ans=0;
    rep(i,n) rep(j,n) ans=(ans+res[i][j])%mod;
    return ans;
}

void solve() {
    int n;
    ll k;
    cin>>n>>k;
    ll mat[100][100];
    rep(i,n) rep(j,n) cin>>mat[i][j];
    cout<<power(mat,n,k);
}

int main() {
    IOS;

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

  return 0;
}

Measured memory_bytes: 3860
N=int(input())
#b,c=int(input()),int(input())
# c=[]
#  for i in b:
#     c.append(i)
#e1,e2 = map(int,input().split())
A = list(map(int,input().split()))
#j = [input() for _ in range(a)]
# h = []
# for i in range(e1):
#     h.append(list(map(int,input().split())))
A.sort()
ans="YES"
for i in range(1,N):
    if A[i-1]==A[i]:
        ans="NO"
        break
print(ans)

Measured memory_bytes: 30912
from collections import deque

N,x = map(int,input().split())

if x <= 1 or x >= 2*N-1 :
    print("No")
else :
    print("Yes")
    
    q = deque([x])
    for i in range(1,N) :
        if x-i > 0 :
            q.appendleft(x-i)
        else :
            q.appendleft((2*N-1)+x-i)
    for i in range(1,N) :
        if x+i < 2*N :
            q.append(x+i)
        else :
            q.append(x+i-(2*N-1))
    
    for p in q :
        print(p)
        

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);

int n;
map<int, ll> a;

int main(void) {
  // Here your code !
  scanf("%d", &n);

  for (int i = 1; i <= n; ++i) {
    ll tmp;
    scanf("%lld", &tmp);

    a[i] = tmp;
  }

  vector<int> idx;

  for (auto &e : a) {
    idx.push_back(e.first);
  }

  ll ans = 0LL;

  for (int i = 0; i < idx.size(); ++i) {
    {  // about idx[i];
      ll commit = a[idx[i]] / 2LL;
      ans += commit;
      a[idx[i]] -= 2LL * commit;
    }

    {  // about idx[i] and idx[i] + 1 (if idx[i] + 1 exist)
      int next_target = idx[i] + 1;
      if (a.find(next_target) != a.end()) {
        ll commit = min(a[idx[i]], a[next_target]);

        ans += commit;

        a[idx[i]] -= commit;
        a[next_target] -= commit;
      }
    }
  }

  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 7168
/*
*         ****FOX****
*/
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <limits>
//freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#include <utility>
#include <list>
#include <cstdio>
#include<forward_list>
#include<algorithm>
#include<string>
#define Omar_Hafez ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi 3.1415926536
#define ll long long
#define ull unsigned long long
#define lli long long int
using namespace std;
int main()
{
    Omar_Hafez
   int n; cin >> n;
    vector<int> v(n,0); 
    for (int i = 1; i < 99; i++)
    {
        for (int j = 1; j < 99; j++)
        {
            for (int z = 1; z < 99; z++)
            {
                int res = (i * i) + (j * j) + (z * z) + (i * j) + (j * z) + (i * z);  
                if (res <= n)  v[--res]++;
                else break;
            }
        }
    }
    for (int i = 0; i< v.size(); i++) cout << v[i] << "\n";
    return 0;
}


Measured memory_bytes: 3620
#include <vector> 
#include <list> 
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;

const LL mod = (LL)1e9 + 7;


int main() {
	
	LL T, A;
	int N;
	LL t, a;
	cin >> N;
	cin >> T >> A;
	FOR(i,1, N) {
		cin >> t >> a;


		if (a == t) {
			A = max(A, T);
			T = max(A, T);
		}
		else {
			LL o = max(T/t,A/a);
			while (true) {
				if (o*t >= T && o*a >= A) { T = o * t; A = o * a; break; }
				o++;
			}
		}
		//cerr << "A:" << A << " T:" << T << endl;

	}
	cout << A +T << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
// #define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr double EPS = 1e-9;


int main() {

    int n,m;
    cin>>n>>m;
    vi dp(n+1,INF);
    dp[n]=0;
    vi v(m);
    rep(i,m)cin>>v[i];
    for(int i=n;i>0;i--){
        rep(j,m){
            if(i-v[j]>=0){
                chmin(dp[i-v[j]],dp[i]+1);
            }
        }
    }
    fin(dp[0]);
}


Measured memory_bytes: 3148
N, M = map(int,input().split())
X = sorted(list(map(int,input().split())))
D = [0]*M

for k in range(1,M):
    D[k] = X[k]-X[k-1]

if M <= N:
    print(0)
else:
    print(sum(sorted(D)[:M-N+1]))

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

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

	while (N >= 10) {
		N %= 10;
	}

	if (N == 2 || N == 4 || N == 5 || N == 7 || N == 9) {
		cout << "hon" << endl;
	}
	else if (N == 0 || N == 1 || N == 6 || N == 8) {
		cout << "pon" << endl;
	}

	else {
		cout << "bon" << endl;
	}

	return 0;
}


Measured memory_bytes: 3632
while True:
    a, op, b = input().split()  
    a = int(a)                   
    b = int(b) 
    
    if op == "?" :
        break
    elif op == "+":
        print(a+b)
    elif op == "-":
        print(a-b)
    elif op == "*":
        print(a*b)
    else:
        print(a//b)
                


Measured memory_bytes: 5596
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Diagnostics;
class P
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split();
        int n, k;
        n = int.Parse(s[0]);
        k = int.Parse(s[1]);
        long[] x = Console.ReadLine().Split().Select(long.Parse).ToArray();
        long ans = long.MaxValue;
        List<long> left = new List<long>();
        List<long> right = new List<long>();
        foreach (var i in x)
        {
            if (i < 0)
                left.Add(i);
            if (i > 0)
                right.Add(i);
            if (i == 0)
                k--;
        }
        left.Reverse();
        long[] lefts = new long[left.Count + 1];
        long[] rights = new long[right.Count + 1];
        for (int i = 1; i <= left.Count; i++)
            lefts[i] = left[i - 1];
        for (int i = 1; i <= right.Count; i++)
            rights[i] = right[i - 1];
        for (int i = 0; i < k; i++)
        {
            try
            {
                long temp = rights[k - i] - 2 * lefts[i];
                Debug.WriteLine(temp);
                ans = Math.Min(ans, temp);
            }
            catch
            {  }
        }
        for (int i = 0; i < k; i++)
        {
            try
            {
                long temp = -lefts[k - i] + 2 * rights[i];
                Debug.WriteLine(temp);
                ans = Math.Min(ans, temp);
            }
            catch
            {  }
        }
        try
        {
            ans = Math.Min(ans, rights[k]);
        }
        catch
        { }
        try
        {
            ans = Math.Min(ans, -lefts[k]);
        }
        catch
        { }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 25568
import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
import Data.Maybe
strToInt s = (read :: String -> Int) s
strToInteger s = (read :: String -> Integer) s
strToDouble s = (read :: String -> Double) s

main :: IO ()
main = do
    s <- getLine
    -- 出力
    putStrLn . show . pred . length $ group s


Measured memory_bytes: 4988
S = input()
while len(S) > 0:
  if S[-5:] == 'dream':
    S = S[:-5]
  elif S[-5:] == 'erase':
    S = S[:-5]
  elif S[-7:] == 'dreamer':
    S = S[:-7]
  elif S[-6:] == 'eraser':
    S = S[:-6]
  else:
    print('NO')
    exit()
print("YES")

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

using namespace std;

long long const mod = 1000000007ll;

int main(){
  int N;
  cin >> N;
  
  vector<int> d(60, 0);
  vector<long long> A(N);
  
  for(int i = 0; i < N; i++){
    cin >> A[i];
    for(int j = 0; j < 60; j++){
      if(A[i] & (1ll << j)) d[j]++;
    }
  }
  
  long long sum = 0ll;
  for(int i = 0; i < N; i++){
    long long k = 1ll;
    for(int j = 0; j < 60; j++){
      long long tmp = 1ll;
      if(A[i] & (1ll << j)){
        tmp = (tmp * k) % mod;
        tmp = (tmp * (long long)(N - i - d[j])) % mod;
        d[j]--;
      }else{
        tmp = (tmp * k) % mod;
        tmp = (tmp * (long long)d[j]) % mod;
      }
      //cout << tmp << endl;
      k *= 2;
      sum = (sum + tmp) % mod;
    }
  }
  
  cout << sum << endl;
  
  return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <map>

using namespace std;

bool res() {
	int n, d;
	cin >> n >> d;
	if (!cin) return false;

	double res = ((double)n) / (2 * d + 1);
	cout << (int) ceil(res) << '\n';

	return true;
}

int main() {
	while (res()) {}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

int a,b;

int main(){

    std::cin>>a>>b;

    if(a==b)
    std::cout<<a+b<<std::endl;

    if(a>b)
    std::cout<<a*2-1<<std::endl;

    if(a<b)
    std::cout<<b*2-1<<std::endl;

    return 0;

}

Measured memory_bytes: 256
import copy
def main():
    n = int(input())
    x = list(map(int,input().split()))

    a = copy.deepcopy(x)
    a.sort()
    a1 = a[(n-1)//2]
    a2 = a[(n+1)//2]

    for i in range(0,n):
        if x[i]<=a1:
            print(a2)
        else:
            print(a1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 25732
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<utility>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include <map>
using namespace std;
typedef long long int ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()
#define pl pair<ll,ll>
#define fi first
#define se second
#define inf 1000000007

ll H,W;
ll a[5100][5100];

int main() {
    scanf("%lld%lld",&H,&W);
  
    rep(i,H){
        rep(j,W){
            scanf("%lld",&a[i][j]);
        }
    }
    ll N = 0;
    vector<pl> from;
    vector<pl> to;
    rep(i,H){
        rep(j,W){
            if (i != H-1){
                if (a[i][j] % 2){
                    a[i+1][j]++;
                    from.push_back(make_pair(i+1,j+1));
                    to.push_back(make_pair(i+2,j+1));
                    N++;
                }
            }
            else{
                if (j == W-1) break;
                if (a[i][j] % 2){
                    a[i][j+1]++;
                    from.push_back(make_pair(i+1,j+1));
                    to.push_back(make_pair(i+1,j+2));
                    N++;
                }
            }
        }
    }
    cout << N << endl;
    rep(i,N){
        cout << from[i].fi<< " " << from[i].se << " " <<to[i].fi << " "<< to[i].se << endl;
    }
    return 0;
}


Measured memory_bytes: 25060
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

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

	int A, B;
	cin >> A >> B;

	if (A == 1) A = 14;
	if (B == 1) B = 14;

	if (A > B)
	{
		cout << "Alice";
	}
	else if (B > A)
	{
		cout << "Bob";
	}
	else
	{
		cout << "Draw";
	}

	return 0;
}


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

const int mod = 1e+9 + 7;

int main(){
    int n, k;
    cin >> n >> k;
    ll sum = 0;
    for(ll i = k; i <= n + 1; i++){
        ll l = (i - 1) * i / 2;
        ll r = i * (n - i + 1 + n) / 2;
        sum += r - l + 1;
        sum %= mod;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3632
circum_total = [int(n) for n in input().split()]

circum = circum_total[0]
total = circum_total[1]

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

mindist = circum
for index in range(len(distances)):
    if index == len(distances) - 1:
        rightdist = distances[0] + circum - distances[index]
    else:
        rightdist = distances[index+1] - distances[index]
    if index == 0:
        leftdist = distances[index] - distances[index-1] + circum
    else:
        leftdist = distances[index] - distances[index-1]
    maxdist = max(rightdist,leftdist)
    mindist = min(mindist, circum - maxdist)

print(mindist)


Measured memory_bytes: 26444
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
int main(){
  ll a,b;cin>>a>>b;
  vector<string>c(a);
  rep(i,a)cin>>c[i];
  sort(c.begin(),c.end());
  rep(i,a)cout<<c[i];
}



Measured memory_bytes: 27088
/////////// <----------------------  Quicksilver_ ---------------------> ///////////

#include <iostream>
#include <bits/stdc++.h>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <map>
#include <iterator>
#include <iomanip>
#include <queue>
#include <utility>
#include <set>
#include <cstring>

using namespace std;
#define ll long long int
#define endl "\n"
#define c(x) ll x;cin>>x
#define cc(x,y) ll x,y;cin>>x>>y
#define ccc(x,y,z) ll x,y,z; cin>>x>>y>>z
#define db long double
#define fast cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false)
#define inf 200000000000000
#define mod 1000000007
#define eps 1e-7
#define PI 3.1415926535897932385
#define pb push_back
#define bitc  __builtin_popcountll
#define mp make_pair
#define ff first
#define ss second
#define all(ar) ar.begin(), ar.end()
#define len(x) (ll)(x).size()
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define foreach(it,ar) for (auto it = ar.begin(); it != ar.end(); it++)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define print(arr,n) rep(i,n) cout<<arr[i]<<" "; cout<<endl
#define print2(arr,n,m) rep(i,n){ rep(j,m) cout<<arr[i][j]<<" "; cout<<endl; }
#define dyn1(arr,n) ll* arr=new ll[n]; rep(i,n) arr[i]=0;
#define dyn2(arr,n,m) ll** arr=new ll*[(n)]; rep(i,n) arr[i]=new ll[m]; rep(i,n) rep(j,m) arr[i][j]=0
#define carr(arr,n) rep(i,n) cin>>arr[i]
#define carr2(arr,n,m) rep(i,n) rep(j,m) cin>>arr[i][j]
#define debug(a) cout<<" :: "<<#a<<" == "<<a<<endl
#define debug2(a,b) cout<<" :: "<<#a<<" == "<<a<<" :: "<<#b<<" == "<<b<<endl
typedef pair<ll,ll> pii;
typedef vector<pii> vpii;

inline ll maxim(ll a,ll b) {if(a>b) return a; else return b;}
inline ll minim(ll a,ll b) {if(a<b) return a; else return b;}
inline bool equals(double a, double b){ return fabs(a - b) < 1e-9; }
ll gcd(ll a, ll b){ return b==0 ? a : gcd(b, a%b); }


ll binpow(ll a, ll b)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1) res = (res * a)%mod;
        a = (a * a)%mod;
        b >>= 1;
    }
    return res;
}


ll arr[1000010][2];
ll temp[1000010];
ll cost[1000010]={0};
ll mat[150][150]={0};

vector<ll> love;
map<pair<db,db> ,ll> centres;


int main()
{
  fast;
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  cout<<setprecision(10)<<fixed;
  string s;
  cin>>s;
  bool alive=false;
  rep(o,3)
  {
    if(s[o]=='7')
    {
      alive=true;
      break;
    }
  }
  if(alive) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;


  return 0;
}


Measured memory_bytes: 3652
#include<stdio.h>

int main()
{
	int a[32]= {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;

	scanf("%d", &k);
	printf("%d\n", a[k-1]);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define lson l,mid,o<<1
#define rson mid+1,r,o<<1|1
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> PII;
const int INF=0x3f3f3f3f;
const LL MAX_N=2e5 + 10;
const LL mod=1e9+7;
const double PI=acos(-1);


int main()
{
    string s;
    cin >> s;
    int len = s.size() - 1;
    //cout<<len<<endl;
    int ans = 0;
    for(int i = 1; i <= (len >> 1); ++i){
        bool flag = true;
        for(int now = 0; now + i < len && now < i; ++now){
            if(s[now] != s[now + i])    flag = false;
        }
        if(flag) ans = i << 1;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
import itertools

N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

A = list(range(1, N + 1))
for i, x in enumerate(itertools.permutations(A)):
    if list(x) == P:
        pn = i
    if list(x) == Q:
        qn = i
print(abs(pn - qn))


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e18;
const double PI = 2 * asin(1);
typedef long long ll;


int main(){
  int X; cin >> X;
  vector <bool> visited(1e6);
  visited[0] = true;

  for (int i = 0; i <= X; i++){
    if (visited[i] == true){
      for (int j = 100; j <= 105; j++){
        visited[i + j] = true;
      }
    }
  }
  
  cout << visited[X] << endl;

  return 0;
}


Measured memory_bytes: 384
import string
S = input()
ans = ''
if len(S) != 26:
    for i in string.ascii_lowercase:
        if S.count(i) == 0:
            ans = S + i
            break
else:
    tmp = []
    tmp.append(S[-1])
    loopF = False
    for i in range(len(S) - 2, -1, -1):
        for j in range(len(tmp)):
            if S[i] < tmp[j]:
                ans = S[0:i] + tmp[j]
                loopF = True
                break

            if j == len(tmp) - 1:
                tmp.append(S[i])
                tmp.sort()
        if loopF:
            break
if ans == '':
    print(-1)
else:
    print(ans)

Measured memory_bytes: 4148
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] monster = new int[N + 1];
        int[] hero = new int[N];
        long count = 0;
        for (int i = 0; i < N + 1; i++) {
            monster[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            hero[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            if (monster[i] >= hero[i]) {
                count += hero[i];
            } else if (monster[i] + monster[i + 1] >= hero[i]) {
                count += hero[i];
                monster[i + 1] -= (hero[i] - monster[i]);
            } else if (monster[i] + monster[i + 1] < hero[i]) {
                count += monster[i] + monster[i + 1];
                monster[i + 1] = 0;
            }
        }
        System.out.println(count);

    }

}


Measured memory_bytes: 86472
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#define mp make_pair
#define pb push_back
#define ll long long
#define kl k<<1
#define kr k<<1|1
using namespace std;
inline ll read(){ll s=0,w=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();return s*w;}
void put1(){ puts("YES") ;}void put2(){ puts("NO") ;}void put3(){ puts("-1"); }
ll qp(ll a,ll b, ll p){ll ans = 1;while(b){if(b&1){ans = (ans*a)%p;--b;}a =
(a*a)%p;b >>= 1;}return ans%p;}

const int manx=1e5+5;
const int mo=998244353;



int main(){
    ll n; cin>>n;
    ll flag=0;
    while(n){
        ll x=n%10;
        if(x==7) flag=1;
        n/=10;
    }
    if(flag) puts("Yes");
    else puts("No");
    return 0;
}


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

int main(){
	string S;
	int count = 0;
	int maximum = 0;
	cin >> S;
	for(int i = 0;i < S.length();i++){
		if(S.at(i) == 'A' || S.at(i) == 'T' || S.at(i) == 'C' || S.at(i) == 'G'){
			count++;
			maximum = max(maximum, count);
		}else{
			count = 0;
		}
	}
	
		cout << maximum << endl;
}

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

using namespace std;

int main() {
	int time, total;

	total = 0;
	for (int i = 0; i < 4; ++i) {
		cin >> time;
		total += time;
	}
	cout << total / 60 << endl << total % 60 << endl;

	return 0;
}


Measured memory_bytes: 3084
import bisect
import collections
import heapq
from collections import defaultdict
import sys

sys.setrecursionlimit(100000)
input = sys.stdin.readline
ACMOD = 1000000007
INF = 1 << 32


def lmi():
    return list(map(int, input().split()))


def llmi(n):
    return [lmi() for _ in range(n)]


n, m, s, t = list(map(int, input().split()))

MAX_VAL = 10 ** 20
uvab = llmi(m)
jpy_cost = defaultdict(dict)
snuke_cost = defaultdict(dict)


def dijkstra2_scipy(adj, start, n=None, limit=None):
    """
    caution!  add 10**-10 to avoid 0 cost
    """
    from scipy.sparse import csr_matrix
    from scipy.sparse.csgraph._shortest_path import dijkstra
    if limit:
        limit += 0.5
    cost, row_ind, col_ind = [], [], []
    for k1, _v in adj.items():
        for k2, _cost in _v.items():
            row_ind.append(k1)
            col_ind.append(k2)
            cost.append(_cost + 10 ** -10)
    cost_matrix = csr_matrix((cost, (row_ind, col_ind)))
    return dijkstra(cost_matrix, indices=[start])[0]


def dijkstra2(adj, start, n):
    MAX_VAL = float('inf')
    INF = MAX_VAL
    dist = [INF for _ in range(n)]
    dist[start] = 0
    pq = []
    heapq.heappush(pq, [dist[start], start])
    while pq:
        u_dist, u_id = heapq.heappop(pq)  # u is a tuple [u_dist, u_id]
        if u_dist == dist[u_id]:
            for v in adj[u_id]:
                w_uv = adj[u_id][v]
                if dist[u_id] + w_uv < dist[v]:
                    dist[v] = dist[u_id] + w_uv
                    heapq.heappush(pq, [dist[v], v])
    return dist


for u, v, a, b in uvab:
    u = u - 1
    v = v - 1
    jpy_cost[u][v] = a
    jpy_cost[v][u] = a
    snuke_cost[u][v] = b
    snuke_cost[v][u] = b

jpy_dijk = dijkstra2(jpy_cost, start=s - 1, n=n)
snuke_dijk = dijkstra2(snuke_cost, start=t - 1, n=n)
res = []
min_val = MAX_VAL
for i in reversed(range(n)):
    # 都市  i で両替
    val = jpy_dijk[i] + snuke_dijk[i]
    assert val < MAX_VAL
    min_val = min(min_val, val)
    res.append(min_val)
for x in reversed(res):
    print(10 ** 15 - int(x))


Measured memory_bytes: 155396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(void){
    string s,t;
    cin>>s>>t;
    int ans=0;
    for(int i=0;i<s.size();i++){
        if(s[i]!=t[i]){
            ans++;
        }
    }
    cout<<ans<<endl;

}



Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
 
#define mo 1000000007
#define inf 1e18
#define rep(i, s, n) for (ll i = s; i < n; i = i + 1)
#define rrep(i,s,n) for(ll i=s;i>=n;i--)
#define adiii \                               
  ios_base::sync_with_stdio(false); \                                      
  cin.tie(NULL);  \
  cout.tie(NULL);									
 
ll mod(ll n) { return (n % (ll)mo + (ll)mo)%(ll)mo;}
ll gcd(ll a,ll b) {if (b == 0) return a;return gcd(b, a % b);}

int main(){
	adiii
	ll n,m;cin>>n>>m;
	vector <ll> h(n+1);
	vector <ll> adj[n+1];
	vector <bool> mark(n+1,false);
	vector <bool> check(n+1,false);
	ll ans = 0;
	rep(i,1,n+1) cin>>h[i];
	ll u,v;
	rep(i,0,m){
		cin>>u>>v;

		if(h[u]>h[v]) adj[u].pb(v);
		else check[u] = true;

		if(h[v]>h[u]) adj[v].pb(u);
		else check[v] = true;

		mark[u] = true;
		mark[v] = true;

	}
	rep(i,1,n+1){
		//cout<<adj[i].size()<<" "<<check[i]<<" "<<mark[i]<<endl;
		
		if(adj[i].size()!=0 && check[i] == false) ans++;
		if(mark[i]==false) ans ++;
		
	}

	cout<<ans<<endl;
}


Measured memory_bytes: 8480
#include <stdio.h>
int main(void){
    int n,x,i,min,ans=0;
    scanf("%d",&n);
    min=n;
    for(i=0;i<n;i++){
        scanf("%d",&x);
        if(x<=min){
            ans++;
            min=x;
        }
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i <(n);i++)
typedef long long ll;
using namespace std;

int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  
  if(n == 1){
    if(a == b){
      cout << 1 << endl;
    }
    else{
      cout << 0 << endl;
    }
  }
  else if(b < a){
    cout << 0 << endl;
  }
  else{
    cout << (ll)(a+b*(n-1)) - (ll)(a*(n-1)+b) +1 << endl;
  }
}

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

typedef long long LL;
const LL mod=1000000007;
#define MAX 10000
#define NIL -1
const double PI  = acos(-1.0);
const int INF = 1e9 + 7;
//-------------------------------------------


LL ori;
LL sn;
LL N;

int main(){

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

    cin >> ori;

    N = ori;

    while( N){

        sn += N % 10;
        N /= 10;
    }
    

    LL a = ori % sn;

    //dump(a);

    if(a){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }



    return 0;
}


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

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll HIGHINF = (ll)1e18;
const ll LOWINF = (ll)1e15;
const long double PI = 3.1415926535897932384626433;

template<typename T> vector<T> make_v(size_t N,T init){return vector<T>(N,init);}
template<typename... T> auto make_v(size_t N,T... t){return vector<decltype(make_v(t...))>(N,make_v(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
    ll W,H,x,y; cin >> W >> H >> x >> y;
    if(W%2==0&&H%2==0&&W/2==x&&H/2==y){
        double ans = (double)(W*H);
        ans /= 2.;
        printf("%.10f 1",ans);
    }
    else{
        double ans = (double)(W*H);
        ans /= 2.;
        printf("%.10f 0",ans);
    }

    return 0;
}


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

vector<string> ans;
int n;

void dfs(string &s, char c, int i){
    if(i == n){
        ans.push_back(s);
        return;
    }
    for(char a = 'a'; a <= c+1; a++){
        s += a;
        dfs(s, max(a,c), i+1);
        s.pop_back();
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    string tmp = "a";
    dfs(tmp, 'a', 1);
    //sort(ans.begin(), ans.end());
    for(string &s : ans)    cout << s << endl;
    return 0;
}


Measured memory_bytes: 9716
#include<bits/stdc++.h>
using namespace std;
int ara[100100];
int main()
{
    long int mx=0,sum;
    int n,a;
    cin>>n;
    for(int i=0;i<n;i++)
        {cin>>a;
        ara[a]++;
        }
    for(int i=0;i<=100001;i++){
        sum=0;
        for(int j=i;j<=i+2;j++){
            sum+=ara[j];
        }
        mx=max(mx,sum);
    }
    cout<<mx<<endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N = 0, A = 0, B = 0, C = 0, D = 0, count = 0, i = 0, j = 0, k = 0;
    string s, t;
    int ans = 0;

    cin >> N;
    if(N>=1000){
        s = "ABD";
    }else{
        s = "ABC";
    }

    cout << s << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

const double PI = 3.141592653589;

void solve_abc_a() {
	ll r;
	float ans;
	//string ans = "No";

	cin >> r;
	ans = 2 * r * PI;

	cout << fixed;
	cout << setprecision(12) << ans;

	return;
}

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

	solve_abc_a();

	return 0;
}

Measured memory_bytes: 3764
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	k, _ := strconv.Atoi(sc.Text())
	slice := make([]int, n)
	sc.Scan()
	q, _ := strconv.Atoi(sc.Text())
	for i := 0; i < q; i++ {
		sc.Scan()
		An, _ := strconv.Atoi(sc.Text())
		slice[An-1]++
	}

	for i := 0; i < n; i++ {
		if slice[i]-q <= k*(-1) {
			fmt.Println("No")
		} else {
			fmt.Println("Yes")
		}
	}
}


Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
int n;
long long ans;
char A[100001][11];
map<string,int>mp;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%s",A[i]);
	for(int i=1;i<=n;i++){
		sort(A[i],A[i]+10);
		ans+=mp[A[i]];
		mp[A[i]]++;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 12288
n = int(input())

remind = []
for i in range(n):
   remind.append(input())

egara = ["S ", "H ", "C ", "D "]
for i in range(4):
   for j in range(1, 14):
      if egara[i] + str(j) not in remind:
         print(egara[i] + str(j))


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

using namespace std;

int main(){
	int x,n;
	cin >>x>>n;
	vector<bool> check(105,true);
	for(int i=0;i<n;i++){
		int temp;
		cin >>temp;
		check[temp]=false;
	}
	if(check[x]==true){
		cout <<x<<endl;
	}else{
		int d=1;
		while(true){
			if(check[x-d]==true){
				cout <<(x-d)<<endl;
				break;
			}else if(check[x+d]==true){
				cout <<(x+d)<<endl;
				break;
			}
			d++;
		}
	}
	return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <vector>
//#include <pair>
#include <utility>
#include <queue>

using namespace std;
int main(){
  int N;
  int q;
  int total_time = 0;
  cin >> N;
  cin >> q;
  queue<pair<string, int> > tasks;

  for(int i = 0; i < N; ++i){
    string task_name;
    int task_time;
    cin >> task_name;
    cin >> task_time;
    tasks.push(make_pair(task_name, task_time));
  }
  
  //compute
  while(!tasks.empty()){
    auto task = tasks.front(); tasks.pop();

    if(task.second <= q){
      total_time += task.second;
      cout << task.first << " " << total_time 
	   << endl;
    }
    else{
      total_time += q;
      task.second -= q;
      tasks.push(task);
    }
  }
  

  return 0;
}

Measured memory_bytes: 4404
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
#import bisect
import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50
EPS = 1e-8

def check_merge(merged,S):
    merged = np.array(merged)
    check = S[merged][:, merged]
    if check.sum():
        return False
    return True

def run():
    N = int(sysread())
    S = []
    for i in range(N):
        S.append(list(map(int, list(input()))))
    S = np.array(S, dtype=np.int8)

    ans = 0

    #for s in S:
    #    print(s)
    for k in range(N):
        #print(k, '-------------------')
        seen = set()
        seen.add(k)
        merged = [k]
        count = 0
        while merged:
            #print(merged)
            count += 1
            nexts = []
            for i in merged:
                for j, e in enumerate(S[i]):
                    if int(e) and not j in seen:
                        nexts.append(j)
                        seen.add(j)
            if not check_merge(merged, S):
                seen = set()
                break
            merged = nexts
        if len(seen) == N:
            ans = max(ans, count)
    if ans:
        print(ans)
    else:
        print(-1)


if __name__ == "__main__":
    run()


Measured memory_bytes: 27656
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int h = 0, n;
		n = b - a;
		for (int i = 1; i < n; i++) {
			h = h + i;
		}
		System.out.println(h - a);
	}
}


Measured memory_bytes: 22604
#include "bits/stdc++.h"
using namespace std;

int main() {
        string s; cin >> s;
        vector<long long> cnt(26, 0);
        long long n = s.size();
        for (int i = 0; i < n; i ++) cnt[s[i] - 'a'] ++;
        long long ans = 1 + n * (n - 1) / 2;
        for (int i = 0; i < 26; i ++) if (cnt[i] >= 2) ans -= cnt[i] * (cnt[i] - 1) / 2;
        cout << ans << endl;
        return 0;
}


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

using namespace std;
typedef long long ll;

int main() {
    int x;
    cin >> x;
    int ans = 0;
    if (x < 600) ans = 8;
    else if (x < 800) ans = 7;
    else if (x < 1000) ans = 6;
    else if (x < 1200) ans = 5;
    else if (x < 1400) ans = 4;
    else if (x < 1600) ans = 3;
    else if (x < 1800) ans = 2;
    else if (x < 2000) ans = 1;
    cout << ans << "\n";
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <vector>
#include <functional>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;

const int MAX_N = 100010;
const ll MOD = 1e9 + 7;

ll t[MAX_N], a[MAX_N];

ll max_value[MAX_N], fixed_value[MAX_N];

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

    int n;
    cin >> n;

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

    memset(fixed_value, -1, sizeof(fixed_value));

    ll prev = -1;
    for (int i = 0; i < n; i++) {
        if (t[i] > prev) {
            fixed_value[i] = t[i];
            prev = t[i];
        }
        max_value[i] = prev;
    }

    prev = -1;
    for (int i = n - 1; i >= 0; i--) {
        if (a[i] > prev) {
            // 固定される
            // 矛盾するケース
            if (a[i] > max_value[i]) {
                cout << 0 << endl;
                return 0;
            } else if (fixed_value[i] >= 0 && fixed_value[i] != a[i]) {
                cout << 0 << endl;
                return 0;
            } else {
                fixed_value[i] = a[i];
                prev = a[i];
            }
        }
        max_value[i] = min(max_value[i], prev);
    }
    ll ans = 1;
    for (int i = 0; i < n; i++) {
        if (fixed_value[i] < 0) {
            ans = ans * max_value[i];
            ans = ans % MOD;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3328
N, K = map(int, input().split())
W = [int(input()) for i in range(N)]


def num_v(p):
    v, kp, vp = 0, 1, 0
    for i in range(N):
        while vp + W[i] > p:
            kp += 1
            vp = 0
            if kp > K:
                break

        else:
            vp += W[i]
            v += 1
            continue

        break

    return v


def main():
    left, right = 0, sum(W)

    while left < right:
        mid = (left+right) // 2
        v = num_v(mid)

        if v == N:
            right = mid
        else:
            left = mid + 1

    print(left)


if __name__ == '__main__':
    main()



Measured memory_bytes: 9572
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <deque>
#include <string>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;

#define loop(i, N) for (int i = 0; i < N; ++i)
#define scanInt(x) int x; scanf("%d", &x); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &x); getchar();
#define scanVecInt(A, N) vector<int> A(N); loop(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); loop(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(H);
    scanInt(W);
    unordered_map<char, int> count;
    loop(i, H){
        loop(j, W){
            char aij = getchar();
            ++count[aij];
        }
        getchar();
    }
    array<int, 4> rest = {0, 0, 0, 0};
    for (auto& e : count){
        ++rest[e.second % 4];
    }
    bool result = false;
    if (H % 2 == 1 && W % 2 == 1){
        if (rest[1] + rest[3] == 1 && rest[2] + rest[3] <= H / 2 + W / 2 && (rest[2] + rest[3]) % 2 == (H / 2 + W / 2) % 2){
            result = true;
        }
    }else if (H % 2 == 1 || W % 2 == 1){
        int even = H;
        int odd = W;
        if (H % 2 == 1) swap(even, odd);
        if (rest[1] == 0 && rest[3] == 0 && rest[2] <= even / 2 && rest[2] % 2 == (even / 2) % 2){
            result = true;
        }
    }else{ // H % 2 == 0 && W % 2 == 0
        if (rest[1] == 0 && rest[2] == 0 && rest[3] == 0){
            result = true;
        }
    }
    if (result){
        puts("Yes");
    }else{
        puts("No");
    }
}


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

using Graph = vector<vector<int>>;
/*
*/
ll s[100];//s[i]はレベルiバーガーの層数
ll p[100];//p[i]はレベルiバーガーのPの枚数

ll f(ll N,ll X){//レベルNバーガーの下からX層までに含まれるPの数
    if(N == 0) return 1;
    else if(X <= 1) return 0;
    else if(1 <= X && X <= s[N-1] + 1) return f(N-1,X-1);
    else if(X == s[N-1] + 2) return p[N-1] + 1;
    else if(s[N-1] + 2 < X && 2*s[N-1] + 2) return p[N-1] + 1 + f(N-1,X-2-s[N-1]);
    else if(X == 2*s[N-1] + 3) return 2*p[N-1] + 3;
}

int main() {
   ll N,X;
   cin >> N >> X;
   s[0] = 1;
   for(int i = 1;i<=N;i++){
       s[i] = s[i-1]*2 + 3; 
   }
   p[0] = 1;
   for(int i = 1;i<=N;i++){
       p[i] = p[i-1]*2 + 1; 
   }
   cout << f(N,X) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define S 1000001
#define M 1000000007
#define newline cout<<"\n";
#define error  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
lli arr[S];
int main()
{
lli h,n,temp;
lli sum=0;
cin>>h>>n;
for(int i=1;i<=n;i++)
{
    cin>>temp;
    sum=sum+temp;
}
sum=h-sum;
if(sum<=0)
{
   cout<<"Yes"; 
}
else
{
  cout<<"No";  
}

}


Measured memory_bytes: 256
n,k=map(int,input().split())
ab=[]
for _ in range(n):
    ab.append(list(map(int,input().split())))
ab.sort(key=lambda x:x[0])
i=0
j=0
ans=0
while j<k:
    j+=ab[i][1]
    ans=ab[i][0]
    i+=1
print(ans)


Measured memory_bytes: 29144
import itertools

n, m, q = map(int, input().split())
a = []
for i in range(q):
    a.append(list(map(int, input().split())))

comb_list = list(itertools.combinations_with_replacement(range(1, m + 1), n))
# print(comb_list)
ans = 0
for i in range(len(comb_list)):
    cnt = 0
    for j in range(q):
        if comb_list[i][a[j][1] - 1] - comb_list[i][a[j][0] - 1] == a[j][2]:
            cnt += a[j][3]
    ans = max(ans, cnt)
print(ans)


Measured memory_bytes: 84784
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int n;
    in>>n;
    string s,t;
    in>>s>>t;
    fr(i,n) cout<<s[i]<<t[i];
    cout<<endl;
}

Measured memory_bytes: 256