akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    string a;
    cin>>a;
    register bool flag=false;
    for(register int i=0;i<a.size();i++)
    {
        if(a[i]=='C')
        flag = true; 
        if(a[i]=='F' && flag==true) 
        {
            cout << "Yes";
            return 0;
        }
    } 
    cout << "No\n" <<endl;
    return 0;
}

Measured memory_bytes: 256
N,Y = map(int,input().split())

breakFlg = False
for x in range(N+1):
    for y in range(N+1-x):
        z = N-x-y
        if Y == x*10000 + y*5000 + z*1000:
            breakFlg = True
            break
    if breakFlg:
        break
else:
    x,y,z = -1,-1,-1
print(x,y,z)

Measured memory_bytes: 3060
//Dragon_warrior7(IITK)
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#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 umap unordered_map
#define uset unordered_set
#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 pll pair<ll, ll> 
#define ull unsigned ll
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
#define deb(x) cout<<#x<<' '<<'='<<' '<<x<<'\n'
#define fo(i,a,b) for(int i=a;i<b;i++)
//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];
}
// const int mod=1e9+7;
// ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// ll modInverse(ll a){return power(a,mod-2);}
ll n,m,a,b,c,k,temp,x,y;
const int MAXN=100000+11;
void solveforthiscase(const int & test)
{//deb(test);
string s;
cin>>s;
n=s.size();
bool f=0;
for(int i=0;i<n;i++)
{
    for(int j=i;j<n;j++)
    {
        string temp;
        for(int x=0;x<i;x++)
        temp.pb(s[x]);
        for(int x=j+1;x<n;x++)
        temp.pb(s[x]);
        if(temp=="keyence")
        {cout<<"YES";return ;}
        //deb(temp);
    }
}
if(s=="keyence")
cout<<"YES";
else
cout<<"NO";



return ;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
// 	cin>>test;
    for(int i=1;i<=test;i++)
    {
        solveforthiscase(i);
    }
}

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

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

struct Edge {
    int src, dst, capacity;
};
using Graph = vector<vector<Edge>>;

void add_edge(Graph& graph, int src, int dst, int capacity) {
    graph[src].push_back((Edge){src, dst, capacity});
    graph[dst].push_back((Edge){dst, src, 0});
}

struct Augment {
    const Graph graph;
    const vector<int>& level;
    vector<vector<int>>& flow;
    vector<int>& progress;
    int sink;
    int operator()(int u, int f) const {
        if (u == sink) return f;
        int total = 0, i = progress[u];
        for (; i < (int)graph[u].size(); ++i) {
            auto& e = graph[u][i];
            int residue = e.capacity - flow[e.src][e.dst];
            if (residue > 0 && level[e.src] < level[e.dst]) {
                int aug = (*this)(e.dst, min(f - total, residue));
                flow[e.src][e.dst] += aug;
                flow[e.dst][e.src] -= aug;
                total += aug;
                if (total == f) break;
            }
        }
        progress[u] = i;
        return total;
    }
};

// Verified: AOJ GRL_6_A (Maximum Flow)
int dinic(const Graph& graph, int source, int sink) {
    vector<vector<int>> flow(graph.size(), vector<int>(graph.size()));
    int total = 0;
    for (;;) {
        // construct level graph
        vector<int> level(graph.size(), -1); level[source] = 0;
        queue<int> Q; Q.push(source);
        while (!Q.empty()) {
            int u = Q.front(); Q.pop();
            if (level[sink] != -1 && level[u] > level[sink]) break;
            for (auto& e : graph[u]) {
                if (level[e.dst] == -1 && e.capacity - flow[e.src][e.dst] > 0) {
                    level[e.dst] = level[e.src] + 1;
                    Q.push(e.dst);
                }
            }
        }
        if (level[sink] == -1) return total;

        // push blocking flow
        vector<int> progress(graph.size());
        total += (Augment){graph, level, flow, progress, sink}(source, INT_MAX);
    }
}

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

    int V, E;
    while (cin >> V >> E) {
        Graph graph(V);
        REP(i, E) {
            int u, v, c; cin >> u >> v >> c;
            add_edge(graph, u, v, c);
        }
        cout << dinic(graph, 0, V-1) << '\n';
    }
}

Measured memory_bytes: 3220
/*********************************************JMD**********************************************/
//                                  |\  |     | |   |   /\                                   //
    //                              | \ |     | |---|  /--\                              //
        //                          |  \| |___| |   | /    \1999                     //
/*******************************************************************************************/
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define mem(x,val) memset(x,val,sizeof(x))
#define forr(i,a,b) for(ll i=a;i<b;i++)
#define f(i,n) forr(i,0,n)
#define sz(x) ll((x).size())
#define all(x) ((x).begin(),(x).end())
#define asc(x) ((int)(x))
#define precision(x) cout<<fixed<<setprecision((x));

const ll mod=1e9 + 7;

/*******************************************************************************************/

void solve()
{
    ll n;
    cin>>n;

    ll a[n],b[n];
    f(i,n) cin>>a[i];
    f(i,n) cin>>b[i], a[i]-=b[i];

    sort(a,a+n,greater<ll>());

    ll ans=0;
    ll ind=0;
    while(ind<n)
    {
        if(a[ind]>0) ans+=a[ind];
        else break;
        ind++;
    }

    cout<<ans<<"\n";

    return;
}

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

    ll t=1;
    //cin>>t;
    clock_t launch=clock();

    while(t--)
    {
        solve();
    }

    clog<<((long double)(clock()-launch)/CLOCKS_PER_SEC)<<"\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define fast ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const int mod=(int)1e9+7;
ll dp[1005][1005];
int main()
{
    fast
    int h,w;cin>>h>>w;
    vector<string>s(h+1);
    for(int i=1;i<=h;i++)
        cin>>s[i];
    dp[1][1]=1;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++)
        {         
         if(s[i][j-1]=='#'||(i==1&&j==1))continue;
            dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
        }
    }
    cout<<dp[h][w];
return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

typedef long long ll;

const int INF = 1e9;
const int M = 100;
const int N = 5e6;

vector<int> E[N];
int flow[N], cap[N], to[N];
bool used[N];

const int s = 0, t = N - 1;

int e = 0;

void addEdge(int v, int u, int c) {
    E[v].push_back(e);
    E[u].push_back(e ^ 1);

    cap[e] = c;
    cap[e ^ 1] = 0;

    to[e] = u;
    to[e ^ 1] = v;

    e += 2;
}

int push(int v, int cur_flow) {
    if (v == t || cur_flow == 0) {
        return cur_flow;
    }

    used[v] = true;
    for (int edge : E[v]) {
        if (!used[to[edge]]) {
            int a = push(to[edge], min(cur_flow, cap[edge] - flow[edge]));
            if (a > 0) {
                flow[edge] += a;
                flow[edge ^ 1] -= a;
                return a;
            }
        }
    }
    return 0;
}

int main() {
#if __APPLE__
    //freopen("F.in", "r", stdin);
    //freopen("F.out", "w", stdout);
#endif

    ios_base::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;

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

        for (int j = 0; j < m; ++j) {
            if (a[i][j] == 'o') {
                addEdge(i + 1, n + j + 1, 1);
                addEdge(n + j + 1, i + 1, 1);
            }
            if (a[i][j] == 'S') {
                addEdge(s, i + 1, INF);
                addEdge(s, n + j + 1, INF);
            }
            if (a[i][j] == 'T') {
                addEdge(i + 1, t, INF);
                addEdge(n + j + 1, t, INF);
            }
        }
    }

    int ans = 0;
    int curflow;
    while ((curflow = push(s, INF)) > 0) {
        ans += curflow;
        memset(used, 0, sizeof used);
    }

    if (ans >= INF) ans = -1;
    printf("%d\n", ans);
}


Measured memory_bytes: 131968
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    vector<int>v;
    for(int i=0;i<n;i++)
    {
        int z;
        scanf("%d",&z);
        --z;
        v.push_back(z);
    }
    int now=0,c=0 ;
    for(;;)
    {
        if(now==1)
        {
            printf("%d\n",c);
            break ;
        }
        if(c>=n)
        {
            printf("-1\n");
            break ;
        }
        c++;
        now=v[now];
    }
    return 0;
}


Measured memory_bytes: 892
div=10**9+7
def modinv(a, m=div):
    b = m
    u = 1
    v = 0
    while b:
        t = a//b
        a -= t*b 
        a = a^b
        b = a^b
        a = a^b
        u -= t*v
        u = u^v
        v = u^v
        u = u^v
    u %= m 
    if u < 0: u += m
    return u

N,A,B,C=list(map(int,input().split()))
fact=[1]*(2*N+1)
res = 0
invAB = modinv(A+B)
reveven = (modinv(100-C)*100) % div
memoA = [1]*(N+1)
memoB = [1]*(N+1)

for i in range(1, 2*N + 1): fact[i] = fact[i-1]*i % div
# print(fact)
def ncr(n, r): return fact[n]*modinv(fact[r]*fact[n-r]%div)%div

for i in range(1, N+1): 
    memoA[i] = (memoA[i-1]*A*invAB) % div
    memoB[i] = (memoB[i-1]*B*invAB) % div

for i in range(N, 2*N):
    kitai1 = (
        ((ncr(i-1, N-1)*memoA[N]) % div)*memoB[i-N] + 
        ((ncr(i-1, N-1)*memoB[N]) % div)*memoA[i-N]) % div
    res += kitai1*reveven*i % div

print(res % div)


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

#define fi first
#define se second
#define pb push_back
#define sz(a) (int)(a).size()
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const ll IINF = INT_MAX;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll a, b, n;
    cin >> a >> b >> n;
    n = min(n, b - 1);
    cout << (a * n) / b << '\n';
    return 0;
}

Measured memory_bytes: 3620
// prob name -
//author - COOL
#include <bits/stdc++.h>
#define f(i, n) for (int i = 0; i < n; i++)
#define ff first
#define ss second
#define int long long int
#define mii map<int, int>
#define vi vector<int>
#define fi(i, a, n)             \
    for (int i = 0; i < n; i++) \
    {                           \
        cin >> a[i];            \
    }
#define fo(i, a, n)             \
    for (int i = 0; i < n; i++) \
    {                           \
        cout << a[i] << " ";    \
    }
#define PB push_back
#define MP make_pair
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define mk(arr, n, type) type *arr = new type[n];
#define pw(b, p) pow(b, p) + 0.1
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define Pi 3.14159265358979
using namespace std; //_S_A_R_T_H_A_k_//
/// JAI SHREE RAM!!! ;{'*' <_l_> '*' };
/// Saare jahan se acha hindustan humara .....
/// JAI HIND DOSTON //-__ -//
int32_t main()
{

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
        int n;
        cin >> n;
        int a[n];
        fi(i, a, n)
   int dp[n+1]={0};
   for (int  i = 0; i < n; i++)
   {
     dp[i] = 0;
   }
   
       dp[0] = 0; 
       dp[1] = abs(a[0]-a[1]);
   int ans =0;
   for(int i=2;i<n;i++)
   {
    ans = min(dp[i-1] + abs(a[i]-a[i-1]), dp[i-2] + abs(a[i]-a[i-2])); 
    //dp[i]=min(abs(ar[i]-ar[i-2])+dp[i-2],abs(ar[i]-ar[i-1])+dp[i-1]);
    dp[i] = ans;
   // cout<<ans<< "  ";
   }
   cout<<dp[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 1792
n = int(input()); a = list(map(int, input().split()))
b = [0]; c = {}
for i in range(n): b.append(b[-1]+a[i])
for i in range(n+1):
    if b[i] in c: c[b[i]] += 1
    else: c[b[i]] = 1
d = list(c.values()); x = 0
for i in range(len(d)): x += d[i]*(d[i]-1)//2
print(x)

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


int main(){
    string s;
    cin>>s;
    int count=0;
    if(s[0]=='2'){
    ++count;
    }
    if(s[1]=='2'){
    ++count;}
    if(s[2]=='2'){
    ++count;
    }
    if(s[3]=='2'){
    ++count;
    }
    cout<<count<<endl;
  return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
s = input()
pre = s[0]
rs = s[0]
first = s[0]

if s[0] == "R":
    second = "L"
else:
    second = "R"

for i in s[1:]:
    if i == second and k > 0:
        rs = rs + first
        pre = i
    elif i == first and pre == second:
        k -= 1
        rs = rs + i
        pre = i
    elif k == 0:
        rs = rs + i
    elif i == first and pre == first:
        rs = rs + i

pre = "0"
ans = 0

for i in rs:
    if i == pre:
        ans += 1
    pre = i

print(ans)

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

int main(int argc, char const *argv[])
{
	string s;
	cin>>s;
	int ans=0,cnt=0;
	for (int i = 0; i < s.size(); ++i)
	{
		if (s.at(i)=='A'||s.at(i)=='T'||s.at(i)=='G'||s.at(i)=='C')
		{
			++cnt;
			ans=max(ans,cnt);
		}
		else
		{
			cnt=0;
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

typedef ostringstream OSS;
typedef istringstream ISS;

typedef long long LL;
typedef pair<int, int> PII;

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

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x) (x).begin(),(x).end()
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define rep(i, N) for (int i = 0; i < (N); i++)
#define rep2(i, j, N, M) rep(i, N) rep(j, M)
#define rep3(i, j, k, N, M, L) rep(i, N) rep(j, M) rep(k, L)
#define REP(i, init, N) for (int i = (init); i < (N); i++)

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a) { OSS oss; oss << a; return oss.str(); };

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int N;
VS ss;

void format() {
    // '+'
    for (auto &s : ss) {
        auto pos = s.rfind('.');
        if (pos == string::npos) continue;
        
        s[pos] = '+';
    }
    
    // '|'
    rep(i, N) {
        auto pos = ss[i].find('+');
        if (pos == string::npos) continue;

        for (int j = i - 1; j; --j) {
            char &c = ss[j][pos];
            if (c == '.') {
                c = '|';
            } else {
                break;
            }
        }
    }
    
    // ' '
    for (auto &s : ss) {
        for (auto &c : s) {
            if (c == '.') {
                c = ' ';
            }
        }
    }
}

int main(void) {
    while (cin >> N, N) {
        ss.clear();
        ss.resize(N);
        for (auto &s : ss) cin >> s;

        format();

        for (auto s : ss) cout << s << endl;
    }
    

	return 0;
}

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

#define mod 1000000007
#define modd 998244353
#define PI 3.1415926
#define ll long long
#define ld long double
#define pb push_back
#define popb pop_back
#define beg begin()
#define en end()
#define sz(v) (int)((v).size())
#define all(v) (v).begin(),(v).end()
#define ub upper_bound
#define lb lower_bound
#define ff first
#define ss second
#define endl "\n"
#define forn(i,a,n) for(int i=a;i<int(n);++i)
#define forb(i,a,n) for(int i=int(n)-1;i>=a;--i)
#define cout(ans) cout<< ans << "\n"
#define couts(ans) cout<< ans <<" "
#define maxx *max_element
#define minn *min_element


void speed()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    cout.tie(NULL);
}



void solve()
{   
    int n;cin>>n;
    int a[n];
    int t=0;
    forn(i,0,n)
    {
        cin>>a[i];
        t=t^a[i];
    }
    forn(i,0,n)
    {
        cout<<(t^a[i])<<" ";
    }
}


int main()
{   
    speed();
    int tc=1;
    //cin>>tc;
    while(tc--)
    {
        solve();
    }
}

Measured memory_bytes: 4408
n,q=map(int,input().split())
s=input()
lis=[0]
keep=0
for i in range(1,n):
  if s[i]=="C" and s[i-1]=="A":
    keep+=1
  lis.append(keep)
  
for i in range(q):
  l,r=map(int,input().split())
  l=l-1
  r=r-1
  print(lis[r]-lis[l])
  
  

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

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

int main()
{
    int n, m;
    scanf("%d %d", &n, &m);

    // read
    int dp[1 << n];
    fill(dp, dp + (1 << n), INT_MAX);
    bool ok[1 << n] = {false};
    dp[0] = 0;
    ok[0] = true;
    for (int i = 0; i < m; i++) {
        int a, b;
        scanf("%d %d", &a, &b);

        int mask = 0;
        for (int j = 0; j < b; j++) {
            int num;
            scanf("%d", &num);
            num--;
            mask |= (1 << num);
        }

        // printf("mask %d\n", mask);
        dp[mask] = min(dp[mask], a); // for each combination, use the min val one
        ok[mask] = true;
    }

    // solve
    int ans[1 << n];
    fill(ans, ans + (1 << n), INT_MAX);
    for (int i = 0; i < (1 << n); i++) {
        if (ok[i] == true) {
            // printf("ok %d\n", i);
            ans[i] = min(ans[i], dp[i]);
            for (int j = 0; j < (1 << n); j++) {
                if (ans[j] != INT_MAX) {
                    int target = (i | j);
                    // printf("%d %d %d %d\n", i, j, dp[i], ans[j]);
                    ans[target] = min(ans[target], dp[i] + ans[j]);
                }
            }
        }
    }
    printf("%d\n", ans[(1 << n) - 1] == INT_MAX ? -1 : ans[(1 << n) - 1]);

    /*
    for (int i = 0; i < (1 << n); i++) {
        printf("i = %d\n", i);
        for (int j = 0; j < n; j++) {
            if ((i >> j) & 1) {
                int a = (1 << j);
                int b = i ^ (1 << j);

                printf("%d %d %d %d\n", a, b, dp[a], dp[b]);
                if (ok[a] == false || ok[b] == false)
                    continue;
                dp[i] = min(dp[i], dp[a] + dp[b]);
                ok[i] = true;
            }
        }
    }
    printf("%d\n", ok[(1 << n) - 1] ? dp[(1 << n) - 1] : -1);
    */

    return 0;
}


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

int main(){
  string S;
  int A, B;
  cin >> A >> B >> S;

  bool post = true;
  if (S.at(A) != '-') post = false;
  for (int i = 0; i < A + B + 1; i++)
  {
    if (!(isdigit(S.at(i))) && i != A){
      post = false;
    } 
  }
  cout << (post ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {

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

        long A = sc.nextLong();
        long B = sc.nextLong();
        long K = sc.nextLong();
        
        long Takahashi = Math.max(0, A-K);
        long Aoki = Math.max(0, Math.min(B, B - (K - A)));
        
        System.out.println(Takahashi + " " + Aoki);
        
    }

}


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

// @@ !! LIM(f:power)
// --> f:power
// ---- inserted function power from util.cc
/* *** WARNING ***  
      ll x = power(10, 12) 
   does not work since it is interpreted as 
      ll x = power<int>((int)10, 12)
   Use power<ll>(10, 12) or power(10LL, 12).
 */
template<typename T>
T power(T a, ll b) {
  T twoPow = a;
  T rv(1);
  while (b > 0) {
    if (b & 1LL) rv *= twoPow;
    twoPow *= twoPow;
    b >>= 1;
  }
  return rv;
}
// ---- end power
// @@ !! LIM  -- end mark --

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N, K; cin >> N >> K;

  ll i = 0;
  for ( ; power<ll>(K, i) <= N; i++);
  cout << i << endl;

  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
#define fir first
#define sec second
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	int n;
	cin >> n;
	vector<int> v(n);
	rep(i,0,n) cin >> v[i];

	vsort(v);

	ll sum = 0;
	rep(i,0,n-1) sum += v[i];

	cout << sum + v[n-1]/2 << endl;

	ret 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin >> n >> m;
    long long ans=0;
    for(long long i=1;i<=sqrt(m)+1;i++){
        if(m%i==0){
            if(m/i>=n)ans=max(ans,i);
            if(i>=n)ans=max(ans,m/i);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n;
    cin >> n;
    cout << (n+1)/2 << endl;
}


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

#define fr(i, a, b) for(int i = (a); i <= (b); i++)
#define rf(i, a, b) for(int i = (a); i >= (b); i--)
#define fe(x, y) for(auto& x : y)

#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define pw(x) (1LL << (x))
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename T>
using ve = vector<T>;

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define fbo find_by_order
#define ook order_of_key

mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T>
bool umn(T& a, T b) { return a > b ? a = b, 1 : 0; }
template<typename T>
bool umx(T& a, T b) { return a < b ? a = b, 1 : 0; }

const int inf = 2e9;

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
#endif
 
    int n;
    cin >> n;
    ve<int> a(n);

    fe(x, a) cin >> x;

    sort(all(a));
    reverse(all(a));

    ll ans = 0;
    ans += a[0];

    int have = n - 2;
    fr(i, 1, n - 1) {
        if(have) {
            ans += a[i];
            have--;
        }
        if(have) {
            ans += a[i];
            have--;
        }
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 3996
#include<stdio.h>
#ifdef DEBUG
#include<conio.h>
#endif // DEBUG

int main () {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif // DEBUG

    int num;
    scanf("%d", &num);
    int cnt = 1;
    while (num != 0)
    {
        printf("Case %d: %d\n", cnt++, num);
        scanf("%d", &num);
    }

#ifdef DEBUG
    getch();
#endif // DEBUG
    return 0;
}




Measured memory_bytes: 2056
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
const int N=2e5+10;
char s[N];
int cnt=0,n;ll ans;
int main()
{
	scanf("%s",s+1);n=strlen(s+1);
	for (int i=n;i;i--) if (s[i]=='B') cnt++,ans+=n-cnt+1-i;
	cout<<ans;
}

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

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

    int x = 0,
        y = 0,
        t = 0;
    for (int i=0; i<N; i++) {

        int t_i, x_i, y_i;
        cin >> t_i >> x_i >> y_i;
        int t_d = abs(t_i - t);
        int x_d = abs(x - x_i);
        int y_d = abs(y - y_i);
        int sum_d = x_d + y_d;

        if (sum_d <= t_d && (sum_d % 2 == t_d % 2)) {
            x = x_i;
            y = y_i;
            t = t_i;
        } else {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> Q;

ll v, e, r, s[2000], t[2000], d[2000], dp[1001], INF = 1e9;

bool search() {
  for (ll i = 0; i < v; i++) dp[i] = INF;
  dp[r] = 0;
  for (ll i = 0; i < v; i++) {
    bool ok = true;
    for (ll j = 0; j < e; j++) {
      if (dp[s[j]] == INF) continue;
      if (dp[t[j]] > dp[s[j]] + d[j]) {
        dp[t[j]] = dp[s[j]] + d[j];
        ok = false;
        if (i == v-1) return true;
      }
    }
    if (ok) break;
  }
  return false;
}

int main() {
  scanf("%lld%lld%lld", &v, &e, &r);
  for (ll i = 0; i < e; i++) scanf("%lld%lld%lld", &s[i], &t[i], &d[i]);
  if (search()) {
    printf("NEGATIVE CYCLE\n");
  } else {
    for (ll i = 0; i < v; i++) {
      if (dp[i] == INF) printf("INF\n");
      else printf("%lld\n", dp[i]);
    }
  }
}



Measured memory_bytes: 2756
#include<bits/stdc++.h>
using namespace std;
int n,m,i,j,d,k,c;
int main()
{
  for(cin>>n;i<n;i++){
    cin>>m;if(m%2==1)continue;
    if(m%3!=0&&m%5!=0)return cout<<"DENIED",0;
  }
  cout<<"APPROVED";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m; i < n; i++) 
#define mod 1000000007
typedef long long ll;

bool is_Palindrome(string s){
    string t=s;
    reverse(s.begin(), s.end());
    if(s==t){
        return true;
    }else{
        return false;
    }
}

int main(){
    string S;
    cin>>S;
    int N=S.size();
    string s=S.substr(0,(N-1)/2);
    string t=S.substr((N+3)/2-1);
    if(is_Palindrome(S)&&is_Palindrome(s)&&is_Palindrome(t)){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

    return 0;
}

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

int main() {
    double w, h, x, y;
    cin >> w >> h >> x >> y;
    double s = w * h / 2;
    int a = 0;
    if (w == x * 2 && h == y * 2) a++;
    cout << s << " " << a << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const LL mod = 1e9 + 7;
const int N = 100005;

int main() {
    string s;
    cin >> s;
    int ok = 1;
    if (s.size() % 2) ok = 0;
    for (int i = 0; i < s.size(); i++) {
        if (i % 2 == 0) {
            if (s[i] != 'h') ok = 0;
        } else {
            if (s[i] != 'i') ok = 0;
        }
    }
    puts(ok ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main( )
{
    int n , num[1000] , count = 0  , i ;
    scanf("%d" , &n);
    
    for( i = 1 ; i <= n ; i++)
        scanf("%d" , &num[i]);
    
    for( i = 1 ; i < n-1 ; i++)
    {
        if( num[i] < num[i+1])
        {
            if( num[i+1] < num[i+2])
                count++ ;
        }
        
        else if( num[i] > num[i+1] )
        {
                if( num[i+1] > num[i+2])    
                    count++ ;
        }
    }
    
    printf("%d\n" , count);
    
    return 0 ;
}


Measured memory_bytes: 1736
import math
a, b, h, m = map(int, input().split())
 
h_arg = (h/12)*360 + (m/60)*30
m_arg = (m/60)*360
 
ans = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(h_arg-m_arg)))
print(ans)
 

Measured memory_bytes: 9340
#include <string>
#include <iostream>
using namespace std;
int main(){
	string a, b;
	cin >> a >> b;
	if (a.size() != b.size()){
		printf("No\n");
		return 0;
	}
	int n = a.size(), x1[26], x2[n], y1[26], y2[n], c;
	for (int i = 0; i < 26; i++){
		x1[i] = -1;
		y1[i] = -1;
	}
	c = 0;
	for (int i = 0; i < n; i++){
		int t = a[i] - 97;
		if (x1[t] == -1){
			x1[t] = c;
			c++;
		}
		x2[i] = x1[t];
	}
	c = 0;
	for (int i = 0; i < n; i++){
		int t = b[i] - 97;
		if (y1[t] == -1){
			y1[t] = c;
			c++;
		}
		y2[i] = y1[t];
		if (x2[i] != y2[i]){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
}

Measured memory_bytes: 2312
n,m=map(int,input().split())
a=list(map(int,input().split()))
da={}
for x in a:
        try:
                da[x]+=1
        except:
                da[x]=1
d={}
for i in range(m):
        b,c=map(int,input().split())
        try:
                d[c]+=b
        except:
                d[c]=b
k=sorted(d.keys())[::-1]
ka=sorted(da.keys())
i=0
su=0
f=True
for x in k:
        num=d[x]
        while(num and f):
                try:
                        ka_num=ka[i]
                except:
                        f=False
                        break
                if ka_num>=x:
                        f=False
                        break
                if da[ka_num]<=num:
                        num-=da[ka_num]
                        i+=1
                        su+=x*da[ka_num]
                else:
                        da[ka_num]-=num
                        su+=num*x
                        num=0
        if not f:
                while(1):
                        try:
                                ka_num=ka[i]
                                su+=ka_num*da[ka_num]
                                i+=1
                        except:
                                break
                break
if f:
        while(1):
                try:
                        ka_num=ka[i]
                        su+=ka_num*da[ka_num]
                        i+=1
                except:
                        break
print(su)

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



int main() {
	int Sx, Sy, Tx, Ty;
	cin >> Sx >> Sy >> Tx >> Ty;
	int i;
	for (i = Sy; i < Ty; i++){
		cout << 'U';
	}
	for (i = Sx; i < Tx; i++) {
		cout << 'R';
	}
	for (i = Ty; i > Sy; i--) {
		cout << 'D';
	}
	for (i = Tx; i > Sx - 1; i--) {
		cout << 'L';
	}
	for (i = Sy; i < Ty+1; i++) {
		cout << 'U';
	}
	for (i = Sx - 1; i < Tx; i++) {
		cout << 'R';
	}
	cout << 'D' << 'R';
	for (i = Ty; i > Sy - 1; i--) {
		cout << 'D';
	}
	for (i = Tx + 1; i > Sx; i--) {
		cout << 'L';
	}
	cout << 'U' << endl;

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  for (int i = 0; i < 5; i++) {
    int x;
    cin >> x;
    if (x == 0) {
      cout << i + 1 << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3652
#include "iostream"
#include "bits/stdc++.h"
using namespace std;
int main()
{
    map<int,int>mp;
    for(int i= 1 ; i<=9 ; i++ )
    {
        for(int j = 1 ; j<=9 ; j++ ){
            mp[i*j]=1;
        }
    }
    int n;
    cin >> n;
    if(mp.find(n)==mp.end()){
        cout<<"No";
    }
    else{
        cout<<"Yes";
    }
}

Measured memory_bytes: 256
#define SUBMIT

#include <bits/stdc++.h>

using namespace std;

int main() {
#ifdef SUBMIT
    auto& in = cin;
#else
    stringstream in(R"(5
1 1 2 2 3
2
1 2
)");
#endif
    int n, q;
    vector<int> S, T;
    in >> n;

    int temp;
    for (int i = 0; i < n; ++i) {
        in >> temp;
        S.push_back(temp);
    }

    in >> q;
    for (int i = 0; i < q; ++i) {
        in >> temp;
        T.push_back(temp);
    }

    int ans = 0;
    for (int t : T) {
        for (int s : S) {
            if (s == t) {
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3244
#include <stdio.h>
int main(void){
int N,K;
char S[55];
scanf("%d%d%s",&N,&K,S);
if(S[K-1]=='A'){
    S[K-1]='a';
}
else if(S[K-1]=='B'){
    S[K-1]='b';
}
else if(S[K-1]=='C'){
    S[K-1]='c';
}
printf("%s",S);
}

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

typedef long long ll;

vector<pair<char,int>> RunLengthEncoder_ForString(string v){
    vector<pair<char,int>> RLE;
    int cnt = 1;
    for(int i = 0; i < (int)v.size(); ++i){
        if(i == (int)v.size()-1){
            RLE.push_back(make_pair(v[i], cnt));
            continue;
        }
        if(v[i] == v[i+1])cnt++;
        else{
            RLE.push_back(make_pair(v[i],cnt));
            cnt = 1;
        }
    }
    return RLE;
}

int main() {
    int N,K;
    string S;
    cin>>N>>K;
    cin>>S;
    auto T = RunLengthEncoder_ForString(S);
    ll ans = 0;
    rep(i,(int)T.size()){
        ans += T[i].second-1;
    }
    ans = min((ll)N-1,ans + 2 * K);
    cout<<ans<<endl;
}

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

int howManyCost(int size, int weight) {
    int res = 0;
    if (size <= 60 && weight <= 2) {
        res = 600;
    } else if (size <= 80 && weight <= 5) {
        res = 800;
    } else if (size <= 100 && weight <= 10) {
        res = 1000;
    } else if (size <= 120 && weight <= 15) {
        res = 1200;
    } else if (size <= 140 && weight <= 20) {
        res = 1400;
    } else if (size <= 160 && weight <= 25) {
        res = 1600;
    }
    return res;
}

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        long long sum = 0;
        for (int i = 0; i < n; i++) {
            int x, y, h, w;
            cin >> x >> y >> h >> w;
            sum += howManyCost(x + y + h, w);
        }
        cout << sum << endl;
    }
}

Measured memory_bytes: 0
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
ips = lambda:input().split()
import collections
import math
import itertools
import heapq as hq

n,k = ma()
mod =998244353
lr=[]
for i in range(k):
    lr.append(lma())
lr.sort()
dp = [0]*(n+1) #dp[i]:和がiになる組み合わせの数 dp[i] = sum_{d in S} dp[i-d]を高速化したい
dp[0]=1
tot=[0]*(n+1) #tot[i] = sum dp[0:i] 和がi以下になる組み合わせ
tot[0]=1
for i in range(1,n):
    for l,r in lr:
        if i-l<0:
            continue
        elif i-r<0:
            r=i
        dp[i]+=tot[i-l]-tot[i-r-1]
        dp[i]%=mod
    tot[i]=(tot[i-1] + dp[i])%mod
    
print(dp[n-1])


Measured memory_bytes: 77268
//
// Created by moono on 2018/10/27.
//

#include <iostream>
#include <set>
using namespace std;


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

    //
    set<int> set;
    int d;
    for (int i = 0; i < N; ++i) {
        cin >> d;
        set.insert(d);
    }

    cout << set.size() << endl;

    return 0;
}

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

int main() {
	int64_t N = 0,s = 0,t = 0,u = 0;
	cin >> N;
    s = N / 3;
    t = N / 5;
    u = N / 15;
    cout << (N * (N + 1) / 2) - (s * (3 * (s + 1)) / 2) - (t * (5 * (t + 1)) / 2) + (u * (15 * (u + 1)) / 2) << endl;
  	return 0;
}


Measured memory_bytes: 3624
# -*- coding: utf-8 -*-
from collections import Counter
import math
n=input()
a=map(int, raw_input().split())
b=Counter(a)
freq_val=b.most_common(1)[0][0]


index_num=[n for n, v in enumerate(a) if v==freq_val]
d=index_num[1]-index_num[0]


div = int(1e9 + 7)
fact, inv_fact = [1], [1]
fact_tmp = 1
for i in range(1, n + 2):
    fact_tmp *= i
    fact_tmp %= div
    fact.append(fact_tmp)
    inv_fact.append(pow(fact_tmp, div - 2, div))


def combination(x,r):
	if n < 0 or r < 0 or x < r:
		return 0
	else:
		return (fact[x] * inv_fact[r] * inv_fact[x - r]) % div


for k in range(1,n+2):
	print (combination(n+1,k)-combination(n-d,k-1))% div



Measured memory_bytes: 24636
def main():
    # ABC117c
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)

    n, m = map(int, input().split())
    x = list(map(int, input().split()))
    if(m == 1):
        print(0)
        exit(0)
    if(n >= m):
        print(0)
        exit(0)
    x.sort()
    sa = [0]
    for i in range(1, m):
        sa.append(x[i]-x[i-1])
    # print(x)
    # print(sa)
    # print('aa')
    sa.sort()
    # or _ in range(min(n-1, len(sa)-1)):
    #    sa = sa[:-1]
    # print(sa)
    print(sum(sa[:len(sa)-min(n-1, len(sa)-1)]))


if __name__ == '__main__':
    main()

Measured memory_bytes: 56800
// template version 1.12
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int n;cin>>n;
  vector<int> a(n+1);
  rep(i, n) {
    cin>>a[i+1];
  }
  dump(a);

  vi b(n+1);
  rrep(i, 1, n+1){
    int k = 2*i;
    int cnt = 0;
    while(k<=n){
      dump(i, k);
      if (b[k]==1){
        cnt++;
      }
      k += i;
    }
    dump(i, cnt);
    if ((cnt+a[i])%2==1){
      b[i] = 1;
    }
  }
  dump(b);

  int m=0;
  vi ans;
  rep(i,1,n+1){
    if (b[i]){
      m++;
      ans.pb(i);
    }
  }
  dump(ans);
  cout << m << endl;
  rep(i, sz(ans)) cout << ans[i] << (i!=sz(ans)-1 ? " " : "\n");

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 5108
while n = gets do
    n = n.to_f
    if n <= 48.00
        puts "light fly"
    elsif 48.00 < n && n <= 51.00
        puts "fly"
    elsif 51.00 < n && n <= 54.00
        puts "bantam"
    elsif 54.00 < n && n <= 57.00
        puts "feather"
    elsif 57.00 < n && n <= 60.00
        puts "light"
    elsif 60.00 < n && n <= 64.00
        puts "light welter"
    elsif 64.00 < n && n <= 69.00
        puts "welter"	
    elsif 69.00 < n && n <= 75.00
        puts "light middle"
    elsif 75.00 < n && n <= 81.00
        puts "middle"
    elsif 81.00 < n && n <= 91.00
        puts "light heavy"
    elsif 91.00 < n 
        puts "heavy"
    end
            
end



Measured memory_bytes: 6884
using System;
using System.Linq;

class B
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var a = new int[n].Select(_ => int.Parse(Console.ReadLine())).ToArray();

		var r = 0L;
		for (int i = 0; i < n; i++)
		{
			r += a[i] / 2;
			a[i] %= 2;
			if (a[i] == 1 && i < n - 1 && a[i + 1] > 0)
			{
				r++;
				a[i + 1]--;
			}
		}
		Console.WriteLine(r);
	}
}


Measured memory_bytes: 16992
s=str(input())
l=[0,0]
i=0
for n in range(0,len(s)):
  if s[n]==' ':
    l[i]=n
    i+=1
  if i==2:
    break
X=int(s[0:l[0]])
Y=int(s[l[0]+1:l[1]])
Z=int(s[l[1]+1:len(s)])
temp1=X
X=Y
Y=temp1
temp2=X
X=Z
Z=temp2
print(X,' ',Y,' ',Z)

Measured memory_bytes: 3064
import itertools
N, K = map(int, input().split())
if K > (N-1)*(N-2)//2:
    print(-1)
else:
    print(N-1+(N-1)*(N-2)//2-K)
    for i in range(N-1):
        print(i+1, N)
    A = list(itertools.combinations(range(1,N),2))
    for i in range((N-1)*(N-2)//2-K):
        print(*A[i])

Measured memory_bytes: 4000
program main
  implicit none
  integer i, K, L
  character(103) S,Sa
  read(*, *) K
  read(*, *) S
  !read(*, *) (L(i), i = 1,N)
  L = len(trim(S))
  if (L > K) then
    do i = K+1,103
      S(i:i) = '.'
    end do
    write(*, *) S(1:K+3)
  else
    write(*, *) S
  end if
end program main


Measured memory_bytes: 2856
n, m = map(int, input().split())
s = []
for i in range(n):
    s.append(input())
ans = 0
def bfs(x,y):
    visit = set()
    queue = [[(x, y)]]
    res = -1
    cnt = 0
    while queue != [[]]:
        tmp = queue.pop(0)
        temp = []
        for i in range(len(tmp)):
            a = tmp[i][0]
            b = tmp[i][1]
            if tmp[i] in visit:
                continue
            visit.add(tmp[i])
            if a > 0 and s[a - 1][b] != "#" and (a-1, b) not in visit:
                temp.append((a-1, b))
            if a < n - 1 and s[a + 1][b] != "#" and (a + 1, b) not in visit:
                temp.append((a + 1, b))
            if b > 0 and s[a][b - 1] != "#" and (a, b-1) not in visit:
                temp.append((a, b-1))
            if b < m-1 and s[a][b + 1] != "#" and (a, b+ 1) not in visit:
                temp.append((a, b + 1))
            if not temp:
                res = max(res, cnt)
        queue.append(temp)
        cnt += 1
    return res
for i in range(n):
    for j in range(m):
        if s[i][j] != ".":
            continue
        else:
            ans = max(ans, bfs(i,j))
print(ans)

Measured memory_bytes: 3188
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <vector>

#define el endl
#define fd fixed
#define INF INT_MAX/2-1
#define pb push_back

using namespace std;

class IR
{
private:
  int m_w;
  int m_h;
  int m_diagonal;
public:
  void setW(int w);
  void setH(int h);
  void setDiagonal(int w, int h);
  int getW();
  int getH();
  int getDiagonal();
  IR(int w, int h) {
    setW(w);
    setH(h);
    setDiagonal(w, h);
  }
};

void IR::setW(int w) {
  m_w = w;
}

void IR::setH(int h) {
  m_h = h;
}

void IR::setDiagonal(int w, int h) {
  m_diagonal = w*w + h*h;
}

int IR::getW() {
  return m_w;
}

int IR::getH() {
  return m_h;
}

int IR::getDiagonal() {
  return m_diagonal;
}

int main() {
  int w, h;
  vector<IR> IRs;
  for (int i = 1; i < 150; i++) {
    for (int j = 1; j < i; j++) {
      IRs.pb(IR(i, j));
    }
  }
  for (int i = 0; i < IRs.size(); i++) {
    for (int j = i+1; j < IRs.size(); j++) {
      if (IRs[i].getDiagonal() > IRs[j].getDiagonal() || (IRs[i].getDiagonal() == IRs[j].getDiagonal() && IRs[i].getH() > IRs[j].getH())) {
        swap(IRs[i], IRs[j]);
      }
    }
  }
  while (cin >> h >> w, w | h) {
    for (int i = 0; i < IRs.size(); i++) {
      if (w == IRs[i].getW() && h == IRs[i].getH()) {
        cout << IRs[i+1].getH() << " " << IRs[i+1].getW() << el;
        break;
      }
    }
  }
}

Measured memory_bytes: 1328
N, H = map(int,input().split())
A, B = [], []
for i in range(N):
  a, b = map(int,input().split())
  A += [a]
  B += [b]

nocost = max(A)
B.sort()

ans = 0
while H > 0:
  if B:
    atk = B.pop(-1)
    if atk > nocost:
      H -= atk
      ans +=1
    else: 
      ans += (H+nocost-1)//nocost
      H -= nocost*(H+nocost-1)//nocost
  else:
    ans += (H+nocost-1)//nocost
    H -= nocost*(H+nocost-1)//nocost

print(ans)

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

long long int N, M, Q, dp[505][505], l, r;

int main(){
    scanf("%lld%lld%lld", &N, &M, &Q);
    
    for(int i = 0; i < M; ++i){
        scanf("%lld%lld", &l, &r);
        ++dp[1][r];
        --dp[l + 1][r];
    }
    
    for(int i = 1; i <= N; ++i)
        for(int j = 0; j <= N; ++j)
            dp[i][j] += dp[i - 1][j];
    
    for(int i = 0; i <= N; ++i)
        partial_sum(dp[i], dp[i + 1], dp[i]);
    
    for(int i = 0; i < Q; ++i && printf("%lld\n", dp[l][r]))
        scanf("%lld%lld", &l, &r);
    
    return 0;
}


Measured memory_bytes: 2944
n, cc = [int(i) for i in input().split()]
up = [[0] * (2 * 10 ** 5) for _ in range(cc)]
ch = [[0] * (2 * 10 ** 5) for _ in range(cc)]

for _ in range(n):
    s, t, c = map(int, input().split())
    c -= 1
    up[c][s] += 1
    up[c][t] -= 1

for j in range(cc):
    k = 0
    for i in range(2 * 10 ** 5):
        if up[j][i] == 1:
            k = 1
        ch[j][i] = k
        if up[j][i] == -1:
            k = 0
ans = 0
for i in range(2 * 10 ** 5):
    k = 0
    for j in range(cc):
        k += ch[j][i]
    ans = max(ans, k)
print(ans)


Measured memory_bytes: 131464