akhauriyash/Code-Regression huggingface dataset:
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

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

#include <iostream>

using namespace std;

int main()
{
    int a;
    scanf("%d", &a);
    
    if(a>=100 and a<=999)
    {
        printf("ABC%d", a);
    }
    
}


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

int main(void) {
    long long a, b, x, ans;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a >> b >> x;
    if (a == 0) {
        ans = b / x + 1;
    } else {
        ans = b / x - (a - 1) / x;
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
S=input()
T=input()

lt=len(T)
ls=len(S)
if ls<lt:flg=0
else:
 for i in range(ls-lt,-1,-1):
  flg=1
  for s,t in zip(S[i:i+lt],T):
    if s=='?' or s==t: continue
    flg=0
  if flg:break
print((S[0:i]+T+S[i+lt:ls]).replace('?','a') if flg else 'UNRESTORABLE')

Measured memory_bytes: 9040
MOD = 10 ** 9 + 7
def add(a, b):
  return (a + b) % MOD
def sub(a, b):
  return (a - b) % MOD
def mul(a, b):
  return ((a % MOD) * (b % MOD)) % MOD
def div(a, b):
  return ( (a % MOD) * (power(b, MOD)) ) % MOD
def power(a, b):
  return pow(a, b, MOD)

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
  
x, y = map(int, input().split())
N = (x + y) // 3 + 1
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % MOD )
    inverse.append( ( -inverse[MOD % i] * (MOD//i) ) % MOD )
    g2.append( (g2[-1] * inverse[-1]) % MOD )


if (x+y) % 3 != 0:
  print(0)
else:
  n = (x+y) // 3
  d = abs(x - y)
  r = (n-d) // 2
  print(cmb(n, r, MOD))


Measured memory_bytes: 82496
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        n: Chars,
    };
    let mut sum = 0_i64;
    for &n_i in n.iter() {
        let d = (n_i as usize - '0' as usize) as i64;
        sum += d;
    }
    let ans = sum % 9 == 0;
    println!("{}", if ans { "Yes" } else { "No" });
}


Measured memory_bytes: 2968
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(void){
  int N,M,tmp_p;
  string tmp_s;
  vector<int> wa;
  vector<bool> ac;
  cin >> N >> M;
  for(int i=0;i<N;i++){
    wa.push_back(0);
    ac.push_back(false);
  }
  for(int i=0;i<M;i++){
    cin >> tmp_p;
    cin >> tmp_s;
    tmp_p-=1;
    if(tmp_s == "WA" && !ac[tmp_p]){
      wa[tmp_p]++;
    }
    if(tmp_s == "AC"){
      ac[tmp_p] = true;
    }
  }
  int ac_counter=0;
  int wa_counter=0;

  for(int i=0;i<N;i++){
    if(ac[i]){
      ac_counter++;
      wa_counter+=wa[i];
    }
  }

  cout << ac_counter << " " << wa_counter << endl;

  return 0;
}


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

int main(){
  string s, t;
  int flag = 0;
  cin >> s >> t;
  if(s == t) flag = 1;
  for (int i=1; i<s.size(); i++)
    if((s.substr(i) == t.substr(0,t.size()-i)) && (s.substr(0,i)==t.substr(t.size()-i)))
       flag = 1;
   cout << (flag?"Yes":"No") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>

using namespace std;

int main () {
  int W, H, x, y;
  cin >> W >> H >> x >> y;

  double ans = double(W) * double(H) / 2;

  int flag = 0;
  if (x*2 == W && y*2 == H) flag = 1;


  cout << setprecision(10) << ans << " " << flag;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl

int main(){
  ll N;
  cin >> N;
  vector<int> A(N+1);
  ll ans = 0;
  for(int i = 1;i<=N;i++){
    if(i%15 == 0){}
    else if(i%3 == 0){}
    else if(i%5 == 0){}
    else A[i] = i;
  }
  rep(i, N+1){
    ans += A[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 7056
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int K, X;
  cin >> K >> X;
  cout << ( 500 * K >= X ? "Yes" : "No") << endl;
  return 0;
}

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

using namespace std;

int main(){
  int n,m; 
  cin >> n;
  cin >> m;
  //vector<int> a(n);
  priority_queue<int> a;
  rep(i,n) { 
     int x;
     cin >> x;
     a.push(x);
  }

  long long ans = 0;

  while(true){
    int aaa = a.top();
    int bbb = aaa / 2;
    a.pop();
    a.push(bbb);
    m--;
    if(m <= 0){
      break;
    }
  }
  while(true){
    if(!a.empty()){
      ans += a.top();
      a.pop();
    }else{
      break;
    }
  } 
  //rep(i,n) { ans += a.push;}
  cout << ans << endl;
}

Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n,q; string s;
  cin >> n >> q >> s;

  vector<int> a(n+1),c(n+1);
  rep(i,n-1){
    a[i+1] = a[i];
    c[i+2] = c[i+1];
    if(s[i]=='A'&&s[i+1]=='C'){
      a[i+1]++;
      c[i+2]++;
    }
  }
  rep(i,q){
    int l,r;
    cin >> l >> r;
    cout << c[r]-a[l-1] << endl;
  }
}


Measured memory_bytes: 1792
#include <iostream>
#include <queue>
using namespace std;
typedef long long ll;

int main(){
    ll n,sum,temp;
    priority_queue<ll,vector<ll>,greater<ll>> que;

    while(cin>>n,n){
        sum=0;
        temp=0;
        for(int i=0;i<n;i++){
            ll t;
            cin>>t;
            que.push(t);
        }

        while(que.size()>1){
            sum+=(temp+que.top());
            temp+=que.top();
            que.pop();
        }

        que.pop();

        cout<<sum<<endl;
    }

    return 0;
}

Measured memory_bytes: 1340
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
m=A[0]+sum(B)
test=A[0]+sum(B)
if N==1:
    print(m)
else:
    for i in range(1,N):
        test+=A[i]-B[i-1]
        if test>m:
            m=test
    print(m)

Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <numeric>

using namespace std;

int main(){
    int N;
    int sub;
    vector <int> s;
    int sum;
    
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> sub;
        s.push_back(sub);
    }
    
    sort(s.begin(), s.end());
    
    sum = accumulate(s.begin(), s.end(), 0);
    
    if(sum % 10 != 0){
        cout << sum << endl;
        return 0;
    }
    else{
        int x;
        bool judge = false;
        
        for(int i = 0; i < N; i++){
            x = sum;
            x -= s[i];
            
            if(x % 10 != 0){
                judge = true;
                break;
            }
        }
        
        if(judge){
            cout << x << endl;
        }
        else{
            cout << 0 << endl;
        }
    }
}

Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr int MOD_TYPE = 2;
constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

#pragma endregion

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  ll n, m;
  cin >> n >> m;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  sort(all(a));

  auto simulate = [&](ll x) {
    ll sum = 0;
    rep(i, n)
    {
      auto itr = lower_bound(all(a), x - a[i]);
      sum += distance(itr, a.end());
    }
    return sum >= m;
  };

  auto binary_search = [&]() {
    ll lo = -1, hi = LINF;
    while (hi - lo > 1)
    {
      ll mi = (lo + hi) / 2;
      if (simulate(mi))
        lo = mi;
      else
        hi = mi;
    }
    return lo;
  };

  ll t = binary_search();
  ll csum[200010];
  csum[0] = 0;
  rep(i, n) csum[i + 1] = csum[i] + a[i];
  ll ans = 0;
  ll add = 0;
  rep(i, n)
  {
    auto itr = lower_bound(all(a), t - a[i]);
    int j = distance(a.begin(), itr);
    ll cnt = distance(itr, a.end());
    ans += (csum[n] - csum[j]) + a[i] * cnt;
    add += cnt;
  }
  if (add > m)
  {
    ans -= (add - m) * t;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(void){
	int n, a, b, i, j;
	scanf("%d", &n);
	for (j = 0; j < n; j++){
		scanf("%d%d", &a, &b);
		if (a < b){
			for (i = a; i <= b; i++){
				printf("%d", i);
				if (i != b)
					printf(" ");
				else
					printf("\n");
			}
		}
		if (a > b){
			if (a <= 5){
				for (i = a; i >= b; i--){
					printf("%d", i);
					if (i != b)
						printf(" ");
					else
						printf("\n");
				}
			}
			if (a > 5 && b <= 5){
				for (i = a; i <= 9; i++){
					printf("%d ", i);
				}
				for (i = 5; i >= b; i--){
					printf("%d", i);
					if (i != b)
						printf(" ");
					else
						printf("\n");
				}
			}
			if (a  > 5 && b > 5){
				for (i = a; i <= 9; i++){
					printf("%d ", i);
				}
				for (i = 5; i >= 0; i--){
					printf("%d ", i);
				}
				for (i = 1; i <= b; i++){
					printf("%d", i);
					if (i != b)
						printf(" ");
					else
						printf("\n");
				}
			}
		}
	}
	return 0;
}

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

using namespace std;

int gcd(int x, int y)
{
    if(x < y){
        return gcd(y,x);
    }
    return (x % y == 0) ? y : gcd(y, x % y);
}

int main()
{
    int x,y;
    cin >> x >> y;
    cout << gcd(x,y) << endl;

    return 0;
}


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

int main(){
    int n, a[100];

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

    sort(a,a+n);  // 昇順でソート

    int alice = 0, bob = 0;
    for(int i=0; i<n; i++){
        if(i%2 == 0){
            alice += a[n-i-1];
        }
        else{
            bob += a[n-i-1];
        }
    }
    cout << alice - bob << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const ll LL_INF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A, B;
  cin >> A >> B;
  // A
  string ans[102];
  int h = 0, w = 100;
  B--;
  for(int c = 0;A > 1; c++){
    h++;
    if(c & 1){
      REP(i,w) ans[h - 1] += '#'; 
    }else{
      REP(i, w){
        if(i & 1 && A > 1){
          ans[h - 1] += '.';
          A--;
        }else{
          ans[h - 1] += '#';
        }
      }
    }
  }
  REP(i, w) ans[h] += '#';
  h++;
  REP(i, w) ans[h] += '.';
  h++;
  A--;
  for(int c = 0;B > 0; c++){
    h++;
    if(c & 1){
      REP(i,w) ans[h - 1] += '.'; 
    }else{
      REP(i, w){
        if(i & 1 && B > 0){
          ans[h - 1] += '#';
          B--;
        }else{
          ans[h - 1] += '.';
        }
      }
    }    
  }
  cout << h << ' ' << w << endl;
  REP(i,h){
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a[100050],f[100050],b[100050],maxn=0;

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

int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	f[0]=0,b[0]=0;
	f[1]=a[1],b[1]=a[n];
	for(int i=2;i<=n;i++)
		f[i]=gcd(f[i-1],a[i]);
	for(int i=2;i<=n;i++)
		b[i]=gcd(b[i-1],a[n-i+1]);
	for(int i=1;i<=n;i++)
	{
		int ans=gcd(b[n-i],f[i-1]);
		if(ans>maxn)
			maxn=ans;
	}
	cout<<maxn<<endl;
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18
// cout << fixed << setprecision(10);

int main() {
    int N;
    cin >> N;
    vector<int> a(N, 0);
    for (auto &x: a) cin >> x;
    int cnt = 0;
    for (size_t i=0; i<a.size(); ++i) {
        int j = i+1;
        if (j%2 != 0) {
            if (a[i]%2 != 0) {
                ++cnt;
            }
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3624
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;

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

	cin >> N >> M;
	vector<int>v(N);
	for (auto &i : v)cin >> i;
	vector<int>w(M);
	for (auto &i : w)cin >> i;
	vector<int>dp(1 << N, MOD);
	int a = 0, b = 0;
	for (int i = 0; i < M; i++) {
		for (int j = 0; j < w[i]; j++) {
			a <<= 1, b <<= 1;
			if (i & 1)a++;
			else b++;
		}
	}
	dp[a] = 0;
	dp[b] = 0;
	queue<int>Q;
	Q.push(a);
	Q.push(b);
	while (!Q.empty()) {
		int cn = Q.front();
		Q.pop();
		for (int i = 1; i < N; i++) {
			if ((cn >> i) % 2 == (cn >> (i - 1)) % 2)continue;
			int nx = cn ^ ((1 << i) | (1 << (i - 1)));
			if (dp[nx] > dp[cn] + 1) {
				dp[nx] = dp[cn] + 1;
				Q.push(nx);
			}
		}
	}
	int ans = 0;
	for (auto i : v) {
		ans <<= 1;
		ans += i;
	}
	cout << dp[ans] << endl;
}


Measured memory_bytes: 3272
#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <limits>

using namespace std;

int main (int argc, char* argv[]) {
	int n, k;
	string s;
	cin >> n >> k;
	cin >> s;

	k--;
	s[k] = tolower(s[k]);
	cout << s << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    N, X, Y = map(int, input().split())
    dic = {key: 0 for key in range(1, N)}
    for i in range(1, N+1):
        for j in range(1, N+1):
            if(i < j):
                key = min(abs(j - i), abs(X - i)+1+abs(j - Y),
                      abs(Y - i) + 1 + abs(j - X))
                dic[key] += 1
    for ans in dic.values():
        print(ans)

if __name__ == "__main__":
    main()

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;

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

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

    vector<vector<ll>> com(N + 1, vector<ll>(N + 1, 0));
    rep(i, N + 1) com[i][0] = 1;

    repd(i, 1, N + 1) {
        repd(j, 1, N + 1) {
            com[i][j] = (com[i-1][j] % MOD + com[i-1][j-1] % MOD) % MOD;
        }
    }

    rep(i, K) {
        cout << (com[N-K+1][i + 1] * com[K-1][i]) % MOD << endl;
    }
    return 0;
}

Measured memory_bytes: 31616
n = int(input())
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[n-1])

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

typedef long long int   ll;
#define int             ll
#define FIO             ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl            "\n"
#define scan(n)         scanf("%lld",&n)
#define pb              push_back
#define PI              3.1415926535897932384626433832795
#define rep0            for(int i=0;i<n;i++)
#define rep1            for(int i=1;i<=n;i++)
#define inputar0(ar)    for(int i=0;i<n;i++)cin>>ar[i]
#define inputar1(ar)    for(int i=1;i<=n;i++)cin>>ar[i]
#define showar0(ar)     for(int i=0;i<n;i++)cout<<ar[i]<<" "
#define showar1(ar)     for(int i=1;i<=n;i++)cout<<ar[i]<<" "
int mod=1000000007;
int maxn=200001;
int binpow(int a,int b,int mod){int res=1;while(b>0){if(b%2){res=(res*a)%mod;b--;}a=(a*a)%mod;b/=2;}return res%mod;}
int binpow(int a,int b){int res=1;while(b>0){if(b%2){res=(res*a);b--;}a=(a*a);b/=2;}return res;}
bool isPrime(int n){if(n==1)return false;for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}

signed main(){
    int t=1;
//    scan(t);
    while(t--){
        string s,t;cin>>s>>t;
        int cnt=0;
        for(int i=0;i<s.size();i++){
            if(s[i]!=t[i]) cnt++;
        }
        cout<<cnt<<endl;
    }
}


Measured memory_bytes: 3924
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,k,flag=0;
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<=n;i++)
	for(int j=0;j<=m;j++)
	if(i*m+j*n==k+2*i*j) flag=1;
	if(flag) printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

int main() {
  int n; cin >> n;
  int N = n;
  int sum = 0;
  while(N>0){
    sum +=  N%10;
    N/=10;
  }
  if(n%sum==0){
    cout <<"Yes" << endl;
  } else cout << "No" << endl;
    
}


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

typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define REP(i,n) for (int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
 
using namespace std;

signed main(){
    
    int a,b;
    cin >> a >> b;


    
    cout << a*b -a -b +1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <complex>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>

#define rep(i, b) for(int i = 0; i < b; i++)
#define repi(i, a, b) for(int i = a; i < b; i++)
#define all(c) c.begin(),c.end()
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define MAX_V 1001
#define MAX_E 401
#define INF INT_MAX
#define MOD 998244353
#define EPS 1e-7

typedef long long ll;
inline int toInt(std::string s) { int v; std::istringstream sin(s); sin >> v; return v; }
template<class T> inline std::string toString(T x) { std::ostringstream sout; sout << x; return sout.str(); }
using namespace std;

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
#define X real()
#define Y imag()
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template< typename T >
struct edge {
	int src, to;
	T cost;

	edge(int to, T cost) : src(-1), to(to), cost(cost) {}

	edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

	edge &operator=(const int &x) {
		to = x;
		return *this;
	}

	operator int() const { return to; }
};
template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

int main()
{
	ll D, N;
	cin >> D >> N;

	if (D == 0)
	{
		if (N == 100)
		{
			cout << 101 << endl;
		}
		else {
			cout << N << endl;
		}
	}
	else if (D == 1)
	{
		if (N == 100)
		{
			cout << 10100 << endl;
		}
		else {
			cout << N * 100 << endl;
		}
	}
	else {
		if (N == 100)
		{
			cout << N * 10000 + 10000 << endl;
		}
		else {
			cout << N * 10000 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
const long long inf=5e17;
long long k;
int n,a[maxn];
int nxt[maxn],f[maxn],last[maxn];
long long up[maxn][60];
bool vis[maxn];
/**

*/

int main(){
    scanf("%d%lld",&n,&k);
    memset(f,-1,sizeof(f));
    memset(nxt,-1,sizeof(nxt));
    memset(last,-1,sizeof(last));
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        if(f[a[i]]==-1){
            f[a[i]]=i;
        }
    }
    for(int i=n-1;i>=0;i--){
        if(last[a[i]]==-1){
            nxt[i]=f[a[i]]+(n-i)+1;
            last[a[i]]=i;
        }
        else{
            nxt[i]=last[a[i]]-i+1;
            last[a[i]]=i;
        }
    }

    ///i+nxt[a[i]]] will send to
    long long t=k*n;
    for(int i=0;i<n;++i){
        up[i][0]=nxt[i];
    }
    for(int j=1;j<=58;j++){
        for(int i=0;i<n;i++){
            int cur=((up[i][j-1]+i)%n);
            up[i][j]=up[i][j-1]+up[cur][j-1];
            if(up[i][j]>inf)up[i][j]=inf;
        }
    }
    long long sum=0;
    int cur=0;
    for(int j=58;j>=0;j--){
        if(sum+up[cur][j]<t){
            sum+=up[cur][j];
            cur=(cur+(up[cur][j]%n))%n;
        }
    }
  ///  cerr<<sum<<'\n';
    sum%=n;
  ///  cerr<<sum<<'\n';
    vector<int> st;
    for(int i=sum;i<n;i++){
        if(!vis[a[i]]){
            st.push_back(a[i]);
            vis[a[i]]=true;
            continue;
        }
        while(!st.empty()&&st.back()!=a[i]){
            vis[st.back()]=false;
            st.pop_back();
        }
        vis[a[i]]=false;
        st.pop_back();
    }
    for(int i:st){
        printf("%d ",i);
    }
}


Measured memory_bytes: 99444
/*input 
183
*/


#include <bits/stdc++.h>
using namespace std;
 

 
 
#define int long long int
#define rep(i,n) \
    for(int i = 0; i < n; i++)
#define rep2(i, a, b) \
    for(int i = a; i < b; i++)
#define all(c) \
    c.begin(), c.end()
#define init(arr, num) \
    memset(arr, num, sizeof(arr))

#define fast\
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inputFile \
    freopen("input.txt", "r", stdin); 
#define outputFile \
    freopen("output.txt", "w", stdout);
#define modM 998244353
#define PI 3.1415926535897932
#define F first
#define S second  
#define pb push_back  
 
#ifdef gaviria
#define TRACE
#endif
#ifdef TRACE
#define trace(...) _f(#VA_ARGS, __VA_ARGS_)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std::endl;
 
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int, int > ii;
typedef unordered_set<int> usi;
 
ll n,i,j,k,m,x,c;
int a, k1;



void solve() 
{cin>>n;
map <int,string> mp;
mp[0]=mp[1]=mp[6]=mp[8]="pon";
   mp[5]=mp[4]=mp[2]=mp[7]=mp[9]="hon";
    mp[3]="bon";
     cout<<mp[n%10];
} 

 
 
 
signed main()
{
 
    // inputFile;
    fast;
    int T = 1;
//cin >> T;

    while(T--){
//cout<<"Case #"<<(h-T)<<": ";
        solve();
cout<<endl;
     
        
        
 
    }
    
    
    return 0;
 
}


Measured memory_bytes: 3624
n = int(input())
a = list(map(int, input().split()))

ans = 0
cnt = 0
for i in range(n):
    if a[i] % 4 == 0:
        ans += 1
    elif a[i] % 2 == 0:
        cnt += 1
        if cnt % 2 == 0:
            ans += 1
    

if n // 2 <= ans:
    print("Yes")
else:
    print("No")

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

const int N = 10000, MOD = 1e9 + 7;
int a[N], b[N], cnt = 1, n, m;

int mul(int a, int b){
	return 1LL * a * b % MOD;
}

bool cmp(int a, int b){
	return a > b;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < m; i++)
		cin >> b[i];
		
	sort(a, a + n, cmp);
	sort(b, b + m, cmp);
	
	int cp = 0, rp = 0;
	
	for (int i = n * m; i >= 1; i--){
		if(a[cp] == i && b[rp] == i){
			cp++;
			rp++;
		}
		else if(a[cp] > i || b[rp] > i)
			return cout << 0, 0;
		else if(a[cp] == i){
			cp++;
			cnt = mul(cnt, rp);
		}
		else if(b[rp] == i){
			rp++;
			cnt = mul(cnt, cp);
		}
		else if(a[cp] < i && b[rp] < i)
			cnt = mul(cnt, rp * cp - (n * m - i));
		else
			return cout << 0, 0;
	}
	
	cout << cnt;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;i++)


int main()
{
    /*A
    vector <int> a(3);
    for(int i=0;i<3;i++)
    {
        cin>>a[i];
    }

    sort(a.rbegin(),a.rend());
    cout<<a[1]+a[2]<<endl;
    */

    /*
    int n;
    cin>>n;
    int minimum=1000010;
    vector <int> w(n);
    for(int i=0; i<n; i++)
    {
        cin>>w[i];
    }

    for(auto it = w.begin(); it != w.end(); ++it)
    {
        int sum1 = accumulate(w.begin(),it,0);
        int sum2 = accumulate(it,w.end(),0);
        minimum = min(minimum,abs(sum1-sum2));
    }

    cout<<minimum<<endl;
    */

    int n,m;
    cin>>n>>m;
    vector <int> a(n+1,1);
    for(int i=0;i<m;i++)
    {
        int x;
        cin>>x;
        a[x]=0; //壊れていたらfalse
    }

    vector <long long int> dp(n+1);

    dp[0]=1;
    for(int now=0;now<n;now++)
    {
        for(int next=now+1;next<=min(n,now+2);next++)
        {
            if(a[next])
            {   
                dp[next]+=dp[now];
                dp[next]%=MOD;
            }
        }
    }

    cout<<dp[n]<<endl;


    return 0;
}

Measured memory_bytes: 1408
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

template<class T>
bool UpdateMax(T &a, const T &b){
  if(a<b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template<class T>
bool UpdateMin(T &a, const T &b){
  if(a>b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  string t;
  cin>>t;

  for(auto& c:t){
    if(c=='?'){
      c='D';
    }
  }
  cout<<t<<endl;

  return 0;
}




Measured memory_bytes: 3752
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair
#define int         int64_t

using namespace std;

typedef pair<int, int> pii;
const int N = 5003;
const int M = 202;
const int inf = int(1e18);

int n, m, l, r, iTicket, a[N], b[M][N], f[N][N];
set<int> s;
set<int>::iterator p;
vector<int> cur;

void Update(int x) {
    iTicket = x;
    sort(cur.begin(), cur.end(), [](const int& i, const int& j) {
            return b[iTicket][i] > b[iTicket][j];
         });
    s.clear(); s.insert(0); s.insert(n + 1);
    for(int i: cur) {
        p = s.upper_bound(i);
        r = (*p); l = *(p = prev(p)) + 1;
        f[l][i] += b[iTicket][i];
        f[l][r] -= b[iTicket][i];
        f[i + 1][i] -= b[iTicket][i];
        f[i + 1][r] += b[iTicket][i];
        s.insert(i);
    }
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n >> m;
    for(int i = 2; i <= n; ++i) cin >> a[i], a[i] += a[i - 1];
    for(int i = 1; i <= n; ++i) {
        for(int j = 1; j <= m; ++j)
            cin >> b[j][i];
    }
    cur.clear(); cur.resize(n); iota(cur.begin(), cur.end(), 1);
    for(int i = 1; i <= m; ++i) Update(i);
    for(int i = 1; i <= n; ++i) {
        for(int j = 1; j <= n; ++j)
            f[i][j] += f[i][j - 1];
    }
    for(int i = 1; i <= n; ++i) {
        for(int j = 1; j <= n; ++j)
            f[i][j] += f[i - 1][j];
    } int res = 0;
    for(int i = 1; i <= n; ++i) {
        for(int j = i; j <= n; ++j) {
            res = max(res, f[i][j] - a[j] + a[i]);
        }
    }
    cout << res;
}


Measured memory_bytes: 203904
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cout << #x " = " << (x) << '\n';
#define P(x) cout << #x << '\n';    
#define int long long
typedef pair<int, int> pii;
const int mod = 1000000007;

const int maxn = 1e5 + 10;
int p[maxn];
string s[maxn];
int done[maxn];
int arr[maxn];

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(9);
	#ifdef LOCAL_DEFINE
		freopen("in.txt", "rt", stdin);
	#endif
	
	
	int n, m;
	cin >> n >> m;
	for(int i = 1; i <= m; ++ i)
	{
		cin >> p[i] >> s[i];
	}
	int cnt = 0, pen = 0;
	for(int i = 1; i <= m; ++ i)
	{
		if(done[p[i]] == 0)
		{
			if(s[i] == "AC")
			{
				++ cnt;
				pen += arr[p[i]];
				done[p[i]] = 1;
			}
			else
			{
				++ arr[p[i]];
			}
		}
	}
	cout << cnt << " " << pen << '\n';
	
	return 0;
}






Measured memory_bytes: 7936
#include <iostream>
/*文字列 
s
 の形式は [英小文字 \(5\) 文字],[英小文字 \(7\) 文字],[英小文字 \(5\) 文字] で表されます。
イルカは、カンマで区切られた文字列 
s
 を、スペースで区切られた文字列に変換したいと思っています。
イルカの代わりに、この処理を行うプログラムを作ってください。*/
using namespace std;
int main(){
	char c;
	while(cin >> c) cout << ((c == ',') ? (' ') : c);
	cout << endl;
}


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

mod = 10**9 + 7

primes = [2,3,5,7]
for i in range(8,1001):
    check = True
    for j in primes:
        if(j > i**0.5):
            break
        if(i%j == 0):
            check = False
            break
    if(check):
        # print(i)
        primes.append(i)

p_fac = {}
for i in primes:
    p_fac[i] = 0

for i in range(n):
    temp = a[i]
    for j in primes:
        count = 0
        if( temp%j == 0):
            temp = temp // j
            count += 1
            while(True):
                if(temp%j == 0):
                    temp = temp // j
                    count += 1
                else:
                    p_fac[j] = max(p_fac[j],count)
                    break
    if(temp > 1):
        primes.append(temp)
        p_fac[temp] = 1

lcm = 1
for key, value in p_fac.items():
    for i in range(value):
        lcm = lcm*key % mod

# aの逆元を求める
max = max(a)
inv = [0]*(max+1)
inv[0] = 1
inv[1] = 1
for i in range(2,max+1):
    inv[i] = inv[mod % i] * (mod - mod//i ) % mod

ans = 0
for i in range(n):
    ans += (lcm * inv[a[i]]) % mod
    ans = ans % mod

print(ans)


Measured memory_bytes: 53980
#ifdef Rahul
#include "RAHUL.h"
#else
#include <bits/stdc++.h>
using namespace std;
#define error(...) 42;
#endif
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
const int MOD = (int) 1e9 + 7;
const i64 INF = (i64) 1e18 + 42;

#include "atcoder/segtree"

int Maxx(int x, int y) {
  return max(x, y);
}
int Inf() {
  return 0;
}
int main() {
  cin.tie(nullptr) -> sync_with_stdio(false);
  
  int n, k; cin >> n >> k;
  vector<int> a(n);
  for (int &x : a) cin >> x, x += (int) 3.3e5;
  atcoder::segtree<int, Maxx, Inf> seg((int) 1e6);
  int ans = 0;
  for (int x : a) {
    int val = 1 + seg.prod(x - k, x + k + 1);
    uax(ans, val);
    seg.set(x, val);
    error(x - (int)3.3e5, val);
  }
  kek(ans);
}


Measured memory_bytes: 16396
#include <iostream>
#include <set>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int n;
    std::set<int> s;
    std::cin >> n;
    int r=0;
    for (int i = 0; i < n; i++) {
        int tmp;
        std::cin >> tmp;
        if(3200<=tmp){
            r++;
        }else{
            tmp=tmp/400;
            s.insert(tmp);
        }
    }
    int ss=s.size();
    if(ss>=1){
        std::cout << ss <<" " << ss+r<< std::endl;
    }else{
        std::cout << 1 <<" " << ss+r<< std::endl;
    }
}


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

using namespace std;

typedef long double ll;
template<typename T> bool chmax(T &a, T b) {if(a <= b){a = b; return true;}return false;}
template<typename T> bool chmin(T &a, T b) {if(a >= b){a = b; return true;}return false;}

int main(void){
    ll n;
    vector<ll> a(5);
    cin >> n >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
    sort(a.begin(), a.end());
    ll ans = ceil(n / a[0]) + 4;
    cout << fixed << setprecision(0) <<  ans << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;int n=s.size(),a=0;
  if(n==7)cout<<"YES"<<endl;
  else{
    for(int i=0;i<7;i++){
      string t=s.substr(0,i)+s.substr(n+i-7,7-i);
      if(t=="keyence"){a++;cout<<"YES"<<endl;break;}
    }
    if(a==0)cout<<"NO"<<endl;
  }
}


Measured memory_bytes: 256
//merge Sort
#include <iostream>
#define SENTINEL 2000000000
#define MAX 500000
using namespace std;

int R[MAX/2+2],L[MAX/2+2];
int cnt;

void merge(int *A, int left, int mid, int right){
	int n1 = mid - left;
	int n2 = right - mid;
	for(int i=0;i<n1;i++)
		L[i]=A[left+i];
	for(int i=0;i<n2;i++)
		R[i]=A[mid+i];
	L[n1] = R[n2] = SENTINEL;//记住要设置边界为无穷大
	int i=0, j=0;
	for(int k=left;k<right;k++){
		cnt++;
		if(L[i]<R[j])
			A[k]=L[i++];
		else
			A[k]=R[j++];
	} 
}

void mergeSort(int *A, int n, int left, int right){
	if(left+1<right){
		int mid=(left+right)/2;
		mergeSort(A, n, left, mid);
		mergeSort(A, n, mid, right);
		merge(A, left, mid, right);
	}
}

int main(){
	
	int n;
	cin>>n;
	int A[n];
	cnt=0;
	for(int i=0;i<n;i++)
		cin>>A[i];
	
	mergeSort(A, n, 0, n);
	
	for(int i=0;i<n-1;i++)
		cout<<A[i]<<" ";
	cout<<A[n-1]<<endl;
	cout<<cnt<<endl;
	
	return 0;
} 


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

using namespace __gnu_pbds;
using namespace std;


#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pii pair<int,int>
#define pf push_front
#define mp make_pair
#define vi vector<int>
#define vip vector<pair<int,int> >
#define ff first
#define ss second
#define int long long
#define mod 1000000007
#define BIG 998244353
#define s(t) scanf("%lld",&t)
#define p(t) printf("%lld\n",t)
#define mii map<int,int>
#define MSET(table,i) memset(table, i, sizeof(table))
#define endl '\n'
#define tc int t;cin>>t;while(t--)
#define pi  3.1415926358
#define bits(x) __builtin_popcount(x)
#define minimum(a,n) min_element(a,a+n)-a
#define maximum(a,n) max_element(a,a+n)-a
#define pqbig priority_queue<pii>
#define pqsmall priority_queue<pair<int,pii>,vector<pair<int,pii> >,greater<pair<int,pii> > >
#define all(v) v.begin(),v.end()
#define sitr set<int>:: iterator
#define spitr set<pii>:: iterator
#define mitr map<string,int>:: iterator

int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ) {stringstream ss; ss << number; return ss.str();}

typedef tree<pii, null_type, less<pii>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

//0 red
//1 green
//2 colourless;

int32_t main()
{
    fast;
    int x,y,a,b,c;cin>>x>>y>>a>>b>>c;
    pqbig pq;
    for(int i=0;i<a;i++)
    {
        int x;cin>>x;
        pq.push(mp(x,0ll));
    }
    for(int i=0;i<b;i++)
    {
        int x;cin>>x;
        pq.push(mp(x,1ll));
    }
    for(int i=0;i<c;i++)
    {
        int x;cin>>x;
        pq.push(mp(x,2ll));
    }

    int ans=0;
    int red=0,green=0;
    int both=0;
    while(true)
    {
        pii p=pq.top();
        pq.pop();
        if(p.ss==0)
        {
            if(red<x)
                red++,ans+=p.ff;
        }
        else if(p.ss==1)
        {
            if(green<y)
                green++,ans+=p.ff;
        }
        else
            ans+=p.ff,both++;

        if(red+green+both==x+y)
            break;
    }
    cout<<ans;
}

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int a, b;
    cin >> a >> b;
    for (int i = 1; i <= 30000; i++)
    {
        if (floor(i * 1.0 * 0.08) == a && floor(i * 1.0 * 0.1) == b)
        {
            cout << i << "\n";
            return 0;
        }
    }
    cout << -1 << "\n";
    return 0;
}

Measured memory_bytes: 256
/**
 *  @judge AtCoder
 *  @id abc163_d
 *  @name management
 *  @contest AtCoder Beginner Contest 163
 * 
 *  @tag Ad-hoc, Counting
 */
#include <bits/stdc++.h>
using namespace std;

typedef long long int LL;

LL n, k;
LL MOD = 1000000007LL;

LL solve() {
	LL x, tmp, ans = 0;
	for (x = k; x <= n + 1; x++)
		ans = (ans + x * (n - x + 1) + 1) % MOD;
	return ans;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); 
	cout.tie(nullptr);
	while (cin >> n >> k)
		cout << solve() << endl; 
}

Measured memory_bytes: 3620
#include<stdio.h>

int main(void){

    int n,i;
    int a[100];

    scanf("%d",&n);

    for(i = 0; i < n; i++){
        scanf("%d",&a[i]);
        }
    
    for(i = n -1; i > 0; i--){
        printf("%d ",a[i]);
        }

    printf("%d\n",a[0]);

    return 0;
    }

Measured memory_bytes: 596
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}}
void readA(T)(size_t n,ref T t){t=new T(n);auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(ElementType!T);r.popFront;}}
void readM(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=readln.splitter;foreach(ref v;t){v[i]=r.front.to!(ElementType!(typeof(v)));r.popFront;}}}
void readS(T)(size_t n,ref T t){t=new T(n);foreach(ref v;t){auto r=readln.splitter;foreach(ref j;v.tupleof){j=r.front.to!(typeof(j));r.popFront;}}}

void main()
{
  int n, h; readV(n, h);
  int[] a, b; readM(n, a, b);

  struct S { int t, d; }
  auto s = new S[](n*2);
  foreach (i, ai; a) s[i] = S(0, ai);
  foreach (i, bi; b) s[i+n] = S(1, bi);
  s.sort!"a.d > b.d";

  auto r = 0;
  foreach (si; s) {
    if (si.t == 0) {
      writeln(r+(h+si.d-1)/si.d);
      return;
    }
    h -= si.d;
    ++r;
    if (h <= 0) {
      writeln(r);
      return;
    }
  }
}


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

int main()
{
    int l1, l2, r1, r2;
    cin >> l1 >> l2 >> r1 >> r2;

    if ((l1 + l2) > (r1 + r2))
        cout << "Left" << endl;
    else if ((l1 + l2) < (r1 + r2))
        cout << "Right" << endl;
    else
        cout << "Balanced" << endl;
    return 0;
}


Measured memory_bytes: 3552
/*
      author : nishi5451
      created: 11.08.2020 19:52:22
*/

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


int main(){
    int a,b;
    cin >> a >> b;
    if(a&1 && b&1) cout << "Odd" <<endl;
    else cout << "Even" << endl;
    return 0;
}

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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define dbg(var) {std::cout << #var << "  = " << var << nl;}
#define vi vector<int>
typedef long long ll;

using namespace std;


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

	int n , l;
	cin >> n >> l;
	
	int a = 0;
	repi(i , n) a += l + i - 1;
	
	int d = INF;
	int ans = -1;
	repi(i , n)
	{
		int cur = a - (l + i - 1);
		if(abs(cur - a) < d)
		{
			d = abs(cur - a);
			ans = cur;
		}
	}
	
	
	die(ans);
	return 0;
}

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

 int main() {

int N;
cin >> N;
int res, kai, j;
int maxN = 0;
for(int i=1; i <=N; i++){
       j = i;
       res = 0;
       while(true){
                 bool fl = false ;
                 if( j%2==1){
                            fl = true ;
                 }
                 else{
                            j = j/2;
                            res = res + 1;
                  }
                  if(fl) break;
       }
       if(maxN <= res) {
                  maxN = res ;
                  kai = i ;
        }
}
cout << kai << endl;

}


Measured memory_bytes: 256
// ===================================
//   author: M_sea
//   website: http://m-sea-blog.com/
// ===================================
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#define re register
#define int long long
using namespace std;

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

const int N=100000+10;

int n,Q,q[N];
int w[N],ans[N];

inline void solve(int x,int v) {
    if (!x) return;
    int p=upper_bound(q+1,q+Q+1,x)-q-1;
    if (!p) ans[1]+=v,ans[x+1]-=v;
    else w[p]+=v*(x/q[p]),solve(x%q[p],v);
}

signed main() {
    n=read(); q[++Q]=n;
    for (re int i=read();i;--i) {
        int x=read();
        while (Q&&x<=q[Q]) --Q;
        q[++Q]=x;
    }
    w[Q]=1;
    for (re int i=Q;i>1;--i)
        w[i-1]+=w[i]*(q[i]/q[i-1]),solve(q[i]%q[i-1],w[i]);
    ans[1]+=w[1],ans[q[1]+1]-=w[1];
    for (re int i=2;i<=n;++i) ans[i]+=ans[i-1];
    for (re int i=1;i<=n;++i) printf("%lld\n",ans[i]);
    return 0;
}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;cin>>n;
    vector<long long>A(n);
    for(auto &i:A)
    cin>>i;
    
    vector<vector<long long>>dp(n,vector<long long>(n));
    for(auto i=0;i<n;i++)
        dp[i][i]=0;
    vector<long long>p=A;
    for(int i=1;i<n;i++)
        p[i]+=p[i-1];
    long long ans=0;
    for(int j=1;j<n;j++)
    {
        for(int i=0;i<n;i++)
        {
            int j1=i+j;
            if(j1>=n)break;
            long long mn=LONG_LONG_MAX;
            long long add=p[j1];
            if(i-1>=0)add-=p[i-1];
            for(int k=i;k<j1;k++)
            {
                mn=min(mn,dp[i][k]+dp[k+1][j1]);
            }
            dp[i][j1]=mn+add;
        }
    }
    cout<<dp[0][n-1];
}

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

int main(){
    int n, x;
    cin >> n >> x;
    int l[n];
    int p=0;
    int c=1;
    for(int i=0; i<n; i++){
        cin >> l[i];
        p+=l[i];
        if(p<=x){
            c++;
        }
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
import copy
from collections import Counter
N = int(input())
num= [int(input()) for i in range(N)]
numcopy = list(set(copy.deepcopy(num)))
numcopy.sort(reverse=True)
numcount = Counter(num)
for i in range(len(num)):
    if num[i]==numcopy[0] and numcount[num[i]]==1:
        print(numcopy[1])
    else:
        print(numcopy[0])

Measured memory_bytes: 25960
#include <stdio.h>
int main(void)
{
    int N,Y,i,j,a = 0;
    scanf("%d%d",&N,&Y);
    for(i = 0;i <= N;i++){
        for(j = 0;j + i <= N;j++)
        if((N-i-j)*1000 + i*10000 + j*5000 == Y){
            printf("%d %d %d",i,j,N-i-j);
            a = 1;
            break;
        }
        if(a == 1)break;
    }
    if(a == 0)printf("%d %d %d",-1,-1,-1);
	return 0;
}

Measured memory_bytes: 1692
sub f {
	$v[$_]||f($v[$_]=1) for grep$$a{$_},keys % {$a=$_}
}
($N,$M) = glob <>;
${$`}{$'+0}=${$'+0}{$`}=/ / for@@=<>;
print ~~ grep{
	@v=(0,$_=/ /);
	f${$`}{$'+0}=${$'+0}{$`}=0;
	${$`}{$'+0}=${$'+0}{$`}=1;
	$N>grep$_,@v
}@@


Measured memory_bytes: 896
N, M = map(int, input().split(" "))
A = list(map(int, input().split(" ")))
S = [0]
for i in range(N):
    S.append(A[i])
    S[i + 1] += S[i]

counter = {}
ans = 0
for r in range(1, N + 1):
    if (S[r - 1] % M) in counter:
        counter[S[r - 1] % M] += 1
    else:
        counter[S[r - 1] % M] = 1

    if (S[r] % M) in counter:
        ans += counter[S[r] % M]

print(ans)

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

//define ll long long;
//define ar array;

const int N = 2e5 +5;
long long pre_a[N];
long long pre_b[N];

int arr[N];

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

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

    for (int i = 0; i < n; i++){
        cin >> arr[i];
        pre_a[i+1] = pre_a[i]+arr[i];
    }

    for (int i = 0; i < m; i++){
        cin >> arr[i];
        pre_b[i+1] = pre_b[i]+arr[i];
    }

    int mx = 0;
    int cur = 0;;

    for (int i = 0; i < n+1; i++){
        if (pre_a[i] > k){
            break;
        }
        cur = i;
        //cout << cur << endl;
        long long target = k - pre_a[i];
        //cout << target << endl;
        auto it = upper_bound(pre_b, pre_b+m+1, target);
        cur += (it - pre_b)-1;
        //cout << cur << endl;
        //cout << endl;
        mx = max(mx, cur);
    }
    cout << mx << endl;
    


    return 0;
}



Measured memory_bytes: 7556