akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <utility>
#include <vector>

using namespace std;

typedef long long Long;
#define whole(xs) xs.begin(), xs.end()

const int N = 30;
int F[N + 1];

int X[2][2][11] = {
    {
        { 16, 1, 2, 3, 15, 28, 29, 30, 21, 20, 19 },
        { 18, 7, 8, 9, 13, 22, 23, 24, 10, 11, 12 },
    },

    {
        { 21, 1, 4, 7, 10, 24, 27, 30, 16, 17, 18 },
        { 19, 3, 6, 9, 12, 22, 25, 28, 15, 14, 13 }
    }
};

void Input() {
    F[0] = 0;
    for (int i = 1; i <= N; i++) {
        cin >> F[i];
    }
}

int Z[N + 1] = {
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 6, 6, 6, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3
};

bool Check() {
    for (int i = 1; i <= N; i++) {
        if (Z[i] != F[i]) return false;
    }
    return true;
}

bool dfs(int r) {
    if (r < 0) return false;
    if (Check()) return true;
    //cerr << r << ": "; for (int i = 1; i <= N; i++) cerr << F[i] << ' '; cerr << endl;
    for (int k = 0; k < 2; k++) {
        for (int i = 0; i < 2; i++) {
            int pF[N + 1]; for (int i = 1; i <= N; i++) pF[i] = F[i];
            swap(F[ X[k][i][0] ], F[ X[k][i][4] ]);
            for (int j = 1; j < 4; j++) {
                swap(F[ X[k][i][j] ], F[ X[k][i][j + 4] ]);
            }
            swap(F[ X[k][i][8] ], F[ X[k][i][10] ]);
            if (dfs(r - 1)) return true;
            for (int x = 1; x <= N; x++) F[x] = pF[x];
        }
    }
    return false;
}

void Solve() {
    for (int i = 0; i <= 8; i++) {
        if (dfs(i)) {
            cout << i << endl;
            return;
        }
    }
    assert(0);
}

int main() {
    int N; cin >> N;
    for (int i = 0; i < N; i++) {
        Input(); Solve();
    }
    return 0;
}

Measured memory_bytes: 1160
from scipy.sparse.csgraph import csgraph_from_dense,dijkstra,floyd_warshall
N,M,R = map(int,input().split())

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

List = [[10**6]*(N) for i in range(N)]
for i in range(M):
  a,b,c = map(int,input().split())
  
  if List[a-1][b-1] > c:
    List[a-1][b-1] = c
    List[b-1][a-1] = c
G = csgraph_from_dense(List, null_value=10**6)
d = floyd_warshall(G)

import itertools
a = list(itertools.permutations(machi))
arr = []
for i in a:
  ans = 0
  for j in range(R):
    if j != R-1 :
      ans += d[i[j]-1][i[j+1]-1]
  arr.append(ans) 
  
print(int(min(arr)))

Measured memory_bytes: 25588
ym=input()
y=ym[:2]
m=ym[2:]
ys=[str(i).zfill(2) for i in range(100)]
ms=[str(i).zfill(2) for i in range(1,13)]
if (y in ys) and (m in ms) and (y in ms) and (m in ys):
    print('AMBIGUOUS')
elif y in ms and m in ys:
    print('MMYY')
elif y in ys and m in ms:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3064
N = int(input())
s = [0]*N
l = [0]*N
for i in range(N):
    a, b = map(int, input().split())
    s[i] = (a, b)
 
for i in range(N):
    c, d = map(int, input().split())
    l[i] = (c, d)




V = N*2 # 頂点数
MAX_V = V

G = [0]*MAX_V # グラフの隣接リスト表現
for i in range(MAX_V):
    G[i] = []
match = [0]*MAX_V # マッチングのペア
used = [False]*MAX_V # DFSで既に調べたかのフラグ

# uとvを結ぶ辺をグラフに追加する
def addEdge(u, v):
    G[u].append(v)
    G[v].append(u)


##
for a in range(N):
    (rx, ry) = s[a]
    for b in range(N):
        (bx, by) = l[b]
        if rx < bx and ry < by:
            addEdge(a, b+N)


# 増加パスをDFSで探す
def dfs(v):
    used[v] = True
    for i in range(len(G[v])):
        u = G[v][i]
        w = match[u]
        if w < 0 or not used[w] and dfs(w):
            match[v] = u
            match[u] = v
            return True
    return False

# 二部グラフの最大マッチングを求める
def bipartiteMatching():
    res = 0
    for i in range(len(match)):
        match[i] = -1
    for v in range(V):
        if match[v] < 0:
            for i in range(len(used)):
                used[i] = False
            if dfs(v):
                res += 1
    return res

print(bipartiteMatching())



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

typedef long long ll;
const int N = 1e5 + 10;
int x[5];
void solve() {
    int res = 0;
    for(int i = 0; i < 5; i++) {
        cin >> x[i];
        if(x[i] == 0) res = i + 1;
    }
    cout << res << endl;
}

int main()
{
    //freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);

    int T = 1;
    //scanf("%d", &T);
    while(T--) {
        solve();
    }
}

Measured memory_bytes: 3588
N=int(input())

#return divisor list
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


table=divisor(N)
tmp=1+N
for i in table:
    tmp=min(tmp,i+N//i)

print(tmp-2)


Measured memory_bytes: 3924
import sys
input = sys.stdin.buffer.readline

def main():
    n = int(input())
    a = list(map(int, input().split()))

    a_sort = sorted(a, reverse=True)

    ans = a_sort[0]

    if (n-2) % 2 == 0:
        for i in range(int((n-2)/2)):
            ans += a_sort[i+1]*2

    else:
        for i in range((n-2)//2 + 1):
            ans += a_sort[i+1]*2
            temp = i + 1
        ans -= a_sort[temp]

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 29188
#include<bits/stdc++.h>
using namespace std;
typedef		long long       ll;
typedef         long double      dl;
typedef     unsigned long long  ull;
#define		pb              push_back
#define		PB              pop_back
#define		nn              "\n"
#define     O_O             ios_base::sync_with_stdio(false); cin.tie(NULL)
#define		all(p)          p.begin(),p.end()
#define		zz(v)           (ll)v.size()
#define		ss              ' '
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
#define         arrsize(a)      (sizeof(a)/sizeof(a[0]))
//#define       arrsize(a)      (sizeof(a)/sizeof(*a))
#define 	S(a)            scanf("%lld",&a)
#define 	SS(a,b)         scanf("%lld %lld",&a,&b)
#define 	SSS(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define		gcd(a,b)        __gcd(a,b)
#define		lcm(a,b)        (a*b)/gcd(a,b)
#define		pi              acos(-1.0)
typedef        pair <int, int>   pii;
typedef       pair <ll, ll>      pll;
typedef      vector< pair <ll, ll> >      vpll;
typedef		vector<ll>      vll;
typedef		map<string,ll>      msl;
typedef		map<ll,ll>      mll;
#define yes cout << "YES\n"
#define no cout<<"NO\n"
//memset(ar,-1,sizeof(ar));
//#define sort(x) sort(x.begin(), x.end())
//sort(a,a+n,greater<ll>())
//for (auto it = mp.begin(); it != mp.end(); ++it){}
#define MAX 1000005
#define precision(a) fixed << setprecision(a)

#define mod 1000000007

ll ar[MAX];

int main()
{
 //O_O ;
  ll n,a;cin>>n>>a;
  for(ll i=0;i<n;i++)
    cin>>ar[i];
sort(ar,ar+n);ll ans=0;
for(ll i=0;i<a;i++)
    ans+=ar[i];
cout<<ans<<nn;

    return 0;
}


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

using namespace std;

int main(){

  int N; long long A, B;
  cin >> N >> A >> B;
  
  vector <long long> X(N);
  for (int i = 0; i < N; i++) cin >> X[i];

  long long ans = 0;
  for (int i = 0; i < N - 1; i++){
    if (A * (X[i + 1] - X[i]) < B){
      ans += A * (X[i + 1] - X[i]);
    }else{
      ans += B;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const long long maxn=2500+10;
long long n,dp[maxn][maxn];
struct node
{
	long long w,id;
}a[maxn];
long long cmp(node x,node y)
{
	return x.w>y.w;
}
int main()
{
	scanf("%lld",&n);
	for(long long i=1;i<=n;i++)scanf("%lld",&a[i].w),a[i].id=i;
	sort(a+1,a+1+n,cmp);
	for(long long i=1;i<=n;i++)
	{
		for(long long j=0;j<=i-1;j++)
		{
			long long k=i-1-j;
			dp[j+1][k]=max(dp[j+1][k],dp[j][k]+a[i].w*abs(a[i].id-(j+1)));
			dp[j][k+1]=max(dp[j][k+1],dp[j][k]+a[i].w*abs(a[i].id-(n-k)));
		}
	}
	long long maxx=0;
	for(long long i=0;i<=n;i++)maxx=max(maxx,dp[i][n-i]);
	printf("%lld\n",maxx);
	return 0;
}

Measured memory_bytes: 27356
long M=1e9+7,f[444][444],u;
i,j,k,a[444],b;
main(N,C){
	for(scanf("%d%d",&N,&C);j<N;)**f=scanf("%d",a+j++);
	for(;~scanf("%d",&b);u=k=0)for(j=a[i++];k>C?u=k=0,j++<b:1;k++)f[i][k]+=u=(f[i-1][k]+u*j)%M;
	printf("%d",f[N][C]%M);
}

Measured memory_bytes: 1536
#include <iostream>

using namespace std;

constexpr int mod = 1'000'000'000 + 7;

long long power(int base, int exp) {
  if (exp == 0) return 1;
  else if (exp == 1) return base;
  else {
    long long ret = power(base, exp/2);
    ret *= ret;
    ret %= mod;
    if (exp % 2 == 1) {
      ret *= base;
      ret %= mod;
    }
    return ret;
  }
}

long long inv(int m) { // m**(mod-2)
  return power(m, mod-2);
}

long long permutation(int n, int r) { // n*(n-1)*...*(n-r+1)
  long long ret = 1;
  while (r-- > 0) {
    ret *= n--;
    ret %= mod;
  }
  return ret;
}

long long binomial(int n, int r) {
  return permutation(n, r) * inv(permutation(r, r)) % mod;
}

int main() {
  long long H, W, A, B;
  cin >> H >> W >> A >> B;
  long long prod = binomial(H+B-A-1, B)*binomial(W+A-B-1, A) % mod;
  long long total = prod;
  for (int i = 1; i < H-A && i < W-B; ++i) {
    prod *= (H-A-i)*(W-B-i) % mod;
    prod %= mod;
    prod *= inv((B+i)*(A+i) % mod);
    prod %= mod;
    total += prod;
  }
  cout << total % mod << endl;
  return 0;
}


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

template <typename T, typename E = T>
class LazySegmentTree
{
public:
    LazySegmentTree(int n, const T &tunit, const E &eunit) : _tunit(tunit), _eunit(eunit)
    {
        _n = 1 << __lg(2 * n - 1);
        _data.resize(2 * _n - 1, tunit);
        _lazy.resize(2 * _n - 1, eunit);
    }

    void set(int k, const T &x) { _data[k + _n - 1] = x; }

    void build(void)
    {
        for (int i = _n - 2; i >= 0; i--) _data[i] = f(_data[2 * i + 1], _data[2 * i + 2]);
    }

    void update(int a, int b, const E &x) { return _update(a, b, x, 0, 0, _n); }

    T query(int a, int b) { return _query(a, b, 0, 0, _n); }

private:
    int _n;             // 要素数
    vector<T> _data;    // データを格納する配列
    vector<E> _lazy;    // 遅延評価するデータを格納する配列
    T _tunit;
    E _eunit;

    T f(const T &a, const T &b) { return min(a, b); }
    T g(const T &a, const E &b) { return b; }
    E h(const E &a, const E &b) { return b; }

    void eval(int k)
    {
        if (_lazy[k] == _eunit) return;
        if (k < _n - 1) {
            _lazy[2 * k + 1] = h(_lazy[2 * k + 1], _lazy[k]);
            _lazy[2 * k + 2] = h(_lazy[2 * k + 2], _lazy[k]);
        }
        _data[k] = g(_data[k], _lazy[k]);
        _lazy[k] = _eunit;
    }

    void _update(int a, int b, const E &x, int k, int l, int r)
    {
        eval(k);
        if (a <= l && r <= b) {
            _lazy[k] = h(_lazy[k], x); eval(k);
        } else if (a < r && l < b) {
            _update(a, b, x, 2 * k + 1, l, (l + r) >> 1);
            _update(a, b, x, 2 * k + 2, (l + r) >> 1, r);
            _data[k] = f(_data[2 * k + 1], _data[2 * k + 2]);
        }
    }

    T _query(int a, int b, int k, int l, int r)
    {
        eval(k);
        if (r <= a || b <= l) {
            return _tunit;
        } else if (a <= l && r <= b) {
            return _data[k];
        } else {
            T left = _query(a, b, k * 2 + 1, l, (l + r) >> 1);
            T right = _query(a, b, 2 * k + 2, (l + r) >> 1, r);
            return f(left, right);
        }
    }
};

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

    int n, q; cin >> n >> q;
    LazySegmentTree<int> seg(n, numeric_limits<int>::max(), numeric_limits<int>::max());
    while (q--) {
        int c; cin >> c;
        if (!c) {
            int s, t, x; cin >> s >> t >> x;
            seg.update(s, t + 1, x);
        } else {
            int s, t; cin >> s >> t;
            cout << seg.query(s, t + 1) << '\n';
        }
    }
    return 0;
}



Measured memory_bytes: 4956
#include <stdio.h>
int main()
{
    int a,b,c=0;
    scanf("%d",&a);
    b=a%10;
    a=a/10;
    if(b==1){
        c=c+1;
    }
    b=a%10;
    a=a/10;
    if(b==1){
        c=c+1;
    }

    b=a%10;
    a=a/10;
    if(b==1){
        c=c+1;
    }
    printf("%d",c);

    return 0;
}


Measured memory_bytes: 128
s = input()
n = len(s)

s = s.replace("BC","X")
s += "DD"
nn = len(s)

alen = 0
ans = 0
for i in range(nn):
    if s[i] == "A":
        alen += 1
    elif s[i] == "X":
        ans += alen
    else:
        alen = 0
        
print(ans)

Measured memory_bytes: 43120
S = gets.chomp
MM = ["01","02","03","04","05","06","07","08","09","10","11","12"]
pre = MM.include?(S.slice(0..1))
suf = MM.include?(S.slice(2..3))
if pre && suf
  puts "AMBIGUOUS"
elsif !pre && suf
  puts "YYMM"
elsif pre && !suf
  puts "MMYY"
else
  puts "NA"
end

Measured memory_bytes: 1788
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int h = sc.nextInt();
    int answer = 0;
    answer = (a+b)*h/2;
    
    System.out.println(answer);
    }
}


Measured memory_bytes: 22996
//
//  main.cpp
//  ABC
//
//  Created by Amarsanaa Davaasuren on 2019/08/31.
//  Copyright © 2019 Amarsanaa Davaasuren. All rights reserved.
//

#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)

using namespace std;
using ll = long long;


int main(){
    ll N; cin >> N;
    ll M = N;
    int ans = 0;
    while(N){
        ans += N%10;
        N/=10;
    }
    ans += N;
    cout << (M%ans == 0 ? "Yes" : "No");
    return 0;
}


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

int main() {
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;

    long long ans = 0;
    if (x > y){
        ans = min({a * x + b * y, 2 * c * y + (x - y) * a, 2 * c * x});
    }
    else{
        ans = min({a * x + b * y, 2 * c * x + (y - x) * b, 2 * c * y});
    }

    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
using System;

class Program
{
  static void Main()
  {
    int a, b;
    int ans = 0;
    char op;
    string[] ary;

    while (true)
    {
      ary = Console.ReadLine().Split();

      a = int.Parse(ary[0]);
      op = ary[1][0];
      b = int.Parse(ary[2]);

      if (op == '?') break;

      switch (op)
      {
        case '+':
          ans = a + b;
          break;
        case '-':
          ans = a - b;
          break;
        case '*':
          ans = a * b;
          break;
        case '/':
          ans = a / b;
          break;
      }
      Console.WriteLine(ans);
    }
  }
}

Measured memory_bytes: 9176
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;

ll value[1000], weight[1000];
ll dp[1001][1001]; // dp[?¬?????????????][??????] = ?????§??????

int main() {
	int W;
	int c = 1;
	while ( cin >> W, W ) {
		int N; cin >> N;
		for (int i = 0; i < N; ++i) scanf("%d,%d", &value[i], &weight[i]);

		for (int i = 0; i < 1001; ++i) {
			for (int j = 0; j < 1001; ++j) {
				dp[i][j] = 0;
			}
		}
//		fill(&dp[0][0], &dp[0][0]+1501*1501, 0);

		for (int i = 0; i < N; ++i) {
			for (int w = 0; w <= W; ++w) {
				dp[i+1][w] = max(dp[i+1][w], dp[i][w]);
				if (w + weight[i] <= W) {
					dp[i+1][w+weight[i]] = max(dp[i+1][w+weight[i]], dp[i][w]+value[i]);
				}
			}
		}
		ll av = 0, aw = 0;
		for (int w = 0; w <= W; ++w) {
			if (dp[N][w] > av) {
				av = dp[N][w];
				aw = w;
			}
		}
		printf("Case %d:\n", c++);
		printf("%d\n", av);
		printf("%d\n", aw);
	}
}

Measured memory_bytes: 9072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=3e3+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

string s,t;
ll dp[MAXn][MAXn];
ll x[MAXn][MAXn];
void print_ans(ll a,ll b){
  if (a == 0 || b == 0) return;
  if (x[a][b] == 0) {
    print_ans(a-1,b-1);
    cout << s[a];
  }
  else if (x[a][b] == 1) print_ans(a-1,b);
  else print_ans(a,b-1);
}
int main(){
  IOS();
  cin >> s >> t;
  s = ' '+s;
  t = ' '+t;
  REP (i,SZ(s)+1) dp[i][0] = 0;
  REP (i,SZ(t)+1) dp[0][i] = 0;
  REP1 (i,SZ(s)-1) REP1 (j,SZ(t)-1) {
    if (s[i] == t[j]) {
      dp[i][j] = dp[i-1][j-1] + 1;
      x[i][j] = 0;
    }
    else {
      if (dp[i-1][j] > dp[i][j-1]) {
        dp[i][j] = dp[i-1][j];
        x[i][j] = 1;
      }
      else {
        dp[i][j] = dp[i][j-1];
        x[i][j] = 2;
      }
    }
  }
  debug(dp[SZ(s)-1][SZ(t)-1]);
  print_ans(SZ(s)-1,SZ(t)-1);
  cout << endl;
}


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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

#define MAX_V 105

typedef pair<int, int> P; 
bool kimari[3];
int suuji[3];

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

    REPN(kane, 1, 3000) {
        int c = (double)kane * 0.08;
        int d = (double)kane * 0.10;
        if(c == a && d == b) {
            cout << kane << endl;
            return 0;
        }
    }
    cout << "-1" << endl;

    return 0;
}


Measured memory_bytes: 256
n, s = gets.split.map(&:to_i)
a = gets.split.map(&:to_i).sort

M = 998244353
R2 = 499122177

dp = Array.new(s+1, 0)
dp[0] = 1
n.times {dp[0] = dp[0] * 2 % M}

a.each do |i|
    break if i > s
    (s-i).downto(0) {|j| dp[i+j] = (dp[i+j] + dp[j] * R2) % M}
end
p dp[s]

Measured memory_bytes: 14460
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    A, B = LI()

    print(A*B)

if __name__ == '__main__':
    resolve()

Measured memory_bytes: 9144
#include <bits/stdc++.h>
// header {{{
#define all(x) std::begin(x), std::end(x)
#define rall(x) std::rbegin(x), std::rend(x)
#define rep(i, begin, end) for (std::make_signed_t<std::remove_cv_t<decltype(end)>> i = (begin), i##_end = (end); i < i##_end; ++i)
#define repc(i, begin, last) for (std::make_signed_t<std::remove_cv_t<decltype(last)>> i = (begin), i##_last = (last); i <= i##_last; ++i)
#define repr(i, begin, last) for (std::make_signed_t<std::remove_cv_t<decltype(begin)>> i = (begin), i##_last = (last); i >= i##_last; --i)
#define let const auto
using i64 = int64_t;
using u64 = uint64_t;
constexpr int32_t INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T = int, template <class, class...> class Container = std::vector>
Container<T> read(size_t n) {
    Container<T> ret(n);
    for (auto& e : ret) std::cin >> e;
    return ret;
}

template <class Container, class = typename Container::value_type, std::enable_if_t<!std::is_same<Container, std::string>::value, std::nullptr_t> = nullptr>
std::ostream& operator<<(std::ostream& os, const Container& v) {
    for (auto it = std::begin(v); it != std::end(v); ++it) os << &" "[it == std::begin(v)] << *it;
    return os;
}

template <class T>
std::istream& operator,(std::istream& is, T& rhs) {
    return is >> rhs;
}

#define var(type, ...) \
    type __VA_ARGS__;  \
    std::cin >> __VA_ARGS__

inline void println() {
    std::cout << '\n';
}
template <class Head, class... Tail>
inline void println(Head&& head, Tail&&... tail) {
    std::cout << head << &" "[!sizeof...(tail)];
    println(std::forward<Tail>(tail)...);
}

template <class T, class U>
inline bool chmin(T& a, const U& b) {
    return b < a && (a = b, true);
}

template <class T, class U>
inline bool chmax(T& a, const U& b) {
    return b > a && (a = b, true);
}
// }}}

using namespace std;

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

    var(int, K);
    rep(i, 0, K) cout << "ACL";
    println();

    return 0;
}



Measured memory_bytes: 3600
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1  # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7


def debug(*x):
    print(*x, file=sys.stderr)


def solve(N, LS):
    # LS = list(sorted(set(LS)))
    # N = len(LS)
    LS.sort()
    ret = 0
    for i in range(N):
        for j in range(i + 1, N):
            if LS[i] == LS[j]:
                continue
            for k in range(j + 1, N):
                if LS[j] == LS[k]:
                    continue
                if LS[i] + LS[j] > LS[k]:
                    # debug(": i,j,k", i, j, k, "  ", LS[i], LS[j], LS[k])
                    ret += 1
    return ret


def main():
    # parse input
    N = int(input())
    LS = list(map(int, input().split()))
    print(solve(N, LS))


# tests
T1 = """
5
4 4 9 7 5
"""
TEST_T1 = """
>>> as_input(T1)
>>> main()
5
"""

T2 = """
6
4 5 4 3 3 5
"""
TEST_T2 = """
>>> as_input(T2)
>>> main()
8
"""

T3 = """
10
9 4 6 1 9 6 10 6 6 8
"""
TEST_T3 = """
>>> as_input(T3)
>>> main()
39
"""

T4 = """
2
1 1
"""
TEST_T4 = """
>>> as_input(T4)
>>> main()
0
"""


def _test():
    import doctest
    doctest.testmod()
    g = globals()
    for k in sorted(g):
        if k.startswith("TEST_"):
            doctest.run_docstring_examples(g[k], g)


def as_input(s):
    "use in test, use given string as input file"
    import io
    f = io.StringIO(s.strip())
    g = globals()
    g["input"] = lambda: bytes(f.readline(), "ascii")
    g["read"] = lambda: bytes(f.read(), "ascii")


input = sys.stdin.buffer.readline
read = sys.stdin.buffer.read

if sys.argv[-1] == "-t":
    print("testing")
    _test()
    sys.exit()

main()


Measured memory_bytes: 67844
#include <bits/stdc++.h>
#define int long long

using namespace std;

int b[5005][202];

int n,m;
int a[5005];
int table[5005][5005];


/*void update(int j, int k, int a) {
  k += n - 1;
  seg[j][k] = a;
  while(k > 0) {
    k = (k - 1) / 2;
    seg[j][k] = max(seg[j][k * 2 + 1],seg[j][k * 2 + 2]);
  }
}

int query(int a, int b, int j,nt k, int l, int r) {
  if(r <= a || b <= l) return 0;
  if(a <= l && r <= b) return seg[j][k];
  else {
    int vl = query(a,b,j,k*2+1,l,(l+r)/2);
    int vr = query(a,b,j,k*2+2,l,(l+r)/2);
    return max(vl,vr);
  }
  }*/


	     

void solve(int i, int l, int r) {
  int most = 0;
  int opt = 0;
  if(l == r) return;

  for(int j = l; j < r; j++) {
    if(most < b[j][i]) {
      opt = j;
      most = b[j][i];
    }
  }

  table[l][opt] += most;
  table[l][r] -= most;
  table[opt+1][opt] -= most;
  table[opt+1][r] += most;

  solve(i,l,opt);
  solve(i,opt+1,r);
}
  
signed main() {
  cin >> n >> m;
  for(int i = 2; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i-1];
    //cout << a[i] << endl;
  }
  

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

  for(int i = 0; i < m; i++) {
    solve(i,0,n);
  }
  

  for(int i = 0; i < n; i++) {
    for(int j = 1; j < n; j++) {
      table[i][j] = table[i][j] + table[i][j-1];
    }
  }

  for(int i = 0; i < n; i++) {
    for(int j = 1; j < n; j++) {
      table[j][i] = table[j][i] + table[j-1][i];
    }
  }

  int ans = 0;

  for(int i = 0; i < n; i++) {
    for(int j = i; j < n; j++) {
      ans = max(ans,table[i][j] - (a[j+1]-a[i+1]));
    }
  }

  cout << ans << endl;
      
  
}


  


Measured memory_bytes: 203904
#include <bits/stdc++.h>
using namespace std;
 
int main(){
   
string str;
cin>>str;
int n = str.length();
for(int i = 0 ; i<n ; i++){
int j = i + 1;
int k = i + 2;
if(j < n && str[i] == str[j]){
cout<<i + 1<<" "<<j+1;
return 0;
}
j = k;
if(j < n && str[i] == str[j]){
cout<<i+1<<" "<<j+1;
return 0;
}

}
 
 cout<<-1<<"  "<<-1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
}
 
 
 
 
 
 
 
 
 
 
 

Measured memory_bytes: 512
# Technique often used
# enumerate: for i, a in enumerate(a_list):
# Functional Programming: filter, map, reduce

# naming conventions
# if [s_1, s_2, s_3, ..., s_k] then I name this list sk
# if [[s_11, s_12, ..., s_1k], ..,[s_j1, s_j2, ..., s_jk] then I name this list sjk
# if something strange in list then I add _ to list's name (ex:sjk_)

# visual studio code shortcut https://qiita.com/TakahiRoyte/items/cdab6fca64da386a690b
# delete line: Ctrl+Shift+k
# choose same words: Ctrl+Shift+l

from itertools import combinations # https://docs.python.org/ja/3/library/itertools.html#itertools.combinations
from itertools import permutations # https://docs.python.org/ja/3/library/itertools.html#itertools.permutations
from collections import deque # https://docs.python.org/ja/3/library/collections.html#collections.deque
def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)
def gcds(a):
    if len(a)==1:
        return a[0]
    else:
        element = gcd(a[0], a[1])
        if len(a)==2:return(element)
        else:
            for i in range(2,n):
                element=gcd(element,a[i])
            return(element)
def debug_print(word,a,is_test=False):
    if is_test and not word:
        print("")
    elif is_test:
        print(word,a)
    else:
        pass

is_test = False
if is_test:
    n,m = [2, 2]
    smk_ = [[2, 1, 2],[1, 2]]
    pm = [0, 1]
else:        
    n,m = map(int,input().split())
    smk_ = [[int(i) for i in input().split()] for j in range(m)]
    pm = [int(i) for i in input().split()]

subsets=[]
# exclude empty set (think about it later)
for i in range(n):
    for c in combinations(range(n), i+1):
        subsets.append(c)
debug_print("subsets",subsets,is_test)

ans = 0
for subset in subsets:
    for i_m, sk_ in enumerate(smk_):
        counter = 0
        for sub in subset:
            debug_print("sub",sub,is_test)
            debug_print("sk_[1:]",sk_[1:],is_test)
            debug_print("pm[i_m]",pm[i_m],is_test)
            if sub + 1 in sk_[1:]:
                counter += 1
                debug_print("counter",counter,is_test)
            debug_print("","",is_test)
        if counter % 2 != pm[i_m]:
            debug_print("break: i_m=",i_m,is_test)
            break
    else:
        ans += 1

# think about empty set (if all switches are off)
if not(any(pm)):
    ans += 1

print(ans)

Measured memory_bytes: 3440
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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;}

using ll = long long;
using Graph = vector<vector<int>>;

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  int n;cin>>n;
  vector<int> a(n);
  double sum = 0;
  REP(i,n){
      cin >>a[i];
      sum+=a[i];
  }
  double ave = sum/(double)n;

  int ans = 0;
  double mn = INF;
  int pos = 0;
  REP(i,n){
      double dx = abs(ave-a[i]);
      if(mn>dx) {
          mn = dx;
          pos = i;
      }

  }
  cout << pos <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int64_t k;
  cin>>s>>k;
  for(int i=0;i<min((int64_t)s.size(),k);i++){
    if(s.at(i)!='1'){
      cout<<s.at(i);
      return 0;
    }
  }
  cout<<1;
}


Measured memory_bytes: 256
# -*- coding:utf-8 -*-

line = input()
line = line.split(" ")
k, s = int(line[0]), int(line[1])
counter = 0
for x in range(s // (3*k), min(s, k)+1):
    for y in range(s // (3*k), min(s, k)+1):
        if s - (x + y) < 0:
            break
        elif s - (x + y) <= k:
            counter += 1
print(counter)


Measured memory_bytes: 3060
//==========//============================================================================
// Name        : Hello5.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using p = pair<int,int>;//<key,value>


int main() {
int n,m;
cin>>n>>m;
vector<int> a(n);
rep(i,n)cin>>a[i];
rep(i,n){for (int j = i+1; j < n; ++ j) {
if(a[i]==a[j]){
	cout<<"No"<<endl;
	return 0;
}
}
}
double ans=0;
rep(i,n)
{
ans+=a[i];
}
double ans2=0;
rep(i,n)
{
if(a[i]>=ans/(4*m)){
	ans2++;}
}
if(ans2>=m){
	cout<<"Yes"<<endl;
}
else {
	cout<<"No"<<endl;
}

return 0;
}







Measured memory_bytes: 256
//char choice(char a, char b, char c){
//    int ans = 0;
//    ans ^= a == 'x' || a == 'W';
//    ans ^= b == 'x' || b == 'W';
//    ans ^= c == 'x' || c == 'W';
//    if(ans)
//        return 'W';
//    return 'S';
//}
//string _(){
//    int n;
//    cin >> n;
//    string s;
//    cin >> s;
//    rep(i,0,3){
//        string ans;
//        if(i&1) ans.pb('S');
//        else ans.pb('W');
//        if(i&2) ans.pb('S');
//        else ans.pb('W');
//        rep(i,0,n-3)
//            ans.pb(choice(ans[i],ans[i+1],s[i+1]));
//        if(choice(ans[0],ans[1],s[0]) != ans[n-1])
//            continue;
//        if(choice(ans[n-1],ans[0],s[n-1]) != ans[n-2])
//            continue;
//        return ans;
//    }
//    return "-1";
//}
#include <iomanip>
#include <vector>
#include <utility>
#include <iostream>
#include <string>
#define pb push_back
#define REP_INT(i,l,r) for(int i = l; i <= r; ++i)
#define GET_REP_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define rep(...) GET_REP_MACRO(__VA_ARGS__,REP_ANY,REP_INT)(__VA_ARGS__)
#define all(v) (v).begin(), (v).end()
#define T1 template<typename T> static
using namespace std;
T1 ostream& operator<<(ostream& stream, const vector<T>& t);
T1 istream& read(T, T, istream& = cin);
char choice(char a, char b, char c){
    int ans = 0;
    ans ^= a == 'x' || a == 'W';
    ans ^= b == 'x' || b == 'W';
    ans ^= c == 'x' || c == 'W';
    if(ans)
        return 'W';
    return 'S';
}
string _(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    rep(i,0,3){
        string ans;
        if(i&1) ans.pb('S');
        else ans.pb('W');
        if(i&2) ans.pb('S');
        else ans.pb('W');
        rep(i,0,n-3)
            ans.pb(choice(ans[i],ans[i+1],s[i+1]));
        if(choice(ans[0],ans[1],s[0]) != ans[n-1])
            continue;
        if(choice(ans[n-1],ans[0],s[n-1]) != ans[n-2])
            continue;
        return ans;
    }
    return "-1";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
        cout << _() << '\n';
}


Measured memory_bytes: 712
#include <iostream>
#include <string>
#include <sstream>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <climits>
 
using namespace std;
 
int f(const int);
 
int main()
{
    int N;
    pair<int,int> data[100];
    vector<vector<int> > vdata(100,vector<int>(100,INT_MAX));
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>data[i].first>>data[i].second;
    }
    vdata[0][0]=0;
    for(int j=1;j<N;j++){
        vdata[j][j]=0;
        for(int i=j-1;i>=0;i--){
            for(int k=i+1;k<=j;k++){
                int c=vdata[i][k-1]+vdata[k][j]+data[i].first*data[k].first*data[j].second;
                if(c<vdata[i][j]){
                    vdata[i][j]=c;
                }
            }
        }
    }
    cout<<vdata[0][N-1]<<endl;
}

Measured memory_bytes: 1256
def main():
  if 'get_ipython' in globals(): 
    ##SAMPLE INPUT
    k = 7
    s = "nikoandsolstice"

  else:
    #import sys
    #sys.setrecursionlimit(100000)
    #input=lambda :sys.stdin.readline().rstrip()

    #INF=float("inf")
    #MOD=10**9+7

    ##INPUT 
    #n = input()
    k = int(input())
    s = input()

  ##SUBMITION CODES HERE
  if len(s) <= k:
    print(s)
  else:
    print(s[:k]+"...")
    
main()

Measured memory_bytes: 9120
/* ex6_2
   kento_titech*/
#include<stdio.h>
#include<string.h>
#define SIZE 101
int main(void){
    int del_num,len;
    char strings[SIZE],ans[SIZE];//最大100文字入る文字列配列
    scanf("%s",strings);
    len=strlen(strings);//文字列の長さをstrlen()で調べる
    del_num=strlen(strings)-2;//削除する文字数
    sprintf(ans,"%c%d%c",strings[0],del_num,strings[len-1]);//結合して文字列にする
    printf("%s\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <iostream>
using namespace std;
char s[20];
int main(){
	while(cin>>s+1){
		int ans = 0;
		int n = strlen(s+1);
		for(int i = 1; i < n; i++){
			ans += 9;
		}
		bool flag = false;
		bool cnt = false;
		for(int i = 1; i <= n; i++) if(s[i] != '9') flag = true;
		for(int i = 2; i <= n; i++) if(s[i] != '9') cnt = true;
		if(n == 1) cout<<s[1]-'0'<<endl;
		else if(n != 1 && !flag) cout<<ans+9<<endl;
		else if(!cnt) cout<<ans+s[1]-'0'<<endl;
		else cout<<ans-1+s[1]-'0'<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define ld long double
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n; cin >>n;
    vp a(n);
    rep(i,n){
        cin >> a[i].F;
        a[i].S=i+1;
    }    
    sort(all(a));
    rep(i,n) cout<<a[i].S<<' '; cout<<endl;
}

Measured memory_bytes: 2432
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
war_flag = True

for z in list(range(X+1, Y+1)):
    if max(x) < z and min(y) >= z:
        war_flag = False
        break

if war_flag:
    print('War')
else:
    print('No War')

Measured memory_bytes: 9032
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
#include<unordered_map>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define pp1(...) "\033[1;47;35m" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg(x) debug() << pp1(x)
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define int long long
#define all(x) x.begin() , x.end()
#define clr(x) memset(x , 0 , sizeof x);
#define sz(x) (int)x.size()
template<typename T> void db(T x ){ debug() <<">>> " <<  x; }
template<typename T> void db(T x , T y){ debug() <<">>> " <<  x <<" , "<< y; }
template<typename T> void db(T x , T y , T z){ debug() <<">>> "<< x <<" , "<< y <<" , "<< z; }
template<typename T> void db(T x , T y , T z , T a){ debug() <<">>> "<< x <<" , " << y <<" , "<< z <<" , "<< a; }
const int xx = 5e5 + 10;
const int Mod = 1e9 + 7;
const int inf = 1e18;
const int Maxn = 20010;

int BIT[xx][30];

void update(int n , int id , int pos , int delta) {
  while(id <= n) {
    BIT[id][pos] += delta;
    id += (id & -id);
  }
}
int query(int id , int pos) {
  int sum = 0;
  while(id > 0) {
    sum += BIT[id][pos];
    id -= (id & -id);
  }
  return sum;
}

int getdis(int l , int r) {
  int ans = 0;
  for(int i = 0; i < 26; i++) {
    ans += (query(r , i) - query(l-1 , i) ) > 0;
  }
  return ans;
}
signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
 int Q;
 cin >> Q;
  for(int i = 0; i < n; i++) {
    update(n , i + 1, s[i] - 'a', 1);
  }
  while(Q--) {
    int typ;
    db("---------------");
    dg1(s);
    cin >> typ;
    if(typ == 1) {
      int id ;
      char ch;
      cin >> id >> ch;
      update(n , id , s[id-1] - 'a' , -1);
      update(n , id , ch - 'a', 1);
      s[id - 1] = ch;
    }
    else {
      int l , r;
      cin >> l >> r;
      int res = getdis(l , r);
      cout << res << '\n';
    }
    dg1(s);
  }
}

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

using namespace std;

int main() {
    string s;
    int cnt = 0;
    
    cin >> s;
    
    if(s[0] == '1') ++cnt;
    
    if(s[1] == '1') ++cnt;
    
    if(s[2] == '1') ++cnt;

    cout << cnt << endl;

}

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

int main() {
	int k, s, cnt = 0;
	cin >> k >> s;
	for (int a = 0; a <= k; a++) {
		for (int b = 0; b <= k; b++) {
			int c = s - a - b;
			if (0 <= c && c <= k)cnt++;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, cnt = 0;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n;i++){
    cin >> a[i];
    if((i+1)%2!=0&&a[i]%2!=0){
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
 
 
 
int main()
{	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
    	int n;cin>>n;
    char s[n];
    int k;cin>>k;
    cin>>s;
    s[k-1] = s[k-1] + 32;
    cout<<s;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    dp = [n] * 200000
    dp[0] = 0
    
    for i in range(n):
        p6 = 1
        while True:
            if i + p6 > n:
                break
            dp[i + p6] = min(dp[i + p6], dp[i] + 1)
            p6 *= 6
        p9 = 1
        while True:
            if i + p9 > n:
                break
            dp[i + p9] = min(dp[i + p9], dp[i] + 1)
            p9 *= 9
    print(dp[n])


if __name__ == "__main__":
    main()


Measured memory_bytes: 41584
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ll n;
	cin>>n;
	ll arr[n];
	int cnt[1000002]={0};
	bool vis[1000002]={0};
	for(int i=0;i<n;i++) {
		cin>>arr[i];
		cnt[arr[i]]++;
		if(vis[arr[i]]==0&&cnt[arr[i]]==1){
		for(int j=2*arr[i];j<=1000000;j+=arr[i]){
			vis[j]=1;
		}
		}
	}
	ll ans=0;
	for(int i=0;i<n;i++){
		if(vis[arr[i]]==0&&cnt[arr[i]]==1){
			ans++;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 10076
import math
List=[int(input()) for i in range(5)]
t = 0
min_q = 99
for i in range(5):
  q = List[i]%10
  t += math.ceil(List[i]/10)*10
#  print(t,q)
  if q >0:
    min_q = min(min_q, q)
if min_q != 99:
  t -= 10 - min_q
print(t)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

bool judge(string s){
    if(s.length()%2 != 0) return false;
    for (ll i=0;i<s.length();i++){
        if(i%2 == 0){
            if(s[i] != 'h') return false;
        }else{
            if(s[i] != 'i') return false;
        }
    }
    return true;
}

int main() {
    
    string s;
    cin >> s;
    cout << (judge(s)?"Yes":"No") << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=2e5+5;
ll n,a[N],sum[N],diff[N];
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n;
    for(ll i=1;i<=n;i++)cin>>a[i];
    for(ll i=1;i<=n;i++)sum[i]=a[i]+i;
    for(ll i=1;i<=n;i++)diff[i]=i-a[i];
    ll ans = 0;
    map<ll,ll> mp;
    for(ll i=n;i>=1;i--){
        ans+=mp[sum[i]];
        mp[diff[i]]++;
    }
    cout<<ans;
}


Measured memory_bytes: 30932
mod = 998244353
n, s = map(int, input().split())
A = list(map(int, input().split()))

dp = [[0]*(3001) for _ in range(n+1)]

dp[0][0] = 1

for i in range(n):
    for j in range(s+1):
        dp[i+1][j] = 2*dp[i][j] % mod
        if j-A[i] >= 0:
            dp[i+1][j] = (dp[i+1][j]+dp[i][j-A[i]]) % mod

print(dp[n][s])


Measured memory_bytes: 132800
N, K = map(int, input().split())
D = N + 1

d = [[0] * (1 << N) for _ in range(D)]
f = [[0] * (1 << N) for _ in range(D)]

for i in range(D):
    for j, c in enumerate(input()):
        if c == '1':
            d[i][j] = 1

for i in range(1, D):
    for j in range(1 << i):
        t = (j >> (i - 1)) & 1
        r = 0
        while r < i and ((j >> (i - 1 - r)) & 1) == t:
            r += 1
        f[i][j] = r

for i in range(D):
    for ii in range(i + 1, D):
        z = ii - i
        mask = (1 << z) - 1
        for j in range(1 << ii):
            d[i][j >> z] += d[ii][j]
            r = f[z][j & mask]
            if r != z:
                d[ii - r][((j >> z) << (z - r)) | (j & ((1 << (z - r)) - 1))] += d[ii][j]
    for j in range(1 << i):
        if d[i][j] >= K:
            I = i
            J = j
            break

print('' if I == J == 0 else bin(J)[2:].zfill(I))


Measured memory_bytes: 403592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
std::vector<ll> vec;
int n;

int main() {
    cin >> n;
    vec.push_back(2);
    vec.push_back(1);
    for (ll i = 2; i <= 86; i++) {
        vec.push_back(vec[i-1] + vec[i-2]);
    }
    std::cout << vec[n] << std::endl;
}

Measured memory_bytes: 256