akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define AND(x,y,z) 
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (ll i=(ll)(a);i<(ll)(b);++i)
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)
#define YES(cond) cond ? OUT("YES") : OUT("NO")
#define Yes(cond) cond ? OUT("Yes") : OUT("No")

template<class T> T gcd(const T x,const T y){if(!y){return x;}return gcd(y,x%y);}
template<class T> T lcm(const T x,const T y){return x/gcd(x,y)*y;};
template<class T> T modpow(T x,T n,const T mod) {
  T res=1;while(n>0){if(n%2)res=res*x%mod;x=x*x%mod;n/=2;};return res;
}
template<class T> T modinv(T x,const T mod){return modpow(x,mod-2,mod);}
template<class T> bool alltrue(const T &a){return all_of(ALL(a),[](bool x){return x;});}
template<class T> bool anytrue(const T &a){return any_of(ALL(a),[](bool x){return x;});}
template<class T> bool contain(const T &a,const T &b){for(auto x:b){if (a.find(x)==a.end()){return false;}}return true;}
template<class T> bool mmax(T &m,const T q){ if (m < q) {m = q; return true;} else return false; }
template<class T> bool mmin(T &m,const T q){ if (m > q) {m = q; return true;} else return false; }
template<class T> int siz(const T &a) {return (int)a.size();}
template<class T> set<T> devisers(T n) {
  set<T> res;for(T i=1;i<(T)sqrt(n)+1;i++){if(n%i==0){res.insert(i);res.insert(n/i);}}return res;
}
template<class T> void concat(T &a, const T &b){a.insert(a.end(),b.begin(),b.end());}
template<class T> void getand(const T &a,const T &b,T &c) {
  set_intersection(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}
template<class T> void getor(const T &a,const T &b,T &c) {
  set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}
template<class T> void getdiff(const T &a,const T &b,T &c) {
  set_difference(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}
template<class T> T deg2rad(T deg) {return deg*2*M_PI/360;}
template<class T> T rad2deg(T rad) {return rad*360/(2*M_PI);}

typedef long long ll;
typedef pair<ll, ll> P;

const ll MOD=1e9+7;
const ll MAX=5e6;

int main() {
  // 幸福の最大数
  // 自分の前に自分と同じ人がいれば幸せ+1
  // 全員同じ向きを向くのが最大なので、そこまでできればもう何もしない
  // 反転しても、最大で2しか増えない
  // 反転するのは同じ向きを向いている塊
  // 両側を別向きで挟まれているところ優先
  //
  // LLLは左端の人以外、RRRは右端の人以外
  int N,K;cin>>N>>K;
  string S;cin>>S;
  vector<int> groups;
  char prevch = S[0];
  int cnt=0;
  REP(i,N) {
    if (prevch==S[i]) cnt++;
    else {
      groups.push_back(cnt);
      prevch=S[i];
      cnt=1;
    }
  }
  groups.push_back(cnt);

  REP(i,K) {
    // 残り二つ以下 = 全部同じ向きになる
    if (siz(groups)<=2) {
      OUT(N-1);
      return 0;
    } else {
      ll tmp=0;
      REP(i,3) {
        tmp+=groups.back();
        groups.pop_back();
      }
      groups.push_back(tmp);
    }
  }
  ll ans = 0;
  REP(i,siz(groups)) ans+=groups[i]-1;
  OUT(ans);

  return 0;
}

Measured memory_bytes: 1020
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;++i)
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const ll MOD = 1e9 + 7;




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

	vector< vector<int> >a(h,vector<int>(w,0));
	rep(i, 0, h)rep(j, 0, w)cin >> a[i][j];

	map<int, pair<int,int>>mp;
	rep(i, 0, h) {
		rep(j, 0, w) {
			mp[a[i][j]] = {i,j};
		}
	}


	vector<int> sum(h*w+1,0);

	rep(i, d + 1, h*w + 1) {
		sum[i] = sum[i - d] + abs(mp[i].first-mp[i-d].first) + abs(mp[i].second - mp[i-d].second);
	}

	int q;
	cin >> q;
	rep(i, 0, q) {
		int l, r;
		cin >> l >> r;
		cout << sum[r]-sum[l] << endl;
	}

	return 0;
}

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

s = [input() for i in range(n)]

s.sort()

tmp = -1
kouho = []
#print(s)


for i in range(n-1):
    #print(i,s[i+1])
    if s[i] == s[i+1]:
       tmp -= 1
       if i+1 == n-1:
           kouho.append([tmp,s[i]])
    else:
        kouho.append([tmp,s[i]])
        tmp = -1
        if i+1 == n-1:
            kouho.append([tmp,s[i+1]])

kouho.sort()

num = 0
print(kouho[0][1])


if len(kouho) == 1:
    exit()

for i in range(n-1):
    if kouho[0][0] == kouho[i+1][0]:
        print(kouho[i+1][1])
    else:
        exit()



#print(kouho)

Measured memory_bytes: 100396
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        String str = s.next();
        char[] c = str.toCharArray();
        int size = c.length;
        int count = 0;
        int Count = 0;
        for (char value : c) if (value == 'W') count++;
        if (count <= size - count) {
            for (int i = 0; i < size - count; i++) if (c[i] == 'W') Count++;
        } else {
            for (int i = 0; i < count; i++) if (c[size - i - 1] == 'R') Count++;
        }
        System.out.println(Count);
    }
}

Measured memory_bytes: 40832
import java.util.Scanner;

public class Main {

	private void solve() {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		
		System.out.println((N%10==9||N/10==9)?"Yes":"No");
	}

	public static void main(String[] args) {
		new Main().solve();
	}
}

Measured memory_bytes: 21972
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    long h, w;
    scan(h, w);
    auto c = new string[][](h);
    foreach (i; 0 .. h)
    {
        c[i] = aryread!string();
    }
    // writeln(c);
    foreach (i; 0 .. h)
    {
        foreach (_; 0 .. 2)
        {
            foreach (j; 0 .. c[i].length)
            {
                write(c[i][j]);
            }
            writeln();
        }
    }
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}


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

#include <set>
#include <iterator>
using namespace std;
using namespace __gnu_pbds;


#define ft first
#define sd second
#define pb push_back
#define all(x) x.begin(),x.end()

#define ll long long int
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) for(int i=0;i<v.size();i++) cout << v[i] << " " ;

#define f_in(st) freopen(st,"r",stdin)
#define f_out(st) freopen(st,"w",stdout)

#define INF INT_MAX
#define matrix vector<vector<ll> >

#define fr(i, a, b) for(i=a; i<=b; i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define ASST(x, l, r) assert( x <= r && x >= l )

typedef tree<pll, null_type, less<pll>, rb_tree_tag,
             tree_order_statistics_node_update>
    new_data_set;
const int N=2e3+10, M=(ll)1e9+1 ;
const int mod = 1e9+7  ;
ll dp[N][N];
void work(){
  ll n,m;
  cin >> n >> m;
  vl a(n+1),b(m+1);
  for(ll i=1;i<=n;i++)
    cin >> a[i];
  for(ll i=1;i<=m;i++)
        cin >> b[i];

  for(ll i=1;i<=n;i++){
        for(ll j=1;j<=m;j++){
                dp[i][j]=(dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1]+mod)%mod;
                if(a[i]==b[j]){
//                        cout << i <<  " " << j << endl;
                        dp[i][j]=(dp[i][j]+ dp[i-1][j-1]+1)%mod;
                }
        }
  }
  cout << (dp[n][m]+1)%mod;

}
int main(){
 ios_base::sync_with_stdio(0);

    ll t,z;
    // cin >> t;
    // z=t;
    t=1;
    while(t--){
            // cout << "Case #" << z-t << ": ";
            work();
    }
   return 0;

}


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

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

  string board[h];
  for (int i = 0; i < h; i++) { cin >> board[i]; }

  // counter clockwise
  const int dx[8] = {1, 1, 0, -1, -1, -1,  0,  1};
  const int dy[8] = {0, 1, 1,  1,  0, -1, -1, -1};

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (board[i][j] == '#') { continue; }

      int num = 0;
      for (int d = 0; d < 8; d++) {
        // vertical
        const int ni = i + dy[d];
        // horizontal
        const int nj = j + dx[d];
        if (ni < 0 || ni >= h) { continue; }
        if (nj < 0 || nj >= w) { continue; }
        if (board[ni][nj] == '#') { num++; }
      }

      board[i][j] = '0' + num;
    }
  }

  for (int i = 0; i < h; i++) { cout << board[i] << endl; }
  return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))

d = defaultdict(int)
for i in range(n):
    d[a[i]] += 1

res = 0
for k, v in d.items():
    if k <= v:
        res += (v - k)
    else:
        res += v
print(res)


Measured memory_bytes: 18668
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

int main(){
  int i,j;
  int a,b;
  cin>>a>>b;
  VI e(10,0);
  e[a]=1;
  e[b]=1;
  for(i=1;i<=3;i++){
    if(e[i]==0){
      cout<<i<<endl;
      return 0; 
    }
  }
  return 0;
}

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

int main()
{
    int a,b,k;
    cin >> a >> b >> k;
    vector<int> ans;
    for(int i = 1; i <= min(a,b); i++){
        if(a%i == 0 && b%i ==0){
            ans.push_back(i);
        }
    }
    sort(ans.begin(),ans.end(),greater<int>());
    cout << ans[k-1] << endl;
}

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

using namespace std;

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

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

const ll maxn  = 3e6;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb push_back
#define endl '\n'
#define dokme(x) return(cout << x , 0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ms(x , y) memset(x , y , sizeof x);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

ll a , b;

ll s1(){
	if(a<=b)
		return(b - a);
	return(1e18);
}

ll s2(){
	if(-a <= b)
		return(b + a + 1);
	return(1e18);
}

ll s3(){
	if(-a <= -b)
		return(a-b + 2);
	return(1e18);
}

ll s4(){
	if(a <= -b){
		return(-b-a+1);
	}
	return(1e18);
}

int main(){
    migmig
    cin >> a >> b;
    ll ans = 1e18;
    ans = min(ans , s1());
    ans = min(ans , s2());
    ans = min(ans , s3());
    ans = min(ans , s4());
    cout << ans;
    return(0);
}

Measured memory_bytes: 256
n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))
maximum = -10**9
for i in range(n):
    totalfull = 0; totalcut = 0; count = 0; location = i
    maximumfull = -10**9; maximumcut = -10**9
    for j in range(min(n, k)):
        location = p[location]-1
        totalfull += c[location]
        maximumfull = max(maximumfull, totalfull)
        count += 1
        if location == i: break
    for j in range(k%count):
        location = p[location]-1
        totalcut += c[location]
        maximumcut = max(maximumcut, totalcut)
    maximum = max(maximum, max(maximumfull, max((k//count-1)*totalfull+maximumfull, k//count*totalfull+maximumcut)))
print(maximum)

Measured memory_bytes: 85928
N = input()
l = len(N)
f9 = True

def digitsum(s):
    result = 0
    S = str(s)
    for d in S:
        result += int(d)

    return result

for i in range(0,8):
    if (str(i) in N[1:l]):
        f9 = False

if (f9):
    print(digitsum(N))
else:
    tmp = str((int(N[0])-1)) + "9"*(l-1)
    print(digitsum(tmp))

Measured memory_bytes: 3064
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

//よくわかんないけど通った？

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


	int N, K;
	scanf("%d", &N);
	scanf("%d", &K);
	int H[302] = {};
	rep1(i, N) scanf("%d", H + i);
	ll hutuu = 0;
	rep(i, N + 1) {
		if (H[i + 1] > H[i]) hutuu += H[i + 1] - H[i];
	}

	if (N == K) {
		printf("0");
		return 0;
	}

	ll dp[302][301] = {};
	rep(i, N + 1) {
		auto dpi = dp[i];
		ll tmp1 = max(0, H[i + 1] - H[i]);
		ll tmp2 = max(0, H[i] - H[i + 1]);
		ll tmp3 = min(tmp1, tmp2);
		int mae = H[i + 1];
		ll maetmp = tmp3;
		for (int j = i + 2; j <= min(N + 1, K + i + 1); j++) {
			if (mae < H[j]) tmp1 += H[j] - mae;
			if (mae > H[j]) tmp2 += mae - H[j];
			tmp3 = min(tmp1, tmp2);
			if (maetmp < tmp3) {
				int k = j - i - 1;
				auto dpj = dp[j] + k;
				rep(p, K - k + 1) chmax(dpj[p], dpi[p] + tmp3);
			}
			mae = H[j];
			maetmp = tmp3;
		}
		auto dpi2 = dp[i + 1];
		rep(p, K + 1) chmax(dpi2[p], dpi[p]);
	}
	printf("%lld", hutuu - dp[N + 1][K]);


	Would you please return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
const unsigned long long int M= 1000000007;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()	
#define fr(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define int   long long 
#define endl "\n"
using namespace std;
int power(int x,int y){int res=1;while(y>0){if(y&1)res=x*res; y=y>>1;x=x*x;}return res;}
int power(int x,int y,int mod){int res=1;while(y>0){if(y&1)res=x*res%mod; y=y>>1;x=x*x%mod;}return res;}

void nik()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
}
     

 	#define F first 
	#define S second 


int vis[50]={0};
std::vector<int> v[50],ans[50];

void dfs(int i,int p)
{
	if(v[i].size()==0)return ;
	if(!vis[i])
	{
		vis[i]=1;
		ans[p].pb(i);
		for(int it:v[i])
		{
			if(!vis[it])dfs(it,p);
		}

	}
}

signed main()
{	//nik();

int test=1;
//cin>>test;
while(test--)
{

int n;
cin>>n;
int ans=0;
for(int i=1;i<n;i++)
{
	int x=(n-1)/i;
	x=2*x;
	if(2*i-1>=x)break;
	int y=x-(2*i-1);
	ans+=y;
}
cout<<ans<<endl;

}
return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline T intceil(T a, T b) { return (a + (b - 1)) / b; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
#define precout() cout << std::fixed << std::setprecision(20);
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
const int dy[4] = { 0, 1, 0, -1 };
const int dx[4] = { 1, 0, -1, 0 };
typedef complex<double> cd;
static const double pi = 3.141592653589793;

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

  int n; cin >> n;
  ll ans = 0;
  ll prev = 0;
  rep(i, n) {
    ll tmp; cin >> tmp;
    if(tmp == 0) {
      prev = 0;
      continue;
    }

    tmp += prev;

    ans += tmp / 2;
    prev = tmp % 2;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int m,d,i,ans=0;
    scanf("%d %d",&m,&d);
    for(i=22;i<=d;i++)
    {
        int s=i/10,g=i%10;
        if(g<2)
            continue;
        if(s*g<=m)
        {
            ans++;
        }

    }
    printf("%d\n",ans);
    return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    ll N,K;cin>>N>>K;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];
    sort(All(A));
    ll l=-1e18,r=1e18;
    while(r-l>1){
        ll mid=(r+l)>>1;
        ll res=0;
        REP(i,N){
            int k;
            if(A[i]<0){
                ll tmp=mid/A[i];
                if(mid<0&&llabs(mid)%A[i]) tmp++;
                k=A.end()-lower_bound(All(A),tmp);
                res+=min((ll)k,N-i-1);
            }
            else if(A[i]>0){
                ll tmp=mid/A[i];
                if(mid<0&&llabs(mid)%A[i]) tmp--;
                k=upper_bound(All(A),tmp)-A.begin();
                res+=max(k-i-1,0);
            }
            else{
                res+=(mid>=0)?N-i-1:0;
            }
        }
        if(res>=K) r=mid;
        else l=mid;
    }
    cout<<r<<endl;
}


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

int main(){
  int n , a;
  a = 0;
  cin >> n;
  for (int i = 0;i < n;i++){
    int a1,a2;
    cin >> a1 >> a2;
    a += a2-a1+1;
  }
  cout << a << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;



void solve(int n){
    int res = n%10;
    if(n%10==3){
        printf("bon \n");
    }else if(res == 2 || res==4 || res==5 || res==7 || res==9){
        printf("hon \n");
    }else{
        printf("pon \n");
    }
    
}



int main()
{
 
    FastIO 



    int n;
    cin >> n;
    solve(n);


    return 0;
        
}
 
  






Measured memory_bytes: 3652
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N,A,B,pp;
        N=sc.nextInt();
        A=sc.nextInt();
        B=sc.nextInt();
        pp=N*A;

        if(pp>B) System.out.println(B);
        else System.out.println(pp);
    }
}


Measured memory_bytes: 21716
fun main(args: Array<String>) {
    val N = nextInt()
    val P = listOfInt().sorted()
    println(P[N / 2] - P[N / 2 - 1])
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }


Measured memory_bytes: 52384
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] <= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) left = mid;
		else right = mid;
	}
	/* left は条件を満たす最大の値、right は条件を満たさない最小の値になっている */
	return left;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int main() {
	long long int n;
	cin >> n;
	long long int ten = 10;
	long long int nine = 9;
	long long int eight = 8;
	for (int i = 0; i < n-1; i++) {
		ten = ten * 10 % MOD;
		nine = nine * 9 % MOD;
		eight = eight * 8 % MOD;
	}
	//cout << " " << ten << " " << nine << " " << eight << endl;
	long long int ans = ten - 2 * (nine - eight) - eight;
	ans = ans % MOD;
	if (ans < 0) {
		ans = ans + MOD;
	}
	cout << ans;
}

Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;

using namespace std;

int main(){
    string s;
    cin >> s;
    if(s.length() < 26){
        vector<bool> es(26);
        rep(i, s.length()){
            es[s[i] - 'a'] = true;
        }
        rep(i, 26){
            if(! es[i]){
                char c = i + 'a';
                cout << s << c << endl;
                return 0;
            }
        }

    }
    int index = -1;

    for(int i = s.length() - 1; i >= 1; i --){
        if(s[i] >= s[i - 1]){
            index = i - 1;
            break;
        }
    }

    if(index == -1){
        cout << -1 << endl;
        return 0;
    }

    for(int i = 0; i < index; i ++){
        cout << s[i];
    }

    for(int i = s.size() - 1; i < s.size(); i --){
        if(s[i] > s[index]){
            cout << s[i] << endl;
            return 0;
        }
    }

    return 0;
}


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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

signed main() {
    int N;
    cin >> N;
    cout << (1000 - N % 1000) % 1000 << endl;
}

Measured memory_bytes: 3588
#include "bits/stdc++.h"

typedef long long ll;

int main()
{
	int n, k;
	std::cin >> n >> k;
	int ndx = 0;
	std::vector<int> a(n);
	for (int i = 0; i < n; ++i)
	{
		std::cin >> a[i];
		if (a[i] < ndx)
		{
			ndx = i;
		}
	}
	int ans = 1;
	n -= k;
	while (n > 0)
	{
		n -= k - 1;
		++ans;
	}
	std::cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 3744
var
n,a,b:longint;
begin
  read(n,a,b);
  if a>b then             //坑点1
    writeln(0)
  else
    if n=1 then           //此处有坑点2
      writeln(ord(a=b))   //Pascal中布尔可以用ord转数字
    else
      writeln((b-a)*(n-2)+1);
end.

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

int main() {
    int n, k;
    while(cin >> n >> k, n) {
        vector<int> a(n);
        for(int i=0; i<n; ++i) {
            cin >> a[i];
        }
        int sum = 0;
        for(int i=0; i<k; ++i) {
            sum += a[i];
        }
        int res = sum;
        for(int i=k; i<n; ++i) {
            sum = sum - a[i-k] + a[i];
            res = max(res, sum);
        }
        cout << res << endl;
    }
}


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

int main(void) {
  int N;
  
  cin >> N;
 
  double a, b, c;
  b = N / 2;
  c = N / 2 + N %2;
  
  a = c / N;
  
  cout << a;
    
  return 0; 
}

Measured memory_bytes: 256
let n = Int(readLine()!)!

var a = [Int]()
for i in 0 ..< n {
    a.append(Int(readLine()!)!)
}

var count = 0
var iter = 0
var r = 1

main: while true {
    if iter == 0 && a[0] > 1 {
        count += a[0] - 1
        a[0] = 1
    } else {
        while a[iter] <= r + 1 {
            r = max(r, a[iter])
            iter += 1
            if a.count <= iter {
                print(count)
                break main
            }
        }
        let div = a[iter] / (r + 1)
        let mod = a[iter] % (r + 1)
        if mod == 0 {
            count += div - 1
            a[iter] = 1
        } else {
            count += div
            a[iter] = mod
        }
    }
}



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

int main(){
  int n, x, l, sum, ans;
  cin >> n >> x ;
  sum = 0;
  
  for(int i = 0; i < n;  i++){
    cin >> l;
    sum += l;
    if( sum <= x){
      ans = i + 2;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>
#include <bitset>
#include <sstream>
#include <cassert>
#include <time.h>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}
void printvec (vec &v) {
    Rep (i, (ll)v.size()) {
        cout << v[i] << " \n"[i+1 == (ll)v.size()];
    }
}

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

    ll N, K;
    cin >> N >> K;
    vec p(N);
    Rep (i, N) {
        cin >> p[i];
    }

    sort(p.begin(), p.end());

    ll ans = 0;
    Rep (i, K) ans += p[i];

    cout << ans << endl;
}

Measured memory_bytes: 3652
#include<stdio.h>
int main(void){
    int n;
    scanf("%d",&n);
    int ans=0;
    while(n--){
        int x,i;
        scanf("%d",&x);
        for(i=2;i*i<=x;i++){
            if(x%i==0)break;
        }
        if(i*i>x)ans++;
    }
    printf("%d\n",ans);
    return 0;
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int AB = A + B;
  int CD = C + D;
  
  if(AB == CD){
    cout << "Balanced" << endl;
  }else if(AB > CD){
    cout << "Left" << endl;
  }else{
    cout << "Right" << endl;
  }

  return 0;
}


Measured memory_bytes: 3592
#include <stdio.h>
int main()
{
  long long a,b,c,d;
  scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
  long long arr[4];
  arr[0] = a*c;
  arr[1] = a*d;
  arr[2] = b*c;
  arr[3] = b*d;
  long long max = arr[0];
  for(int i=1;i<4;i++)
  {
    if(arr[i] > max)
     max = arr[i];
  }
  printf("%lld",max);
  return 0;
}

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

namespace Prac
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(' ').Select(Double.Parse).ToArray();
            var r = inputs[0];
            Console.WriteLine((r * r * Math.PI).ToString("F6") + " " + (2 * r * Math.PI).ToString("F6"));
        }
    }
}

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

using namespace std;

int main() {
    int N;
    long long int K;
    cin >> N >> K;
    vector<int> A(N+1);
    for(int n=1; n<=N; n++) {
        cin >> A[n];
    }
    vector<int> seen(N+1, 0);
    vector<int> lp;
    int cur=1;
    long long int dist=0;
    int ans=-1;
    while(seen[cur]<2) {
        seen[cur]++;
        if(seen[cur]==2) {
            lp.push_back(cur);
        } else {
            dist++;
            if(dist==K) {
                ans = A[cur];
                break;
            }
        }
        cur = A[cur];
    }
    if(ans!=-1) {
        cout << ans << endl;
    } else {
        cout << lp[(K-(dist-lp.size()))%lp.size()] << endl;
    }

    return 0;
    
}

Measured memory_bytes: 5316
import numpy as np

N = int(input())
XY = []
for i in range(N):
    XY.append(list(map(int, input().split())))
XY = np.array(XY)
XY.reshape(N,2)

ans = 0.0
for i in range(N):
    for j in range(N):
        ans += np.sqrt(np.sum(np.square(XY[i]-XY[j])))
ans /= N

print(ans)


Measured memory_bytes: 14488
N, M = map(int, input().split())

R = [ [] for _ in range(N+1) ]

H = list(map(int, input().split()))

for _ in range(M):
  A, B = map(int, input().split())
  R[A].append(B)
  R[B].append(A)

ans = 0

for i in range(N):
  h = H[i]
  r = R[i+1]
  if r == []:
    ans += 1
  else:
    max_h = 0
    for _r in r:
      max_h = max(max_h, H[_r - 1])
    if h  > max_h:
      ans += 1
      
      
print(ans)

Measured memory_bytes: 30892
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>

using namespace std;

typedef pair<int, int> pii;

int w, h;
bool vis[64][64][64][64];
pii ls, lg, rs, rg;
const int dx[]={0, 0, 1, -1}, dy[]={1, -1, 0, 0};

inline bool border(pii p){
	return 0<=p.first&&p.first<w&&0<=p.second&&p.second<h;
}

string solve(vector<string> left, vector<string> right){
	
	queue<pii> lqu, rqu;
	lqu.push(ls);
	rqu.push(rs);
	
	memset(vis, 0, sizeof(vis));
	vis[ls.first][ls.second][rs.first][rs.second] = true;
	
	while(!lqu.empty()&&!rqu.empty()){
	
		pii lnx, rnx, lnw, rnw;
		
		lnw = lqu.front();
		rnw = rqu.front();
		
		lqu.pop();
		rqu.pop();
		
		for(int i=0; i<4; ++i){
			
			lnx = make_pair(lnw.first + dx[i], lnw.second + dy[i]);
			rnx = make_pair(rnw.first - dx[i], rnw.second + dy[i]);
			
			if(!border(lnx)||left[lnx.second][lnx.first]=='#')
				lnx = lnw;
			
			if(!border(rnx)||right[rnx.second][rnx.first]=='#')
				rnx = rnw;
			
			if(lnx == lg && rnx == rg)
				return "Yes";
			
			if(lnx == lg ^ rnx == rg)
				continue;
				
			if(!vis[lnx.first][lnx.second][rnx.first][rnx.second]){
				
				vis[lnx.first][lnx.second][rnx.first][rnx.second] = true;
				lqu.push(lnx);
				rqu.push(rnx);
			}
		}
	}
	
	return "No";
}

int main(){
	
	while(cin>>w>>h, (w||h)){
		
		vector<string> left, right;
		
		for(int i=0; i<h; ++i){
			
			string l, r;
			cin >> l >> r;
			
			left.push_back(l);
			right.push_back(r);
		}
		
		for(int y=0; y<h; ++y){
			for(int x=0; x<w; ++x){
			
				if(left[y][x] == 'L')
					ls = make_pair(x, y);
				if(right[y][x] == 'R')
					rs = make_pair(x, y);
				if(left[y][x] == '%')
					lg = make_pair(x, y);
				if(right[y][x] == '%')
					rg = make_pair(x, y);
			}
		}
		
		cout <<	solve(left, right) << endl;
	}
}

Measured memory_bytes: 18572
#include <iostream>
#include <algorithm>

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

using namespace std;

int bl[101];
int main(){
	int sets;
	cin >> sets;
	while(sets--){
		int n;
		cin >> n;
		rep(i, n) cin >> bl[i];
		int maxh = 0, minh = 0;
		rep(i, n-1){
			maxh = max(maxh, bl[i+1]-bl[i]);
			minh = min(minh, bl[i+1]-bl[i]);
		}
		cout << maxh << ' ' << -minh << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		int sq[15][15]={0};
		if(n==0)break;
		for(int i=n/2+1,j=n/2,count=1;count!=n*n+1;){
			if(sq[i][j]){
				i=(i+1)%n;
				j=((j-1)+n)%n;
				sq[i][j]=count;
			}else{
				sq[i][j]=count;
			}
			i=(i+1)%n;
			j=(j+1)%n;
			++count;
		}
		for(int i=0;i<n;++i){
			for(int j=0;j<n;++j)printf("%4d",sq[i][j]);
			printf("\n");
		}
	}
	return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N,M;
      cin>>N>>M;
    int i,A[N];
    long long int count=0;
    for (i=0;i<N;i++)
    {
      cin>>A[i];
      count+=A[i];
    }
    float k=(float)count/(4*M);
    int b=0;
    for(i=0;i<N;i++)
    {
        if(A[i]>=k)
            b++;
    }
    if(b>=M)
        cout<<"Yes";
    else
      cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  float a[n];
  int i;
  float s=0;
long long int  m=1;
  for(i=0;i<n;i++){
      cin>>a[i];
      a[i]=1/a[i];
      s+=a[i];
  }
  cout<<(1/s)<<endl;
  return 0;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll a,b,c;
int32_t main(){
cin>>a;
cin>>b;
cin>>c;
cout<<max(0LL,c-a+b);
}


Measured memory_bytes: 256
<?php
	fscanf(STDIN, "%d", $N);
	$a = array_map('intval', explode(" ", trim(fgets(STDIN))));
	$c = 0;
	for ($i = 0; $i < $N; $i++) {
		if ($c + 1 === $a[$i]) {
			$c++;
		}
	}
	if ($c === 0) {
		echo "-1";
	} else {
	    echo $N - $c;
	}


Measured memory_bytes: 27120
from fractions import gcd
#from math import gcd
import numpy as np
import sys
input = sys.stdin.readline
mod = 10**9+7

N = int(input())
A = list(map(int, input().split()))

lcm = 1
for s in A:
    lcm = s*lcm//gcd(lcm, s)

ans = lcm*sum([pow(s, mod-2, mod) for s in A]) % mod
#ans = sum([lcm//s % mod for s in A]) % mod

print(int(ans%mod))

Measured memory_bytes: 14016
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define mm map<ii>
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf LONG_MAX
#define minf LONG_MIN
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 

/*
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
#define si short int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
	fast

	vi v(5);
	int a,b,c,d,e,k;
	cin>>a>>b>>c>>d>>e>>k;


	if((e-a) <= k)
	{
		cout<<"Yay!";
	}
	else cout<<":(";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

int main(){
  ll n, y;
  cin >> n >> y;
  ll x[n];
  REP(i, n) cin >> x[i];

  ll z[n];
  ll ans = abs(y - x[0]);
  REP(i, n){
    z[i] = abs(y - x[i]);

    ll a = ans;
    ll b = z[i];
    ll tmp, r;

    if(a<b){
      tmp = a;
      a = b;
      b = tmp;
    }

    r = a % b;
    while(r!=0){
      a = b;
      b = r;
      r = a % b;
    }
    ans = b;
  }


  cout << ans;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s1,s2;
	cin>>s1>>s2;
	int ans=0;
	for(int i=0;i<=2;i++){
		if(s1[i]==s2[i]) ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Collections;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int cnt = 0;
    for (int i = 0; i < S.length(); i++) {
      for (int j = 0; j < S.length(); j++) {
        if (S.charAt(i) == S.charAt(j)) {
          cnt++;
        }
      }
    }
    if (cnt == 8) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 25300
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef pair<string, int>s_i;
typedef pair<int, string>i_s;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,m;
  cin>>n>>m;
  if(m==1)
    cout<<0<<endl;
  else
    cout<<n-(m-1)-1<<endl;
  
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  if((N-N%100)%7==0){
    cout<<"Yes"<<endl;
  }
  else if(N%100-N%10==70||N%10==7){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}
    
    


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

void next_char(char c){
    vector<char> alphabet;
    alphabet = {'a','b','c','d','e','f','g','h','i','j',
                'k','l','m','n','o','p','q','r','s','t',
                'u','v','w','x','y','z'};
    
    for(int i=0;i<alphabet.size()-1;i++){
        if(c == alphabet.at(i)){
            cout << alphabet.at(i+1) << endl;
            break;
        }
    }
}
int main(){
    char s; cin >> s;
    next_char(s);
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<iomanip>
#include<math.h>
using namespace std;
int main(){
    int N;
    std::cin>>N;
    if(N%2==0){
        std::cout<<N/2-1;
    }
    else{
        std::cout<<(N-1)/2;
    }
}

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

#define fio                         \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);                    \
  cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define ld long double
#define endl "\n"
#define ff first
#define ss second
#define pi pair<ll, ll>
#define PI 3.141592653589793238462643383279502884L
#define mp make_pair
#define pb push_back
#define fall(i, a, b) for (int i = a; i < b; i++)
#define sz(x) (ll) x.size()
#define all(x) x.begin(), x.end()
#define ed cout << "ed";
#define time_passed 1.0 * clock() / CLOCKS_PER_SEC
ll MOD = 1e9 + 7;
ll MOD1 = 1e9 + 123;
ll MOD2 = 1e9 + 321;

int main()
{
  fio;
  ll t, a, n, q, k, i, l, m, c, u, f, j, p, r, x, y, s, b, d;
 cin>>a>>b>>c>>k;
		while(k>0)
		{  if(b<=a)
			{b=b*2;
         k--;}
		 else break;
		}
		while(k>0)
		{
			if(c<=b)
			{
				c=c*2;
				k--;
			}
			else break;
		}
		if(b > a && c>b)
		cout<<"Yes";
		else cout<<"No";
  return 0;
}


Measured memory_bytes: 3636
//
// Created by kash on 16/05/20.
//

#include <bits/stdc++.h>

using namespace std;
#define mod 1e9+7
#define ll long long
#define rev_rep(it, last, first) for(int it=last-1;it>=first;--it)
#define out(x) cout << x;
#define pln(x) cout << x << "\n";
#define debug(x) cout << "Debug: " << x << "\n";
#define in(x) cin >> x;
#define rep(it, start, end) for(int it=start;it<end;++it)
#define x first
#define y second


void set_io(int inp) {
#ifndef ONLINE_JUDGE
    string folder = string(getenv("HOME")) + "/CLionProjects/CompetitiveProgramming/inputs/";
    string input_file = folder + "input-" + to_string(inp) + ".txt";
    string output_file = folder + "output-" + to_string(inp) + ".txt";
    freopen(input_file.c_str(), "r", stdin);
    freopen(output_file.c_str(), "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

}


int main() {
    set_io(1);
    int n;
    in(n);
    map<string, int> cnt;
    cnt["AC"] = cnt["WA"] = cnt["RE"] = cnt["TLE"] = 0;

    while (n--) {
        string str;
        in(str);
        cnt[str]++;
    }
    pln("AC x " << cnt["AC"]);
    pln("WA x " << cnt["WA"]);
    pln("TLE x " << cnt["TLE"]);
    pln("RE x " << cnt["RE"]);

    return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define INF 2e9
using namespace std;
typedef long long ll;

int main(){
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> S(H);
    rep(h, H) cin >> S[h];
    int ans = INF;

    rep(b, 1<<(H-1)) {
        vector<int> group(H);
        int g = 0;
        rep(h, H) {
            group[h] = g;
            if (b>>h&1) g++;
        }
        int num = g;
        g++;
        vector<vector<int>> C(g, vector<int>(W,0));
        rep(h,H) rep(w,W) C[group[h]][w] += (S[h][w] - '0');
        vector<int> cur(g, 0);
        auto add = [&](int r) {
            rep(i,g) {
                if (C[i][r]>K) return "IMP";
                cur[i] += C[i][r];
                if (cur[i]>K) {
                    rep(i,g) cur[i] = C[i][r];
                    return "SEP";
                }
            }
            return "KEEP";
        };
        rep(w,W) {
            string res;
            res = add(w);
            if (res=="IMP") {
                num = INF;
                break;
            }
            else if (res=="SEP") num++;
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
} 

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

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1e18;

int main() {
    ll V,E;
    cin >> V >> E;
    vector<vector<ll>> G(V,vector<ll>(V,INF));
    for(ll i=0;i<E;i++){
        ll x,y,cost;
        cin >> x >> y >> cost;
        G[x][y] = cost;
    }
    for(ll i=0;i<V;i++)G[i][i] = 0;
    for(ll k=0;k<V;k++){
        for(ll i=0;i<V;i++){
            for(ll j=0;j<V;j++){
                if(G[i][k]!=INF && G[k][j]!=INF)G[i][j] = min(G[i][j],G[i][k]+G[k][j]);
            }
        }
    }
    for(ll i=0;i<V;i++){
        if(G[i][i]<0){
            cout << "NEGATIVE CYCLE" << endl;
            return 0;
        }
    }
    for(ll i=0;i<V;i++){
        for(ll j=0;j<V;j++){
            if(G[i][j]==INF){
                cout << "INF";
            }else {
                cout << G[i][j];
            }
            cout << (j==V-1 ? '\n':' ');
        }
    }
}


Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;
int main(){
 int X;
 cin>>X;
 bool Q=false;
 for(int i=1;i<1000;i++){
   for(int j=-110;j<i;j++){
     if(i*i*i*i*i-j*j*j*j*j==X){
       Q=true;
       cout<<i<<" "<<j<<endl;
       break;
     }
   }
   if(Q){
     break;
   }
 }
}
       

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

int main()
{

string mark;
int i = 0;
int num=0;
cin>>mark;
char m[4];
for(i=0;i<4;i++){
	m[i]=mark[i];

	if(m[i]=='+'){
		num=num+1;
	}else if(m[i]=='-'){
		num=num-1;
	}

}
cout<<num;
return 0;


}

Measured memory_bytes: 256
let mod = 1000000007
func solve(_ N: Int, _ K: Int, _ positives: [Int], _ negatives: [Int]) -> Int {
	if N == K {
      return (positives + negatives).reduce(1) { 
        $0 * $1 % mod
      }
    }
  	if negatives.isEmpty {
      return positives.prefix(K).reduce(1) { $0 * $1 % mod }
    } else if positives.isEmpty {
      if K & 1 == 0 {
        return negatives.suffix(K).reduce(1) { $0 * $1 % mod }
      } else {
        return negatives.prefix(K).reduce(1) { $0 * $1 % mod }
      }
    }
  	var i = 0
  	var j = negatives.count - 1
  	var current = 1
  	var K = K
  	if K & 1 == 1 {
      current = current * positives[i]
      i += 1
      K -= 1
    }
  	while K > 0 {
      if i >= positives.count - 1 {
        current = current * negatives[j] % mod
        current = current * negatives[j - 1] % mod
        j -= 2
      } else if j <= 0 {
        current = current * positives[i] % mod
        current = current * positives[i + 1] % mod
        i += 2
      } else if positives[i] * positives[i + 1] < negatives[j] * negatives[j - 1] {
        current = current * negatives[j] % mod
        current = current * negatives[j - 1] % mod
        j -= 2
      } else {
        current = current * positives[i] % mod
        current = current * positives[i + 1] % mod
        i += 2
      }
      K -= 2
    }
  	return current
}

let input = readLine()!.split(separator: " ").map { Int($0)! }

let N = input[0]
let K = input[1]

let values = readLine()!.split(separator: " ").map { Int($0)! }

var positives: [Int] = []
var negatives: [Int] = []

for v in values {
  if v < 0 {
    negatives.append(v)
  } else {
    positives.append(v)
  }
}

positives = Array(positives.sorted().reversed())
negatives = Array(negatives.sorted().reversed())

let res = solve(N, K, positives, negatives)
print(res < 0 ? mod + res : res)

Measured memory_bytes: 22360
end = 0
while end == 0 :
    shop = -1
    max_s = 0
    for i in range(5) :
        try :
            s1, s2 = map(int, input().split())
        except EOFError :
            end = 1
            break
    
        if s1 + s2 > max_s :
            max_s = s1 + s2
            shop = i
    
    if shop == 0 :
        shop_name = "A"
    elif shop == 1 :
        shop_name = "B"
    elif shop == 2 :
        shop_name = "C"
    elif shop == 3 :
        shop_name = "D"
    elif shop == 4 :
        shop_name = "E"
    if end == 0 :
        print(shop_name, max_s)


Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a;
    cin >> a;
    if(a>=2800){
        cout << "AGC" << endl;
    }else if(a>=1200){
        cout << "ARC" << endl;
    }else{
        cout << "ABC" << endl;
    }
    return 0;
}

Measured memory_bytes: 256