akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void){
  int a, b;
  int i, start, k, space = 0;

  scanf("%d%d", &a, &b);
  while(!(a == 0 && b == 0)){
    if(space == 1){
      printf("\n");
    }else{
      space = 1;
    }
    k = 0;
    start = a % 4;
    if(start != 0){
      start = 4 - start;
    }
    start += a;
    for(i = start; i <= b; i += 4){
      if(!(i % 100 == 0 && i % 400 != 0)){
        printf("%d\n", i);
        k = 1;
      }
    }
    if(k == 0){
      printf("NA\n");
    }
    scanf("%d%d", &a, &b);
  }
  return 0;
}

Measured memory_bytes: 1692
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define OK { cout << "OK" << endl; return 0; }
#define NG { cout << "NG" << endl; return 0; }
#define sz(v) ((int)(v).size())
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v)cout<<i<<' '; cout << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T>void out(T a){cout << a << endl;}
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

#define SIZE 200005
#define MOD 1000000007
 
typedef pair <int,int> P;
 
ll inv[SIZE], fac[SIZE], finv[SIZE];
void make(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i=2; i<SIZE; i++)
	{
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
		fac[i] = fac[i-1] * (ll) i % MOD;
		finv[i] = finv[i-1] * inv[i] % MOD;
	}
    return ;
}
ll comb(int a,int b){
	if(a < b) return 0;
	return fac[a] * (finv[b] * finv[a-b] % MOD) % MOD;
}



ll beki(int a, int n){
    if(n == 0) return 1;
    ll ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1) ans = ans * a;
    return ans;
}

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

	int X; cin >> X;
	if(X >= 1800) {cout << 1 << endl; return 0;}
	if(X >= 1600) {cout << 2 << endl; return 0;}
	if(X >= 1400) {cout << 3 << endl; return 0;}
	if(X >= 1200) {cout << 4 << endl; return 0;}
	if(X >= 1000) {cout << 5 << endl; return 0;}
	if(X >= 800) {cout << 6 << endl; return 0;}
	if(X >= 600) {cout << 7 << endl; return 0;}
	if(X >= 400) {cout << 8 << endl; return 0;}

}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define int long long
#define fill(x, v) memset(x, v, sizeof(x))
#define ios std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1)
{
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}

int n;
int c[4];
double dp[310][310][310];
double exp_ops(int i, int j, int k)
{
    if (i + j + k == 0)
        return 0.0;
    if (dp[i][j][k] > -0.5)
        return dp[i][j][k];
    double ret = 0;
    if (i)
    {
        ret += (exp_ops(i - 1, j, k) + (double)1) * (i) / (i + j + k);
    }
    if (j)
    {
        ret += (exp_ops(i + 1, j - 1, k) + (double)1) * (j) / (i + j + k);
    }
    if (k)
    {
        ret += (exp_ops(i, j + 1, k - 1) + (double)1) * (k) / (i + j + k);
    }
    ret += (double)(n - i - j - k) / (i + j + k);
    dp[i][j][k] = ret;
    return ret;
}

int32_t main()
{
    ios;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        c[x]++;
    }
    for (int i = 0; i < 310; i++)
        for (int j = 0; j < 310; j++)
            for (int k = 0; k < 310; k++)
                dp[i][j][k] = -1;
    dp[0][0][0] = 0;
    std::cout << std::setprecision(10) << exp_ops(c[1], c[2], c[3]) << '\n';
}


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

int main () {
  int N;
  cin >> N;
  vector<int> A(N), B(N+1);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  
  int n = 0;
  for (int i = 0; i < N+1; i++) {
    if (i == 0) B.at(i) = abs(A.at(i));
    else if (i == N) B.at(i) = abs(A.at(i-1));
    else B.at(i) = fabs (A.at(i) - A.at(i-1));
    n += B.at(i);
  }
  for (int i = 0; i < N; i++) {
    int ans;
    if (i == 0) ans = n - (B.at(i) + B.at(i+1)) + fabs(A.at(i+1)-0);
    else if (i == N-1) ans = n - (B.at(i) + B.at(i+1)) + fabs(0-A.at(i-1));
    else ans = n - (B.at(i) + B.at(i+1)) + fabs(A.at(i+1) - A.at(i-1));
    cout << ans << endl;
  }
}


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

void show(vector<ll>& vc)
{
    for(auto it:vc)cout<<it<<" ";
    cout<<endl;
}
#define M 10
bool p[M+2];
vector<ll>prime;
void seive(void)
{
    memset(p,0,sizeof p);
    p[1]=1;
    p[0]=1;

    for(int i=4; i<=M; i+=2)
    {
        p[i]=1;

    }

    for(ll i=3; i*i<=M; i+=2)
    {

        if(!p[i])
        {

            for(ll j=i*i; j<=M; j+=2*i)
            {
                p[j]=1;

            }
        }
    }

    prime.push_back(2);
    for(int i=3; i<=M; i+=2)prime.push_back(i);
}
ll dx[] = {-1,-1,0,-1,1,0,1,1};
ll dy[] = {-1,0,-1,1,-1,1,0,1};

typedef pair<ll, ll> pii;
#define x first
#define y second


pii extendedEuclid(ll a, ll b)   // returns x, y | ax + by = gcd(a,b)
{
    if(b == 0) return pii(1, 0);
    else
    {
        pii d = extendedEuclid(b, a % b);
        return pii(d.y, d.x - d.y * (a / b));
    }
}

ll modularInverse(ll a, ll n)
{
    pii ret = extendedEuclid(a, n);
    return ((ret.x % n) + n) % n;
}



ll n,W;
vector<ll>v,w;
ll dp[105][100005];

void solve(ll t)
{

    cin>>n>>W;
    ll V = 0;
    for(int i=0; i<n; i++)
    {
        ll a,b;
        cin>>a>>b;
        V+=b;
        w.push_back(a);
        v.push_back(b);
    }

    for(int i=0; i<=V; i++)dp[0][i]=1e18L;
    for(int i=0; i<=n; i++)dp[i][0]=1e18L;

    dp[0][0] = 0;

    for(int i=1; i<=n; i++)
    {
        for(int j=0; j<=V; j++)
        {
            if(j-v[i-1]>=0)
                dp[i][j] = min(dp[i-1][j], w[i-1] + dp[i-1][j-v[i-1]]);
            else dp[i][j] = dp[i-1][j];
        }
    }

    ll ans = 0;
    for(ll i=0; i<=n; i++)
    {
        for(ll j=0; j<=V; j++)
        {
            if(dp[i][j]<=W)
            {
                ans = max(ans,j);
            }
        }


    }

    cout<<ans<<endl;




}


int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    //seive();


    ll t=1;
    //cin>>t;
    ll T=t;



    while(t--)
    {


        solve(T-t);

    }
}


Measured memory_bytes: 80128
A, B, C, D, E, F = gets.split.map &:to_i
A *= 100
B *= 100

$dp = {}
def f(a, b)
  # p [a,b]
  $dp[[a,b]] ||= if a + b > F
    0
  elsif a/100 * E < b
    [f(a + A, b), f(a + B, b)].max
  else
    [a + b == 0 ? 0 : b.fdiv(a+b), f(a, b + C), f(a, b + D)].max
  end
end

f(A, 0)
f(B, 0)
a, b = $dp.max_by{|(a,b),v|
  a+b > F || a/100*E < b ? -1 : v
}[0]
puts"#{a+b} #{b}"


Measured memory_bytes: 2300
//  ROAD TO GREEN
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <queue>
#include <set>
#include <bitset>

#define ll long long
#define uint unsigned int
#define ull unsigned ll
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define speedhack() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define do(x) for(int i = 1; i <= x; i++){ solve(); }
#define s(x) x.size()

using namespace std;
const ll MAXN = 2e9+2;
const ll SIZE = 1e5+2;
const ll mod = 1e9+7;
int a[200];


void solve(){
	int n,m;
	cin >> n >> m;
	vector<vector<int>> v;
	for(int i = 0; i < m; i++){
		int k; cin >> k;
		vector<int> cur;
		for(int j = 0; j < k; j++){
			int x; cin >> x;
			cur.push_back(x-1);
		}
		v.push_back(cur);
	}
	int p[m];
	ll ans = 0;
	for(int i = 0; i < m; i++) cin >> p[i];
	for(int i = 0; i < (1 << n); i++){
		bool ok = true;
		for(int j = 0; j < m; j++){
			int on = 0;
			for(auto t:v[j]){
				if((1 << t) & i) on++;
			}
			if(p[j] != on%2){
				ok = false;
				break;
			}
		}
		ans += ok;
	}
	cout << ans << endl;
}

int main(){ 
	speedhack()
	// int it; cin >> it;
	int it = 1;
	do(it);
	return 0;
}


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

using namespace std;
using ll = long long;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()

#define READ(x) (cin >> (x))

#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))

#define INIT_MONEY 100
#define INTEREST 1.01

int main() {
  // get values from input
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll X;
  READ(X);

  // main procedure
  ll current_money = INIT_MONEY;
  ll year_count = 0;
 
 while (current_money < X) {
   current_money *= INTEREST;
   year_count++;
 }

  // output
 WRITE_N(year_count);

  return 0;
}


Measured memory_bytes: 3640
import collections
n,m = map(int,input().split())
p = list(map(int,input().split()))
base = 0
basemap = []
for i in range(n):
	if (i+1) == p[i]:
		base += 1
		basemap.append(i+1)

branch = dict()
for i in range(1,n+1):
	branch[i] = []

for i in range(m):
	x,y = map(int,input().split())
	branch[x].append(y)
	branch[y].append(x)
compare = [0 for i in range(n+1)]
for i in range(1,n+1):
	if branch[i] != []:
		compare[i] = 1

arrival = [0 for i in range(n+1)]
ans = []
q = []

ind = 1
while arrival != compare:
	counter = base
	while not(arrival[ind] == 0 and compare[ind] == 1):
		ind += 1
	q.append(ind)
	arrival[ind] = 1
	section = [q[0]]
	while len(q) > 0:
		next = branch[q[0]]
		for i in range(len(next)):
			if arrival[next[i]] == 0:
				section.append(next[i])
				arrival[next[i]] = 1
				q.append(next[i])
		q.pop(0)
	psec = []
	for i in range(len(section)):
		psec.append(p[section[i]-1])
	t = section + psec + basemap
	search = collections.Counter(t)
	for i in search:
		if search[i] == 2:
			 counter += 1
	ans.append(counter)
print(max(ans))

Measured memory_bytes: 51036
#include <stdio.h>
int main(void){
    // Your code here!
     int i, j, k; 
     int n, x; 
     int count; 
     while(1){ 
         scanf("%d %d ", &n, &x); 
         if(n==0&&x==0)break; 
         count=0; 
         for(i=1;3*i+3<=x;i++){ 
             for(j=i+1;i+2*j+1<=x;j++){ 
                 for(k=n;k>j;k--){ 
                     if(x==i+j+k){ 
                         count++; 
                         break; 
                     }else if(x>=i+j+k){ 
                         break; 
                     } 
                 } 
             } 
         } 
         printf("%d\n", count); 
     } 
     return 0; 
 } 



Measured memory_bytes: 2048
from sys import stdin, stdout
from collections import deque, defaultdict
import math as m

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')

def main():
	n = int(rl())
	A = list(rli())
	cnt = defaultdict(lambda: 0)
	for i, boss in enumerate(A):
		cnt[boss] += 1
	for i in range(1, n + 1):
		print(cnt[i])
	stdout.close()

if __name__ == "__main__":
	main()

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

void solve(){
    int n;
    cin >> n;
    int a[n+10];
    rep(i,n){
        cin >> a[i];
    }
    int b[n+10];
    rep(i,n){
        b[i]=0;
    }
    for(int i=n-1; i>=0; i--){
        int k=n/(i+1);
        int sum = 0;
        for(int j=1; j<=k; j++){
            sum += b[j*(i+1)-1];
        }
        if(sum%2==a[i]){
            b[i]=0;
        }
        else{
            b[i]=1;
        }
    }
    int count = 0;
    rep(i,n){
        if(b[i]==1){
            count++;
        }
    }
    cout << count << endl;
    rep(i,n){
        if(b[i]==1){
            cout << i+1 << " ";
        }
    }
    cout << endl;
}

int main(){
  solve();
  return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <iomanip>
#include <math.h>
//#include "test.h"

using namespace std;

class Town {
private:
	int m_nX;
	int m_nY;

public:
	Town(int x, int y) :m_nX(x), m_nY(y) {};

	int GetX() const { return m_nX; }
	int GetY() const { return m_nY; }

	double CalcDistance(const Town& clTown) {
		return sqrt((m_nX - clTown.GetX()) * (m_nX - clTown.GetX()) + (m_nY - clTown.GetY()) * (m_nY - clTown.GetY()));
	}
};

int main()
{
	/*
		2 <= N<=8
		-1000<=x,y<=1000
		移動距離の平均値
	*/
	int n;
	cin >> n;

	double avg_distance = 0;
	vector<Town> towns;

	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		Town town(x, y);

		for (int j = 0; j < i; j++) {
			avg_distance += town.CalcDistance(towns[j]);
		}

		towns.push_back(town);
	}

	cout << fixed << setprecision(7) << avg_distance / (n*(n - 1) / 2) *(n - 1) << endl;
	
}

Measured memory_bytes: 256
N = int(input())
D, X = map(int, input().split())
As = [int(input()) for _ in range(N)]

s = 0
for i in range(N):
    n = 1
    eat_day = 1
    eat_cnt = 0
    while eat_day <= D:
        eat_cnt += 1
        eat_day = n * As[i] + 1
        n += 1
    s += eat_cnt

print(s + X)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rnfor(i,a,b) for(ll (i) = (a) - 1; (i) >= (b); --(i))
#define ll long long
#define mod (1000000007)
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()

ll gcd(ll a,ll b){
    if(a < b)swap(a, b);
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n)t *= i;
    return t;
}

ll combinations(ll n, ll k) {
    ll r = 1;
    rep1(i, k)r = r * n-- / i;
    return r;
}

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep0(i, n)cin >> a[i];
    sort(all(a));
    ll sum =  0,ans = 1;
    rep0(i, n){
        if(sum * 2 < a[i])ans = 1;
        else ++ans;
        sum += a[i];
    }
    pf(ans);
    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        // 全部インデックスそうさする
        int a = sc.nextInt() - 1;
        int b = sc.nextInt() - 1;
        int c = sc.nextInt() - 1;
        int d = sc.nextInt() - 1;
        char map[] = new char[n + 2];
        String s = sc.next();
        sc.close();
        for (int i = 0; i < n; i++) {
            map[i] = s.charAt(i);
        }
        for (int i = a; i < c; i++) {
            char c1 = map[i];
            char c2 = map[i + 1];
            if (c1 == '#' && c2 == '#') {
                System.out.println("No");
                return;
            }
        }
        for (int i = b; i < d; i++) {
            char c1 = map[i];
            char c2 = map[i + 1];
            if (c1 == '#' && c2 == '#') {
                System.out.println("No");
                return;
            }
        }
        if (c < d) {
            System.out.println("Yes");
            return;
        }
        for (int i = b - 1; i < d; i++) {
            char c1 = map[i];
            char c2 = map[i + 1];
            char c3 = map[i + 2];
            if (c1 == '.' && c2 == '.' && c3 == '.') {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
        return;

    }
}

Measured memory_bytes: 26740
#include <bits/stdc++.h>
 #define ll long long
 using namespace std;
 const int N = 110;
 map<int,int> mp;
 int main() {
     int n, x;
 
     cin >> n;
     int MAX1 = 0, MAX2 = 0;
     for(int i = 0; i < n; i ++) {
        scanf("%d", &x);
        if(mp.count(x)) {
		            if(x > MAX1) {
               MAX2 = MAX1;
               MAX1 = x;
             } else if(x > MAX2) {
                 if(x == MAX1 && mp[x] >= 3) {
                     MAX2 = x;
                } else if(x < MAX1) MAX2 = x;
             }
         }
         mp[x] ++;
     }
     printf("%lld\n",1LL*MAX1*MAX2);
     return 0;
 }

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VI a(n);
  multiset<int> m;
  rep(i, n){
    cin >> a[i];
  }
  m.insert(a[0]);
  for(int i = 1; i < n; i++){
    auto ite = m.lower_bound(a[i]);
    if(ite == m.begin()) m.insert(a[i]);
    else{
      ite--;
      m.erase(ite);
      m.insert(a[i]);
    }
  }
  out(m.size());
  return 0;
}


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

typedef long int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(t, c) for (auto&& t : c)
#define ALL(c) begin(c), end(c)
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl '\n'
#define fk first
#define sv second

const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1}, dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, k;

  cin >> a >> b >> k;

  for (int i = a; i <= b; i++) {
    if (i < a + k || b - k < i) {
      cout << i << endl;
    }
  }
}

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

using namespace std;

int main() {
	long long k;
	string s;

	cin >> s >> k;
	int len = s.length();

	for(int i = 0; i < len; i++){
		int dif = (26 - (s[i] - 'a')) % 26; 
		if(dif <= k){
			k -= dif;
			s[i] = 'a';
		}
	}
	k = k % 26;
	int last = s[len-1] - 'a' + k;
	s[len-1] = 'a' + (char)(last % 26);

	cout << s << endl;

	return 0;
}


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

int main(){
    int N; string S;
    long long r = 0; long long g = 0; long long b = 0; 
    long long ans = 0;
    long long dif = 0;
    cin >> N >> S;
    for(int i = 0;i < N;i++){
        if(S[i] == 'R')r++;
        else if(S[i] == 'G')g++;
        else if(S[i] == 'B')b++;
    }
    ans += r * g * b;

    for(int i = 0;i < N;i++){
        for(int j = i;j < N;j++){
            if(S[i] == S[j])continue;
            int k = 2 * j - i;
            if(k >= N || S[k] == S[i] || S[k] == S[j]) continue;
            dif++;
        }
    }
    cout << ans - dif <<endl;

    return 0;
}

Measured memory_bytes: 3612
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int h[] = new int[n];
    
    for(int i = 0 ; i < n ; ++i){
      h[i] = sc.nextInt();
    }
    
    int count = 0;
    int max = 0;
    
    for(int i = 0 ; i < n ; ++i){
      if(h[i]>=max){
        count ++;
        max = h[i];
      }
    }
    System.out.println(count);

  }
}

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

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

// 連続する長さを数えてpairをvector		{1,2,1,1,3,2,2}=>{(1,1),(2,1),(1,2),(3,1),(2,2)}
vector<P> count_runlength(int* a, int* b){
	vector<P> v;
	for (int* p = a; p < b;){
		int* q = p;
		while (q < b && *p == *q) q++;
		v.push_back(P(*p, q - p));
		p = q;
	}

	return v;
}

// Combination Table
ll C[51][51]; // C[n][k] -> nCk
void comb_table(int N){
	for (int i = 0; i <= N; ++i){
		for (int j = 0; j <= i; ++j){
			if (j == 0 or j == i){
				C[i][j] = 1LL;
			}
			else{
				C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]);
			}
		}
	}
}

signed main(){

	int N, A, B;
	cin >> N >> A >> B;
	int v[51];
	rep(i, N) cin >> v[i];

	sort(v, v + N, greater<>());

	double ave = 0.0;
	rep(i, A) ave += v[i];
	ave /= A;

	cout << setprecision(20) << ave << endl;

	comb_table(N);

	// 連長を数える
	vector<P> run = count_runlength(v, v+N);

	int ans = 0;
	if (A <= run[0].second){
		for (int i = A; i <= min(B, run[0].second); i++){
			ans += C[run[0].second][i];
			cerr << C[run[0].second][i] << endl;
		}
		cout << ans << endl;
	}
	else{
		int cnt = 0;
		for (P p : run){
			cnt += p.second;
			if (cnt >= A){
				cout << C[p.second][cnt-A] << endl;
				return 0;
			}
		}
	}


	return 0;
}

Measured memory_bytes: 256
import bisect

f_inf = float("inf")
n = int(input())
A = [int(input()) for _ in range(n)][::-1]
dp = [f_inf for _ in range(n + 1)]

for a in A:
    idx = bisect.bisect_right(dp, a)
    dp[idx] = a

ans = bisect.bisect_left(dp, f_inf)
print(ans)


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

#define INF 0x3FFFFFFF

using namespace std;

vector<vector<int>> adjlist;
vector<int> dist1, dist2;
vector<bool> visited;
int between;

void bfs(int s, vector<int> &dist) {
  queue<int> q;
  q.push(s);
  dist.assign(adjlist.size(), INF);
  dist[s] = 0;
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int w : adjlist[v]) {
      if (dist[w] == INF) {
        dist[w] = dist[v] + 1;
        q.push(w);
      }
    }
  }
}

bool onConnection(int v) {
  return between == dist1[v] + dist2[v];
}

int visit(int v) {
  int res = 1;
  visited[v] = true;
  for (int w : adjlist[v]) {
    if (!visited[w]) {
      if (!onConnection(w)) {
        res += visit(w);
      }
    }
  }
  return res;
}

int main() {
  int n;
  scanf("%d", &n);
  adjlist.resize(n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    a--;
    b--;
    adjlist[a].push_back(b);
    adjlist[b].push_back(a);
  }

  bfs(0, dist1);
  bfs(n - 1, dist2);
  between = dist1[n - 1];

  int fennec = between / 2;
  int snuke = (between - 1) / 2;

  visited.assign(n, false);
  fennec += visit(0);
  snuke += visit(n - 1);

  for (int i = 0; i < n; i++) {
    if (onConnection(i) && i != 0 && i != n - 1) {
      if (dist1[i] <= between / 2) {
        fennec += visit(i) - 1;
      } else {
        snuke += visit(i) - 1;
      }
    }
  }

  if (fennec > snuke) printf("Fennec\n");
  else printf("Snuke\n");
  return 0;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define loop(i,a,b) for(ll i=a; i<b; i++)
#define revloop(i,a,b) for(ll i=a; i>=b; i--)
#define pb push_back
#define vl vector<ll>
#define vvl vector<vl>
#define pl pair<ll,ll>
#define vpl vector<pl>
#define all(c) (c).begin(), (c).end()
#define sz(a) ((a).size())
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i!=(c).end(); i++))
#define mp make_pair
#define ss second
#define ff first
#define ld long double
const ll INF = 1e13;
const ll N = 100002;
ll mod= 1000000007;
/*bool prime(ll x)
{
	if(x<2) return false;
	for(ll i=2; i*i<=x; i++) if(x%i==0) return false;
	return true;
}
vl fac(N);
void fact()
{
	fac[0]=1;
	loop(i,1,N) fac[i]=(fac[i-1]*i)%mod;
}
*/

void solve()
{
 ll n;
 cin>>n;
 ll a[n][n];
 loop(i,0,n) loop(j,0,n) cin>>a[i][j];
 vl dp(1<<n,0);
 dp[0]=1;
 loop(i,0,(1<<n)-1)
 {
 	ll x = __builtin_popcount(i);
 	loop(j,0,n)
 	{
 		if(a[x][j] && !(i&(1<<j)))
 		{
 			ll y = i|(1<<j);
 			dp[y] = (dp[y]+dp[i])%mod;
		}
	}
 }
 cout<<dp[(1<<n)-1];
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--) solve();
 return 0;
}

Measured memory_bytes: 16640
#include <bits/stdc++.h>
using namespace std;typedef long long ll;typedef vector<ll> vl;typedef vector<vl> vvl;typedef pair<ll,ll> pl;typedef vector<pl> vp;const ll INF=1001001001;const ll LINF=1001001001001001001;const ll D4[]={0,1,0,-1,0};const ll D8[]={0,1,1,0,-1,-1,1,-1,0};template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
#define fore(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()

void solve(long long N, std::vector<long long> V, std::vector<long long> C){
    ll ans=0;
    rep(i,N){
        ans+=max(0LL,V[i]-C[i]);
    }
    cout<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> V(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&V[i]);
    }
    std::vector<long long> C(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&C[i]);
    }
    solve(N, std::move(V), std::move(C));
}


Measured memory_bytes: 256
import numpy as np

b = input().split()
n = int(b[0])
k = int(b[1])
s = input()

arr = []

if int(s[0]) == 0:
    arr.append(0)

before_change = 0
for i in range(1,n):
    if int(s[i - 1]) != int(s[i]):
        arr.append(i - before_change)
        before_change = i
arr.append(n - before_change)
arr = np.array(arr)
#print(arr) 

n_add = 2 * k + 1
ans = 0

if n <= n_add:
    ans = arr.sum()
else:
    i = 0
    while i + n_add <= n:
        temp = arr[i:i+n_add].sum()
        if temp > ans:
            ans = temp
        i += 2

print(ans)






Measured memory_bytes: 14512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
#define PI pair<int,int>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
inline int rnd(int x){
	return rand()%x;
}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=100005,mod=1000000007;
int n,m,A,B,ans,fac[N<<1],ni[N<<1];
inline int ksm(ll a,int b){
	int ans=1;
	for(;b;b>>=1){
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
	}
	return ans;
}
inline int c(int a,int b){
	return (ll)fac[a]*ni[b]%mod*ni[a-b]%mod;
}
inline int qiu(int a,int b){
	return c(b+a,a);
}
int main(){
	n=read(); m=read(); A=read(); B=read();
	fac[0]=1;
	for(int i=1;i<=200000;i++)fac[i]=(ll)fac[i-1]*i%mod; ni[200000]=ksm(fac[200000],mod-2);
	for(int i=199999;i>=0;i--)ni[i]=(ll)ni[i+1]*(i+1)%mod;
	for(int i=n-A,j=B+1;i&&j<=m;i--,j++){
		//cout<<i<<" "<<j<<endl;
		ans=(ans+(ll)qiu(i-1,j-1)*qiu(n-i,m-j))%mod;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1792
n, m = map(int, input().split())
 
left  = 0
right = n
for i in range(m):
  l, r = map( int, input().split() )
  left = max( left, l )
  right = min( right, r )

ans =  right - left + 1
if ans <= 0:
  ans = 0
print( ans )

Measured memory_bytes: 43736
import java.util.*;

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

    void A(){
        int N,M;

        Scanner sc=new Scanner(System.in);

        N=sc.nextInt();
        M=sc.nextInt();

        String a=N == M ? "Yes" : "No";

        System.out.println(a);
    }
}

Measured memory_bytes: 23124
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000000
#define MAX 200001

const ll MOD = 1000000007;

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) v += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
        return is >> x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

using mint = Fp<MOD>;

int main(){
    ll N;
    cin >> N;
    ll r = 0;
    ll b = 0;
    string s;
    cin >> s;
    rep(i,N){
        if(s[i] == 'R') r++;
        else b++;
    }
    if(r > b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3568
#include<stdio.h>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>

using namespace std;

int main(){
  int n,m;cin>>n>>m;
  vector<int> a(m);
  int sum=0;
  for(int i=0;i<m;i++){
    cin>>a[i];
    sum+=a[i];
  }
  
  if(n<sum) cout<<-1;
  else cout<<n-sum;
     
  
  return 0;
}

Measured memory_bytes: 3652
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>

using namespace std;
 
#define  GODSPEED       ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(15);
#define  f              first                 
#define  s              second
#define  newl           cout<<"\n";
#define  pb             push_back  
#define  mset(a,x)      memset(a,x,sizeof(a))
#define  debv(a)        for(auto it: a)cout<<it<<" ";newl;
#define  deb1(a)        cout<<a<<"\n";
#define  deb2(a,b)      cout<<a<<" "<<b<<"\n";
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
#define  uniq(a)        a.resize(unique(a.begin(), a.end()) - a.begin());
#define  all(a)         a.begin(),a.end()           
 
typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   N     =  1e6+5;
const ll   mod   =  1e9;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;

ll test = 1, n, k, l, p[N], sz[N], ans[N], vis[N];
vll rail[N], v;

void make(ll n){
	for(int i = 1; i <= n; i++){
		p[i] = i;
		sz[i] = 1;
	}
}

int find(ll x){
	return (p[x] == x)? x: p[x] = find(p[x]);
}

void merge(ll x, ll y){
	ll a = find(x);
	ll b = find(y);
	if(a != b){
		if(sz[a] >= sz[b]) swap(a,b);
		p[a] = b;
		sz[b] += sz[a];
	}
}

void dfs(int x){
	v.pb(x);
	vis[x] = 1;
	for(auto it : rail[x]){
		if(!vis[it]) dfs(it);
	}
}

void solve(){
	cin >> n >> k >> l;
	make(n);
	for(int i = 1; i <= k; i++){
		int u, v; cin >> u >> v;
		merge(u,v);
	}
	for(int i = 1; i <= l; i++){
		int u, v; cin >> u >> v;
		rail[u].pb(v);
		rail[v].pb(u);
	}
	for(int i = 1; i <= n; i++){
		if(!vis[i]){
			v.clear();
			dfs(i);
			map <int, int> ct;
			for(auto it : v) ct[find(it)]++;
			for(auto it : v) ans[it] = ct[find(it)];
		}
		cout << ans[i] << " ";
	}
	newl;
}

int main(){
	GODSPEED;
	//cin>>test;
	for(int i = 1; i <= test; i++){
		solve();
	}
	#ifndef ONLINE_JUDGE
	cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
	#endif
}

Measured memory_bytes: 39120
import sys
def input(): return sys.stdin.readline().rstrip()
def dfs(s):
    if int(s)>n:return 0
    ret=1 if all(s.count(c)>0 for c in '753') else 0
    for c in '753':
        ret+=dfs(s+c)
    return ret
def main():
    global n
    n=int(input())
    print(dfs('0'))

if __name__=='__main__':
    main()

Measured memory_bytes: 55004
#include <stdio.h>

int main(void){
int a[3][10][4] = {0};
int i, j, k;
int n, p;
int b, f, r, v; /* b棟f階r番目の部屋にv人 [階][部屋][棟] */

scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%d%d%d%d", &b, &f, &r, &v);

a[f-1][r-1][b-1] += v;
}

for(k=0; k<4; k++){
for(i=0; i<3; i++){
for(j=0; j<10; j++){
if(a[i][j][k] == 0){
printf(" 0");
}else{
printf(" %d", a[i][j][k]);
}
}
printf("\n");
}
if(k != 3){
printf("####################\n");
}
}

return 0;
}


Measured memory_bytes: 2140
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Main {

    public static void main( final String[] args ) {

	final Scanner stdin = new Scanner( System.in );

	while ( stdin.hasNextLine() ) {

	    final String[] input = stdin.nextLine().split( "," );

	    int[] hand = new int[5];
	    for ( int i = 0; i < 5; i++ ) {
		hand[i] = Integer.parseInt( input[i] );
		if ( hand[i] == 1 ) {
		    hand[i] = 14;
		}
	    }

	    Arrays.sort( hand );
	    if ( isFourCard( hand ) ) {
		System.out.println( "four card" );
	    } else if ( isFullHouse( hand ) ) {
		System.out.println( "full house" );
	    } else if ( isStraight( hand ) ) {
		System.out.println( "straight" );
	    } else if ( isThreeCard( hand ) ) {
		System.out.println( "three card" );
	    } else if ( isTwoPair( hand ) ) {
		System.out.println( "two pair" );
	    } else if ( isOnePair( hand ) ) {
		System.out.println( "one pair" );
	    } else {
		System.out.println( "null" );
	    }
	}	
    }

    static int getDuplicateOf( int[] hands, int noOfDup ) {
	int ans = 0;
	
	int index = 0;
	while ( index < hands.length ) {
	    int no = hands[index];
	    int counter = 0;
	    while ( index < hands.length && no == hands[index] ) {
		counter++;
		index++;
	    }
	    if ( counter == noOfDup ) {
		ans++;
	    }
	}
	return ans;
    }

    static boolean isOnePair( int[] hand ) {
	return getDuplicateOf( hand, 2 ) == 1;
    }

    static boolean isTwoPair( int[] hand ) {
	return getDuplicateOf( hand, 2 ) == 2;
    }

    static boolean isThreeCard( int[] hand ) {
	return getDuplicateOf( hand, 3 ) == 1;
    }

    static boolean isFullHouse( int[] hand ) {
	return getDuplicateOf( hand, 2 ) == 1 &&
	    getDuplicateOf( hand, 3 ) == 1;
    }

    static boolean isFourCard( int[] hand ) {
	return getDuplicateOf( hand, 4 ) == 1;
    }

    static boolean isStraight( int[] hand ) {
	if ( hand[0] == 2 && hand[1] == 3 && hand[2] == 4 && hand[3] == 5 && hand[4] == 14 ) {
	    return true;
	} else if ( 2 <= hand[0] && hand[0] <= 10 ) {
	    for ( int i = 0; i < 5; i++ ) {
		if ( hand[i] != hand[0] + i ) {
		    return false;
		}
	    }
	    return true;
	} else {
	    return false;
	}	   
    }
}

Measured memory_bytes: 15348
//FIRST THINK THEN CODE.

  #include <bits/stdc++.h>


  using namespace std;

  typedef long long ll;

  #define rep(i,a,b) for(ll i=a;i<b;++i)
  #define rrep(i,a,b) for(ll i=a;i>b;--i)
  #define FOR(i,n)  for(ll i=0;i<n;i++)
  #define vi vector<int>
  #define vl vector<ll>
  #define ld long double
  #define vld vector<ld>
  #define vvi vector<vector<int>>
  #define vvl vector<vector<long long>>
  #define vvld vector<vector<ld>>
  #define pii pair<int,int>
  #define pll pair<long,long>
  #define vpii vector<pii>
  #define vpll vector<pll>
  #define ff first
  #define ss second
  #define pb push_back
  #define pf push_front
  #define mp make_pair
  #define lb lower_bound
  #define ub upper_bound
  #define bs binary_search
  #define d1(x) cout<<(x)<<endl
  #define d2(x,y) cout<<(x)<<" "<<(y)<<endl
  #define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
  #define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
  #define PI 3.1415926535897932384626433832795
  #define fix(f,n) fixed<<setprecision(n)<<f
  #define all(x) x.begin(),x.end()
  #define rev(p) reverse(p.begin(),p.end());
  #define endl "\n"
  #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  #define popcount(x) __builtin_popcountll(x)
  #define sz(x) ((ll)x.size())
  const ll M=1000000007;
  const ll MM=998244353;
  ll begtime = clock();
  #define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
  //#define _Find_next 
  //#define _Find_first 



  ll newmod(ll a,ll b)
  {
  return ((a%b)+b)%b;
  }


  ll powM(ll a,ll b,ll m )
  { 
  if(a<=0)return 0;
  a%=m;
  if(!b)return 1;
  ll ans=1LL;
  while(b)
  {
  if(b&1)ans=ans*a%m;
  a=a*a%m;
  b>>=1;
  }

  return ans;
  }



  ll poww(ll a,ll b)
  { 

  ll ans=1;
  while(b)
  {
  if(b&1)ans=ans*a;
  a=a*a;
  b>>=1;
  }

  return ans;

  }

  template<typename T,typename F>
  void chmax( T &a,F b){
  if(b>a)a=b;
  }

  template<typename T,typename F>
  void chmin( T &a,F b){
  if(b<a)a=b;
  }

string tostring(ll x){
  stringstream sss;
  sss<<x;
  string ans=sss.str();
  return ans;
}


  const ll N=1e3+5;



  int main()
  { 

ll n;cin>>n;

vl a(n);
ll c=0;
FOR(i,n)cin>>a[i],c+=a[i];
ll mn=1e18;
FOR(i,n){
  if(a[i]%10)chmin(mn,a[i]);
}

if(c%10){
  d1(c);
  return 0;
}
if(mn==1e18){
  d1(0);
  return 0;
}
ll ans=c-mn;
d1(ans);

  return 0;

  }

Measured memory_bytes: 3624
/*
 * @Author: AsilenceBTF
 * @Buff: ︿(￣︶￣)︿  芜湖塔台 起飞
 * @Date: 2019-06-20 09:22:24
 * @LastEditTime: 2020-08-30 15:07:12
 */
// #include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
using namespace std;

#define sz(x) int(x.size())
#define ALL(x) x.begin(), x.end()
#define INF 0x3f3f3f3f
typedef long long ll;

int main(){
    ios::sync_with_stdio(0), cin.tie(0);
    string s, t;
    cin >> s >> t;
    int ans = INF;
    for(int i = 0; i < sz(s); ++i){
        if(i + sz(t) > sz(s)) break;
        int sum = 0;
        for(int j = 0; j < sz(t); ++j){
            if(t[j] != s[i + j]) ++sum;
        }
        ans = min(ans, sum);
    }
    cout << ans << endl;
    // system("pause");
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
const int INF=999999999;
char a[10][10];
int main() {
int N,K;
cin>>N>>K;
set<int>k;
int d;
while(cin>>d){
 for(int i=0;i<d;i++){
     int A;
     cin>>A;
     k.insert(A);
 }
}
cout<<N-k.size()<<endl;
 return 0;}

Measured memory_bytes: 3608
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const int INF = (1LL << 60); // 1152921504606846976
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n; cin>>n;
    vector<int> a(n);
    REP(i,n) cin >> a[i];
    reverse(all(a));

    int mi=2,ma=2,nextma,nextmi,k;
    int ng=0;
    if(a[0]!=2) ng++;
    for(int i=0;i<n;i++){
        if(ma<a[i]) ng++;
        nextma=(ma/a[i]+1)*a[i]-1;
        nextmi=((mi+a[i]-1)/a[i])*a[i];
        if(nextma<mi||nextmi>ma||nextmi<mi||nextma<ma) ng++;
        mi=nextmi;
        ma=nextma;
    }

    if(ng==0) cout<<mi<<" "<<ma<<endl;
    else cout<<-1<<endl;
}

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

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

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

  vector<int> b(m);
  for(int i = 0; i < m; i++) cin >> b[i];

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

  int count = 0;
  for(int i = 0; i < n; i++) {
    int sum = c;
    for(int j = 0; j < m; j++) {
      sum += a[i][j] * b[j];
    }
    if(sum > 0) count++;
  }

  cout << count << endl;
}


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

using namespace std;

int main()
{
	int n, a[300][300], v[300][300] = {};
	long long x = 0;
	cin >> n;
	
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			cin >> a[i][j];
	
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			for (int k = 0; k < n; k++)
				if (a[j][i]+a[i][k] < a[j][k])
				{
					cout << -1;
					return 0;
				}
				
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			for (int k = 0; k < n; k++)
				if (a[j][k] == a[j][i]+a[i][k] && j != i && i != k)
					v[j][k] = v[k][j] = 1;
				
	for (int i = 0; i < n; i++)
		for (int j = i+1; j < n; j++)
			if (!v[i][j])
				x += a[i][j];
				
	cout << x;
}

Measured memory_bytes: 896
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = s_inpl()   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = inpl()	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import math
import numpy as np
import copy
from collections import defaultdict, Counter
from itertools import product
from bisect import bisect_left, bisect_right

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

N, K = s_inpl()
D = inpl()

l = set(range(0, 10))  - set(D)
c = copy.deepcopy(N)
while True:
    ls = set([int(i) for i in list(str(c))])
    if ls.issubset(l):
        print(c)
        break
    c += 1


Measured memory_bytes: 12996
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>

using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//BELOW
vector<int> fa(1000006,0),dis(1000006,0);
int find(int x)
{
  if(fa[x] == x) return x;
  int tmpfa = find(fa[x]);
  dis[x] += dis[fa[x]];
  return fa[x] = tmpfa;
}

bool add(int L,int R,int D)
{
  if(find(L) == find(R))
  {
    if(dis[L] -dis[R] != -1*D)
    {
      cout<<"No"<<endl;
      return 0;
    }
      return 1;
  }
  int faR = fa[R], faL = fa[L];
  fa[faR] = fa[faL];
  dis[faR] = dis[L] + D - dis[R];
  return 1;
}


void solve(void)
{
  int N;
  cin>>N;
  int M;
  cin>>M;
  dis = vector<int>(N+1,0);
  for (int i = 1; i < N; i++)
  {
    fa[i] = i;
  }
  
  for (int i = 0; i < M; i++)
  {
    int A,B,D;
    cin>>A>>B>>D;
    if(!add(A,B,D))
    {
      return;
    }
    // DEBUG(dis);
  }
  cout<<"Yes"<<endl;
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 16640