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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  int N, K; cin >> N >> K;
  ll a[N]; rep(i,N) cin >> a[i];
  ll dp[N+1][K+1] = {}; dp[0][0] = 1;
  rep(i,N) rep(j,K+1) {
    if (j==0) dp[i+1][j] = dp[i][j];
    else if (j<=a[i]) dp[i+1][j] = (dp[i+1][j-1] + dp[i][j])%MOD;
    else dp[i+1][j] = ((dp[i+1][j-1] + dp[i][j] - dp[i][j-a[i]-1])%MOD+MOD)%MOD;
  }
  // rep(i,N+1) debug(dp[i],dp[i]+(K+1));

  ll result = dp[N][K];
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 79104
package main

import "fmt"

func main(){
	var (
		time int
		h int
		m int
		s int
	)
	fmt.Scan(&time)
	h = time / 3600
	m = (time % 3600) / 60
	s = time % 60
	fmt.Print(h)
	fmt.Print(":")
	fmt.Print(m)
	fmt.Print(":")
	fmt.Println(s)
}


Measured memory_bytes: 1160
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
  string s, t; cin >> s >> t;
  int res = 0;
  rep(i, s.size()){
    if(s[i] != t[i])res++;
  }
  cout << res << ln;
}


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

const ll mod = 1e9 + 7;

vector<ll> fac(300001); //n!(mod mod)
vector<ll> ifac(300001); //k!^{M-2} (mod mod)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod mod) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % mod;
        x = x*x % mod;
        n = n >> 1;
    }
    return ans;
}
ll comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % mod;
    return tmp * fac[a] % mod;
}

int main() {
    int N, K; cin >> N >> K;
    vector<ll> A(N);
    rep(i, N){
        cin >> A[i];
    }
    sort(A.begin(), A.end());

    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<300000; i++){
        fac[i+1] = fac[i]*(i+1) % mod; // n!(mod mod)
        ifac[i+1] = ifac[i]*mpow(i+1, mod-2) % mod; // k!^{mod-2} (mod mod) ←累乗にmpowを採用
    }

    ll ma = 0;
    for (int i = K-1; i < N; i++){
        ll com = comb(i, K-1);
        ma += A[i] * com;
        ma %= mod;
    }

    ll mi = 0;
    for (int i = N-K; i >= 0; i--){
        ll com = comb(N - i - 1, K-1);
        mi += A[i] * com;
        mi %= mod;
    }

    ll ans = ma - mi;
    if(ans < 0)ans += mod;
    ans %= mod;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 8720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


int main(){
    ll n;
    cin >> n;

    if(n==0){
        cout << 0 << endl;
        return 0;
    }
    if(n%2==1){
        cout << 0 << endl;
        return 0;
    }
    ll ans = 0;
    ll div = 10;
    vector<ll> a;
    while(div <= n){
        a.push_back(div);
        div *= 5;
    }
    for(int i = 0; i < a.size(); i++){
        ans += n/a[i];
    }
    cout << ans << endl;

    return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

vector< vs32 > g1, g2;
vector< bool > reached1, reached2;

void dfs(vector< vs32 >& g, vector< bool >& reached, int u)
{
  reached[u] = true;
  for (auto v : g[u])
  {
    if (!reached[v]) dfs(g, reached, v);
  }
}

struct edge
{
  int from, to;
  s64 cost;
};

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

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

  vector< edge > e(m);
  reached1.resize(n, false);
  g1.resize(n);
  reached2.resize(n, false);
  g2.resize(n);
  rep (i, m)
  {
    int u, v;
    s64 c;
    cin >> u >> v >> c;
    --u, --v;
    e[i].from = u;
    e[i].to = v;
    e[i].cost = -(c - p);
    g1[u].push_back(v);
    g2[v].push_back(u);
  }

  dfs(g1, reached1, 0);
  dfs(g2, reached2, n - 1);
  
  const s64 inf = 1e18;
  s64 d[n];
  rep (i, n) d[i] = inf;
  d[0] = 0;

  rep (i, n)
  {
    bool update = false;
    rep (j, m)
    {
      int from = e[j].from;
      int to = e[j].to;
      s64 cost = e[j].cost;
      if (reached1[from] && reached2[to] && d[to] > d[from] + cost)
      {
        d[to] = d[from] + cost;
        update = true;
      }
    }
    if (i == n - 1 && update)
    {
      cout << "-1\n";
      return 0;
    }
  }
  
  cout << (-d[n - 1] < 0 ? 0 : -d[n - 1]) << "\n";
  return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int X,A,B;
  cin>>X>>A>>B;
  P((X-A)%B);
  return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def main():
    s = S()
    l_min = 0
    l = 0
    ans = [0] * len(s)
    while l + 1 < len(s):
        r = l + 1
        if s[l] == 'R' and s[r] == 'L':
            r_max = r
            while s[r_max] == 'L':
                r_max += 1
                if r_max >= len(s):
                    break
            ans[l] = (l - l_min) // 2 + (r_max - 1- l) // 2 + 1
            ans[r] = r_max - l_min - ans[l]
            l_min = l = r_max
        else:
            l += 1
    for a in ans:
        print(a, end=' ')
    print()
main()



Measured memory_bytes: 77012
#include <bits/stdc++.h>
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using ll = long long;
const int INF = 0x3f3f3f3f;
using namespace std;

int n, m, dp[1001][1001], M = 1e9+7;
int dx[] = {0, 1}, dy[] = {1, 0};
char arr[1001][1001];
//pair<int, string> dp[3002][3002];

int solve(int i = 0, int j = 0) {
    if (i == n-1 && j == m-1) {
        return 1;
    }
    if (i >= n || j >= m || arr[i][j]=='#') {
        return 0;
    }
    int& ret = dp[i][j];
    if (~ret) {
        return ret;
    }
    ret = solve(i+1, j) + solve(i, j+1);
    if (ret >= M) {
        ret -= M;
    }
    return ret;
}
int main()
{
    IOS
    //memset(dp, -1, sizeof dp);
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if (i==0 && j==0) {
                dp[i][j] = 1;
            } else if (arr[i][j]=='.') {
                if (i-1 >= 0) {
                    dp[i][j] += dp[i-1][j];
                }
                if (j-1 >= 0) {
                    dp[i][j] += dp[i][j-1];
                }
                if (dp[i][j] >= M) {
                    dp[i][j] -= M;
                }
            }
        }
    }
    cout << dp[n-1][m-1] << endl;


    return 0;
}


Measured memory_bytes: 5120
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();


        int n = sc.nextInt();
        int k = sc.nextInt();

        int cnt = 0;
        for (int i = 0; i < n; i++) {
            int h = sc.nextInt();
            if (h >= k)
                cnt++;
        }

        System.out.println(cnt);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

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

int main()
{
	int a , b ;
	
	cin>>a>>b;
	int temp = (a+b)/2;
	
	float t = (a+b)/2.00;
	
	if( t-temp >0.4 )
		cout<<temp+1<<endl;
	else
		cout<<temp<<endl;
		
	return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = sorted(tuple(map(int, readline().split())), reverse=True)
cnt = 0
for i in range(n):
    cnt += a[i * 2 + 1]
print(cnt)


Measured memory_bytes: 31836
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//
int main(){
    ll n,m; cin>>n>>m;
    vector<pair<ll,ll>> price;
    rep(i,0,n){
        ll a,b;
        cin>>a>>b;
        price.push_back(make_pair(a,b));
    }
    sort(all(price));
    ll sum=0;
    ll bottles=0;
    rep(i,0,n){
        rep(j,0,price[i].second){
            sum+=price[i].first;
            bottles++;
            if(bottles==m) break;
        }
        if(bottles==m) break;
    }
    cout<<sum<<endl;

}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main() {
    string s;
    cin>>s;
    int n=s.length(),flag=0,i;
    //cout<<n<<endl;
    if(n%2==0)
        n=n-2;
    else
        n=n-1;
    //cout<<n<<endl;
    while(1) {
        for (i = 0; i < n/2; i++) {
             if(s[i]!=s[n/2+i]) {
                 //if(n==6) {
                //     cout << s[i] << endl;
                //     cout << s[n / 2 + (i)] << endl;
                // }
                     flag = 1;
                     break;
             }
        }
        if(flag==0) {
            cout<<n<<endl;
            break;
        }
        else {
            flag=0;
            n = n - 2;
        }
       // cout<<n<<endl;
    }
    return 0;
    }


Measured memory_bytes: 3612
#include<iostream>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    bool ok=false;
    if(a%3==0||b%3==0||(a+b)%3==0)ok=true;
    if(ok)cout<<"Possible"<<endl;
    else cout<<"Impossible"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define X first
#define Y second
const ll maxn = 2e5 + 20;
int main()
{
    string a , b , c;
    cin >> a >> b >> c;
    if(a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0])
        cout << "YES";
    else
        cout << "NO";
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var (
		n, q int
		s    string
	)
	fmt.Scan(&n, &q, &s)

	solve(s, q)
}

func solve(s string, q int) {
	sliceCumsum := make([]int, len(s)+1) // 累積和

	cumsum := 0
	for i := 2; i < len(sliceCumsum); i++ {
		if s[i-2] == 'A' {
			if s[i-1] == 'C' {
				cumsum++
			}
		}
		sliceCumsum[i] = cumsum
	}

	var l, r int
	for i := 0; i < q; i++ {
		fmt.Scan(&l, &r)
		countAC := sliceCumsum[r] - sliceCumsum[l]
		fmt.Println(countAC)
	}
}


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

#define fi first
#define se second
#define show(x) cerr << #x << "=" << "\n"
typedef long long ll;
typedef unsigned long long ull;

using namespace std;
const ll llinf = LLONG_MAX;
const ull ullinf = ULLONG_MAX;

string s;
int n;
ll dp[100001][3];
const ll MOD = 1000000007;

ll pow(int a, int b) {
  if (b < 0) return 0;
  ll res = 1;
  ll now = a;
  while (b != 0) {
    if (b & 1) {
      res = ((res % MOD) * (now % MOD)) % MOD;
    }
    now = ((now % MOD) * (now % MOD)) % MOD;
    b >>= 1;
  }
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1 = freopen("in.txt", "r", stdin);
  //stream2 = freopen("out.txt", "w", stdout);
  if (stream1 == NULL) return 0;
  //if (stream2 == NULL) return 0;
#endif
  cin >> s;
  n = (int)s.size();
  int Q = 0;
  int A = 0;
  if (s[0] == 'A' || s[0] == '?') {
    dp[0][0] = 1;
    if (s[0] == '?') Q = 1;
    else A = 1;
  }
  for (int i = 1; i < n; i++) {
    if (s[i] == '?') {
      ll temp = (pow(3, Q) * (Q + 1)) % MOD;
      ll temp2 = (pow(3, Q + 1) * A) % MOD;
      dp[i][0] = (temp + temp2) % MOD;
      Q++;
      dp[i][1] = (dp[i - 1][0] + ((dp[i - 1][1] % MOD) * 3) % MOD) % MOD;
      dp[i][2] = (dp[i - 1][1] + ((dp[i - 1][2] % MOD) * 3) % MOD) % MOD;
    } else if (s[i] == 'A') {
      A++;
      ll temp2 = (pow(3, Q) * A) % MOD;
      ll temp = (pow(3, Q - 1) * Q) % MOD;
      dp[i][0] = (temp + temp2) % MOD;
      dp[i][1] = dp[i - 1][1];
      dp[i][2] = dp[i - 1][2];
    } else if (s[i] == 'B') {
      dp[i][0] = dp[i - 1][0];
      dp[i][1] = (dp[i - 1][0] + dp[i - 1][1]) % MOD;
      dp[i][2] = dp[i - 1][2];
    } else if (s[i] == 'C') {
      dp[i][0] = dp[i - 1][0];
      dp[i][1] = dp[i - 1][1];
      dp[i][2] = (dp[i - 1][1] + dp[i - 1][2]) % MOD;
    }
  }
  cout << dp[n - 1][2] << endl;
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;

template<int MAX_V>
class dinic{
    struct edge{
        int to;
        uint64_t cap;
        int rev;
    };
    vector<edge> edges[MAX_V];
    int level[MAX_V];
    int next[MAX_V];

    void set_level(int s){
        memset(level, -1, sizeof(level));
        queue<int> Q;
        level[s] = 0;
        Q.push(s);
        while(!Q.empty()){
            int v = Q.front();
            Q.pop();
            for(edge e:edges[v]){
                if(e.cap > 0 && level[e.to] < 0){
                    level[e.to] = level[v] + 1;
                    Q.push(e.to);
                }
            }
        }
    }

    uint64_t blockingflow(int v, int t, uint64_t f){
        if(v == t) return f;
        for(int &i = next[v];i<edges[v].size();i++){
            edge &e = edges[v][i];
            if(e.cap > 0 && level[v] < level[e.to]){
                uint64_t d = blockingflow(e.to, t, min(f, e.cap));
                if(d > 0){
                    e.cap -= d;
                    edges[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }
public:
    void add_edge(int from, int to, uint64_t cap){
        edges[from].push_back({to, cap, (int)edges[to].size()});
        edges[to].push_back({from, 0, (int)edges[from].size()-1});
    }

    uint64_t max_flow(int s, int t){
        uint64_t flow = 0;
        while(true){
            set_level(s);
            if(level[t] < 0) return flow;
            memset(next, 0, sizeof(next));
            int f;
            while((f = blockingflow(s, t, -1)) > 0) flow += f;
        }
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.precision(12);
    cout.setf(ios_base::fixed, ios_base::floatfield);
    
    int H, W;
    cin >> H >> W;
    string s[100];
    for(int i=0;i<H;i++) cin >> s[i];

    dinic<20002> G;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(s[i][j] == 'X') G.add_edge(20000, 2*(i*100+j), -1);
            if(i==0 || i==H-1 || j==0 || j==W-1){
                if(s[i][j] == 'X'){
                    cout << -1 << endl;
                    return 0;
                }
                G.add_edge(2*(i*100+j)+1, 20001, -1);
            }
            if(i!=0)   G.add_edge(2*(i*100+j)+1, 2*((i-1)*100+j), -1);
            if(i!=H-1) G.add_edge(2*(i*100+j)+1, 2*((i+1)*100+j), -1);
            if(j!=0)   G.add_edge(2*(i*100+j)+1, 2*(i*100+(j-1)), -1);
            if(j!=W-1) G.add_edge(2*(i*100+j)+1, 2*(i*100+(j+1)), -1);
            if(s[i][j] == 'X') G.add_edge(2*(i*100+j), 2*(i*100+j)+1, -1);
            else G.add_edge(2*(i*100+j), 2*(i*100+j)+1, 1);
        }
    }

    cout << G.max_flow(20000, 20001) << endl;

    return 0;
}

Measured memory_bytes: 4736
def ri(): return int(input())
cand = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z".split()

n = ri()
while(n!=0):
    vote = input().split()
    sm = [0 for i in range(26)]
    flag = False
    for i in range(n):
        for j in range(26):
            if(vote[i] == cand[j]):
                sm[j] += 1
                break
        no1_sm = 0
        no2_sm = 0
        no1_idx = 0
        no2_idx = 0
        for j in range(26):
            if(sm[j] > no1_sm):
                no2_sm = no1_sm
                no2_idx = no1_idx
                no1_sm = sm[j]
                no1_idx = j
            elif(sm[j] > no2_sm):
                no2_sm = sm[j]
                no2_idx = j
        if((i+1) > n//2 and no1_sm > no2_sm+(n-1-i)):
            print(cand[no1_idx], i+1)
            flag = True
            break
        if(flag): break
    if(not flag):
        print("TIE")
    n = ri()

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

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

    long x;
    cin >> x;

    if (x < 7) {
        cout << 1 << endl;
        return 0;
    }

    long current = 0;
    long count = 0;
    count = x / 11 * 2;
    current = x % 11;

    if (0 < current && current < 7) {
        ++count;
    }else if( 6 < current ) {
        count += 2;
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))  
f = True
for a in A :
    if a % 2 == 0 :
        if a % 3 != 0 and a % 5 != 0 :
            f = False
            break
if f == True :
    print('APPROVED')
else :
    print('DENIED')    


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
int main() {
	priority_queue<pair<int, int>> q;
	int K, T;
	scanf("%d%d", &K, &T);
	for (int i = 1; i <= T; ++ i) {
		int a;
		scanf("%d", &a);
		q.push(make_pair(a, i));
	}
	int cnt = 0, las = 0;
	while (!q.empty()) {
		auto p = q.top(); q.pop();
		if (p.second == las) {
			if (q.empty()) cnt ++; else {
				auto pp = q.top(); q.pop();
				q.push(p);
				p = pp;
			}
		}
		las = p.second;
		p.first --;
		if (p.first) q.push(p);
	}
	printf("%d\n", cnt);
}



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

void fnInput(vector<int>& rvnNode, vector<vector<int>>& rvvnEdge)
{
  int nNodeSiz, nEdgeSiz;
  cin >> nNodeSiz>> nEdgeSiz;
  rvnNode.resize(nNodeSiz);
//rvvnEdge.resize(nNodeSiz, vector<int>(nNodeSiz, 0));
  rvvnEdge.resize(nNodeSiz);   //２次元目 push_back

  for (int& rnNode : rvnNode)
    cin >> rnNode;

  for (int i = 0; i <= nEdgeSiz; i++)
  {
    int nLeft, nRigt;
    cin >> nLeft >> nRigt;
    rvvnEdge[ nLeft - 1 ].push_back( nRigt - 1 );
    rvvnEdge[ nRigt - 1 ].push_back( nLeft - 1 );
  }
}

int fnPeakCnt(const vector<int> cnrvnNode, const vector<vector<int>>& cnrvvnEdge)
{
  int nPeakCnt = 0;

  for (int nBgn = 0; nBgn < cnrvnNode.size(); nBgn++)
  {
    bool bPeak = true;

    for (int nEnd : cnrvvnEdge[nBgn])
      if (cnrvnNode[nBgn] <= cnrvnNode[nEnd])
      {
        bPeak = false;
        break;
      }

    if (bPeak) nPeakCnt++;
  }
  return nPeakCnt;
}
  
int main()
{
  vector<int> vnNode;
  vector<vector<int>> vvnEdge;

  fnInput(vnNode, vvnEdge);
  cout << fnPeakCnt(vnNode, vvnEdge) << endl;

  return 0;
}

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

int main() {
  uint64_t k;
  std::cin >> k;

  std::vector<uint64_t> a(50, 49 + k / 50);
  for (int64_t i = 0; i < k % 50; i++) {
    a[i] += 50;
    for (int64_t j = 0; j < 50; j++) {
      if (i != j) {
        a[j]--;
      }
    }
  }
  std::cout << 50 << std::endl;

  for (int64_t i = 0; i < 50; i++) {
    std::cout << a[i];
    if (i != 49) {
      std::cout << " ";
    }
  }
  std::cout << std::endl;
  return 0;
}


Measured memory_bytes: 256
import sys
from collections import Counter
readline = sys.stdin.readline

MOD = 998244353
N = int(readline())
A = [int(readline()) for _ in range(N)]
S = sum(A)
C = Counter()
C[0] = 1
for a in A:
    for k, v in C.copy().items():
        C[k] = (C[k] + v)%MOD
        C[k+a] = (C[k+a] + v)%MOD
cnt = 0
for k, v in C.items():
    if 2*k >= S:
        cnt = (cnt + v)%MOD

cnt2 = 0
if S%2 == 0:
    D = Counter()
    D[0] = 1
    for a in A:
        for k, v in D.copy().items():
            D[k+a] = (D[k+a] + v)%MOD
    cnt2 = D[S//2]
ans = pow(3, N, MOD) - 3*cnt + 3*cnt2
print(ans%MOD) 

Measured memory_bytes: 136988
n,m = map(int,input().split())
tree_list  = {i:[] for i in range(1,n+1)}
answer_list = [0]*n
for i in range(1,n):
    a,b = map(int,input().split())
    tree_list[a].append(b)
    tree_list[b].append(a)
for i in range(m):
    num1,num2 = map(int,input().split())
    answer_list[num1-1] +=  num2
oya = [0]*n
oya_list = [1]
while len(oya_list) != 0:
    oya_list2 = oya_list
    oya_list = []
    for i in oya_list2:
        oya[i-1]  = 1
        for num in tree_list[i]:
            if oya[num-1] == 0:
                answer_list[num-1] += answer_list[i-1]
                oya_list.append(num)
for i in answer_list:
    print(i)

Measured memory_bytes: 69728
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    string a,b,c;
    cin >> a >> b >> c;
    if(a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

using namespace std;

struct Info {
	int days;
	int value;
};

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

	vector<Info> infoList(N);
	for(auto &x : infoList) {
		cin >> x.days >> x.value;
	}

	sort(infoList.begin(), infoList.end(), [](Info &a, Info &b) {
		return a.value > b.value;
	});

	vector<int> list(M);
	iota(list.begin(), list.end(), 1);

	// filled[i]: 期限からi日前の予定がうまっている
	vector<bool> filled(M + 1, false);
	int filledCount = 0;
	int result = 0;
	int goodVacant = 1;

	const auto fill = [&](int day, int value) {
		filled[day] = true;
		filledCount++;
		result += value;

		const auto itr = lower_bound(list.begin(), list.end(), day);
		list.erase(itr);
	};

	// dayより前で一番遅い空いた日を取得する
	const auto getGoodVacant = [&](int day) {
		const auto itr = lower_bound(list.begin(), list.end(), day);
		if(itr == list.end()) {
			return -1;
		}
		return *itr;
	};

	for(int i = 0; i < N; i++) {
		const auto &info = infoList[i];

		if(info.days > M) {
			continue;
		}

		if(!filled[info.days]) {
			fill(info.days, info.value);
		} else {
			const auto goodVacant = getGoodVacant(info.days);
			if(goodVacant != -1) {
				fill(goodVacant, info.value);
			}
		}
		
		if(filledCount == M) {
			break;
		}
	}

	cout << result << endl;

	return 0;
}


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

char conv(int N,char x){
  if(int(x-'A')+N>=26){
    N = N-26;
  }
  return char(x+N);
}

int main(){
  int N;
  string S;
  cin >> N >> S;
  for(int i=0;i<S.size();i++){
    cout << conv(N,S[i]);
  }
  cout << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<long long> sum(n + 1);
  for (int i = 0; i < n; i++) sum[i + 1] = sum[i] + a[i];
  vector<vector<long long>> dp(n + 1, vector<long long>(n + 1, 1LL << 60));
  for (int i = 1; i <= n; i++) dp[i][i] = 0;
  for (int len = 2; len <= n; len++) {
    for (int left = 1; left + len - 1 <= n; left++) {
      int right = left + len - 1;
      for (int mid = left; mid < right; mid++) {
        dp[left][right] = min(dp[left][right], dp[left][mid] + dp[mid + 1][right] + sum[right] - sum[left - 1]);
      }
    }
  }
  cout << dp[1][n] << endl;
  return 0;
}

Measured memory_bytes: 1536
#include<cstdio>
void swap(long long &a,long long &b) {
	long long t;
	t=a;
	a=b;
	b=t;
}
int main() {
	long long n,x;
	scanf("%lld%lld",&n,&x);
	long long ans=n;
	long long a=x,b=n-x;
	while(b) {
		if(a>b) swap(a,b);
		ans+=(b/a)*(a<<1);
		b%=a;
	}
	ans-=a;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 128
import sys
import bisect
input = sys.stdin.readline

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

    ans="Yes"
    m=0

    for i in range(n):
        if(m>=h[i]+2):
            ans="No"
        else:
            m=max(m,h[i])
        if(ans=="No"):
            break
        
    print(ans)
    
main()

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  // 荳蟷ｴ縺ｮ遘呈焚
  int r;
  cin >> r;
 
  // 莉･荳九�ｮ繧ｳ繝｡繝ｳ繝�/* */繧呈ｶ医＠縺ｦ霑ｽ險倥☆繧�
  cout << r*r << endl;
}

Measured memory_bytes: 256
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "PP.hpp"
#define deb(x...) cerr << "[" << #x << "] = " << x << "\n";
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

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

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long lint;
typedef vector<lint> vlint;
typedef vector<vlint> vvlint;
typedef pair<lint, lint> plint;
typedef double ld;

template<class T> bool chmin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool chmax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main() {
    ios::sync_with_stdio(false);
	cin.tie(0);
	
	int d;
	cin >> d;
	d = 25 - d;
	cout << "Christmas ";
	forn(i, d)cout << "Eve ";
	return 0;
}



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

import sys
# 再起回数上限変更
# sys.setrecursionlimit(1000000)

N = int(input())

d = {}
col_self = [0] * N

for i in range(N):
    d[i] = {}

cond = []
for i in range(N-1):
    cond.append(list(map(int, input().split())))
    a, b = cond[i][0]-1, cond[i][1]-1
    d[a][b] = {'cond':i, 'color':0}

# print(cond)
# print(d)

colors = []
result = [0] * N

for i in range(N):
    num = len(d[i])
    if col_self[i] > 0:
        num += 1

    if num > len(colors):
        colors = list(range(1, num+1))

    idx = 0
    for node in d[i]:
        if colors[idx] == col_self[i]:
            idx += 1
        d[i][node]['color'] = colors[idx]
        col_self[node] = colors[idx]
        result[d[i][node]['cond']] = colors[idx]
        idx += 1

print(len(colors))

for i in range(N-1):
    print(result[i])



Measured memory_bytes: 122084
/*
    Written by Nitrogens
    Desire for getting accepted!!
*/
#include <cstdio>
#include <ctime>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <bitset>
#include <stack>
#include <set>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 1e5+5;
const int Mod = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e = exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl

struct mat
{
    ll jz[55][55];
    mat()
    {
        memset(jz, 0, sizeof(jz));
    }
};
mat mat_mul(mat x,mat y)
{
    mat res;
    memset(res.jz,0,sizeof(res.jz));
    for(int i=0;i<=50;i++)
        for(int j=0;j<=50;j++)
            for(int k=0;k<=50;k++)
                res.jz[i][j]=(res.jz[i][j]+x.jz[i][k]*y.jz[k][j]+Mod)%Mod;
        return res;
}
mat power_mod (mat ans, mat res, ll P)//.res是系数矩阵,ans是变换矩阵!!左->ans,右->res.!!
{
    while(P>0)
    {
        if(P&1)  ans = mat_mul(ans,res);//所以应该答案矩阵在左ans,res);
        P=P>>1;
        res=mat_mul(res,res);
    }
    return ans;//返回指定位置元素
}

mat matrix;

int main()
{
    //ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);

    int n;
    ll k;
    scanf("%d%lld", &n, &k);

    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++) scanf("%lld", &matrix.jz[i][j]);
    }

    mat ans;
    for(int i = 1; i <= n; i++) ans.jz[1][i] = 1;

    ans = power_mod(ans, matrix, k);

    ll answer = 0;

    for(int i = 1; i <= n; i++)
    {
        //dbg2(i, ans.jz[1][i]);
        answer = (answer + ans.jz[1][i]) % Mod;
    }

    printf("%lld\n", answer);

    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}


Measured memory_bytes: 1016
#include<iostream>
#include <string>
#include<stdio.h>
#include <math.h>

using namespace std;


int main() {
	int N;
	cin >> N;
	int x[8], y[8], a[8][8], b[8][8],k = 1;
	double L[8][8],ans = 0.000;
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i];
		k *= (i + 1);
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			a[i][j] = (x[i] - x[j]) * (x[i] - x[j]);
			b[i][j] = (y[i] - y[j]) * (y[i] - y[j]);

			L[i][j] = a[i][j] + b[i][j];
			L[i][j] = sqrt(L[i][j]);

			L[i][j] = L[i][j] * k / N;

			ans += L[i][j];
		}
	}
	ans = ans / k;


	printf("%.16f", ans);


	return 0;
}

	






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

#define W first
#define V second
#define ll long long int

using namespace std;

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

    vector<pair<int,int>> v;

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

    ll dp[n+1][w+1]; memset(dp,0,sizeof(dp));

    for(ll i=1; i<=n;i++){
        for(ll j=1;j<=w;j++){
            if(v[i-1].W <= j){
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-v[i-1].W]+v[i-1].V);
            }else{
                dp[i][j] = dp[i-1][j];
            }
        }
    }

    cout << dp[n][w] << endl;

}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
#define int long long
#define ALL(c) begin(c),end(c)
using namespace std;
signed main() {
    vector<int> a(4),b(2);
    for(int i=0; i<4; i++) cin>>a[i];
    for(int i=0; i<2; i++) cin>>b[i];
    sort(ALL(a));
    sort(ALL(b));
    cout<<(accumulate(ALL(a),0ll)-a[0])+(accumulate(ALL(b),0ll)-b[0])<<endl;
    return 0;
}

Measured memory_bytes: 3156
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    string s; cin >> s;
    int len = s.size();
    bool fg = false;
    rep(i, len){
        rep(j, len){
            string t = s.substr(0, i) + s.substr(j);
            if(t == "keyence") fg = true;
        }
    }
    if(fg) cout << "YES" << ln;
    else cout << "NO" << ln; 
}


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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const long double pi=acos(-1);
#define x  first
#define y  second
#define read(n,a) for(int i=0;i<n;i++)cin>>a[i];

ll a[200002]={};
//ll b[100002]={};
ll n,m;

int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
        cin>>n;
        read(n,a);
        ll ans=0,mx=a[0];
        for(int i=1;i<n;i++)
        {
            ans+=max(0ll,mx-a[i]);
            mx=max(mx,a[i]);
        }
        cout<<ans;
    }
    return 0;
}


Measured memory_bytes: 5168
#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)
#define test cout << "test" << endl;
#define NNN_MAX 100010
typedef pair<int,int> P;

int max(int a,int b){
	if (a>b) return a;
	return b;
}

int min(int a,int b){
	if (a>b) return b;
	return a;
}

int main (){
	int HHH,WWW;
	cin >> HHH >>WWW;
	string temp;
	int sh=1,sw=1,gh=HHH,gw=WWW;
	bool map[HHH+2][WWW+2];
	int kyori[HHH+2][WWW+2];
	int counter=0;
	//入力受取
	rep(i,HHH){
		cin >> temp;
		rep(j,WWW){
			if(temp[j]=='.'){
				map[i+1][j+1]=true;
				counter ++;
			}
			else {
				map[i+1][j+1]=false;
			}
			kyori[i+1][j+1]=INF;
		}
	}
	rep(i,HHH+2){
		map[i][0]=false;
		map[i][WWW+1]=false;
		kyori[i][0]=INF;
		kyori[i][WWW+1]=INF;
	}
	rep(i,WWW+1){
		map[0][i]=false;
		map[HHH+1][i]=false;
		kyori[0][i]=INF;
		kyori[HHH+1][i]=INF;
	}

	map[sh][sw]=false;
	kyori[sh][sw]=0;

	queue <int> hque;
	queue <int> wque;
	hque.push(sh);
	wque.push(sw);
	int h,w;
	int dh[4]={0,0,1,-1};
	int dw[4]={1,-1,0,0};

	while(hque.size()>0){
		h = hque.front();
		w = wque.front();
		hque.pop();
		wque.pop();

		if(h==gh && w==gw) break;

		rep(i,4){
			if(map[h+dh[i]][w+dw[i]]){
				map[h+dh[i]][w+dw[i]]=false;
				kyori[h+dh[i]][w+dw[i]] = kyori[h][w]+1;
				hque.push(h+dh[i]);
				wque.push(w+dw[i]);
			}
		}

	}
	if(kyori[HHH][WWW]==INF){
		cout << -1 << endl;
		return 0;
	}
	//counter = まだ塗れるマス kyori = 使うますの最小値 counter - kyori -1 =score
	cout << counter - kyori[HHH][WWW] - 1<< endl;

	return 0;
}


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

const int mod=998244353;
const int maxn=4e5+7;

ll fac[maxn],inv[maxn];

ll power(ll a,ll b){
    ll ans=1;
    while(b){
        if(b&1) ans=ans*a%mod;
        b>>=1;
        a=a*a%mod;
    }
    return ans;
}

void init(){
    fac[0]=1,fac[1]=1;
    for(int i=2;i<=maxn;i++) fac[i]=fac[i-1]*1ll*i%mod;
    inv[maxn]=power(fac[maxn],mod-2)*1ll;
    for(int i=maxn-1;i>=0;i--) inv[i]=inv[i+1]*1ll*(i+1)%mod;
}

ll c(ll n,ll m){
    if(m==0) return 1;
    if(n<m) return 0;
    if(n==m) return 1;
    return fac[n]*1ll*inv[m]*1ll%mod*inv[n-m]%mod;
}


int main (){
    init();
    int n,a,b;
    ll k,ans=0;
    scanf("%d %d %d %lld",&n,&a,&b,&k);
    if(k==0) { puts("1"); return 0;}
    for(int  x=1;x<=n;x++){
        if((k-a*x)%b) continue;
        ll y=(k-a*x)/b;
        ans=(ans+c(n,x)*1ll%mod*c(n,y)*1ll%mod)%mod;
    }
    printf("%I64d\n",ans);
    return 0;
}


Measured memory_bytes: 6528
from itertools import product

N, A, B, C = map(int, input().split())
L = [int(input()) for _ in range(N)]

ans = 10**18
for state in product(range(4), repeat=N):
    K = [[] for _ in range(4)]
    for i, l in enumerate(L):
        K[state[i]].append(l)

    cost = 0
    for d, D in zip((A, B, C), K):
        if len(D) == 0:
            cost += 10**18
        cost += (len(D) - 1) * 10
        cost += abs(d - sum(D))
    ans = min(ans, cost)

print(ans)


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

int main(){
	long N, A, B, ans;
	cin >> N >> A >> B;
	if((B-A)%2==0){
		ans = (B-A)/2;
	}else{
		ans = min((A+B)/2, N-(A+B)/2);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
char s[100005];
int a[10];
int n,m;
long long dp[2][10];
int calc(int p,int x){
	int ans;
	if((n-p)%2==1)ans=x;
	else{
		ans=(x*2)/10+(x*2)%10;
	}
	return ans;
}
int main(){
	int i,j,k;
	scanf("%d",&n);
	scanf("%s",s);
	scanf("%d",&m);
	for(i=0;i<m;i++)scanf("%d",&a[i]);
	for(i=0;i<2;i++)for(j=0;j<10;j++)dp[i][j]=0;
	dp[1][0]=1;
	for(i=0;i<n;i++){
		if(s[i]=='*'){
			for(j=0;j<10;j++){
				dp[i%2][j]=0;
				for(k=0;k<m;k++){
					dp[i%2][j]+=dp[(i+1)%2][(j+10-calc(i,a[k]))%10];
				}
			}
		}
		else{
			int num=s[i]-'0';
			for(j=0;j<10;j++){
				dp[i%2][j]=0;
				dp[i%2][j]+=dp[(i+1)%2][(j+10-calc(i,num))%10];
			}
		}
	}
	printf("%d\n",dp[(n-1)%2][0]);
	return 0;
}

Measured memory_bytes: 1128
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;


int main() {
	ll n;
	cin >> n;

	ll ans;
	int flag = 0;
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			if (flag == 0) {
				ans = i + (n / i) - 2;
				flag = 1;
			}
			else {
				ans = min(ans, i + (n / i)) - 2;
			}
		}
	}

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


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

int main (void)
{
    string n;
    cin >> n;
    bool flag = false;

    for (char x : n) {
        if (x == '7') {
            cout << "Yes" << endl;
    return 0;
        }
    }
            cout << "No" << endl;
    
    return 0;

}

Measured memory_bytes: 3040
s = input()
def calc(s,op):
    ans = 0
    tmp = 0
    for i in range(len(s)):
        tmp += int(s[i])
        if i == len(s) - 1:
            ans += tmp
            break
        if op[i] == 0:
            tmp = tmp * 10
        else:
            ans += tmp
            tmp = 0
    return ans 
i_max = 2**(len(s)-1)
ans = 0
for i in range(i_max):
    op = [0]*(len(s) - 1)
    for j in range(len(op)):
        op[j] = i % 2
        i = i // 2
    ans += calc(s,op)
print(ans)

Measured memory_bytes: 3064
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <bitset>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(int argc, const char * argv[]) {
    int N, Ma, Mb; cin >> N >> Ma >> Mb;
    struct Ch { int a, b, c; };
    vector<Ch> ch(N);
    for (int i = 0; i < N; i++) cin >> ch[i].a >> ch[i].b >> ch[i].c;

    int upper_bound = 1000000;
    vector<vector<vector<int>>> dp(N+1, vector<vector<int>>(400+1, vector<int>(400+1, upper_bound)));
    dp[0][0][0] = 0;
    for (int i = 0; i < N; i++) {
        for (int a = 0; a <= 10*40; a++) {
            for (int b = 0; b <= 10*40; b++) {
                if (a >= ch[i].a && b >= ch[i].b) {
                    dp[i+1][a][b] = min(dp[i][a-ch[i].a][b-ch[i].b] + ch[i].c, dp[i][a][b]);
                } else {
                    dp[i+1][a][b] = dp[i][a][b];
                }
            }
        }
    }
    int ans = upper_bound;
    for (int a = 1; a <= 400; a++) {
        for (int b = 1; b <= 400; b++) {
            if (a * Mb == b * Ma) ans = min(ans, dp[N][a][b]);
        }
    }
    cout << (ans < upper_bound ? ans : -1) << endl;

    return 0;
}

Measured memory_bytes: 27392
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
const ll mod=998244353;
ll dp[3005][3005]={0};
int main(){
  ll n,s;
  cin>>n>>s;
  ll ans=0;
  for(int i=1;i<=n;i++){
    ll a;
    cin>>a;
    if(a<=s) {
      if(a==s){
        ans+=i*(n-i+1);
        ans%=mod;
      }
      dp[i][a]+=i;
      dp[i][a]%=mod;
    }
    for(int j=0;j<=s;j++){
      if(j>0) dp[i][j]+=dp[i-1][j];
      dp[i][j]%=mod;
      if(j+a<=s){
        dp[i][j+a]+=dp[i-1][j];
        dp[i][j+a]%=mod;
      }
      if(j+a==s){
        ans+=dp[i-1][j]*(n+1-i);
        ans%=mod;
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 70656
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int N, M; cin >> N >> M;
  int load[N] = {};
  rep(i, M) {
    int a, b; cin >> a >> b; a--; b--;
    load[a]++; load[b]++;
  }
  rep(i, N) cout << load[i] << endl;
  return 0;
}

Measured memory_bytes: 256
#include<map>
#include<stack>
#include<deque>
#include<queue>
#include<cmath>
#include<vector>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<fstream>
#include<iostream>
#include<algorithm>
#define inf 1e9
#define re register
#define ll long long
#define Flj(i,a,b) for(int i=(a);i;i=(b))
#define Fze(i,a,b) for(int i=(a);i<(b);i++)
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Fer(i,a,b) for(int i=(a);i>=(b);i--)
#define Fer1(i,a,b) for(int i=(a);i>b;i--)
#define Dfor(i,a,b,k) for(double i=(a);i<(b);i+=k)
#define Qmax priority_queue
#define Qmin priority_queue<int,vector<int>,greater<int> >
using namespace std;
int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int x;
int main(){
	x=read();
	if(x==3||x==5||x==7)printf("YES");
	else printf("NO");
} 

Measured memory_bytes: 256
n = int(input())
S = input()
cnt = 0
set_ = set()
for val in range(1000):
    val = str(val).zfill(3)
    a =val[0]
    b = val[1]
    c = val[2]
    flag = False
    for i in range(n):
        if S[i]==a and flag == False:
            for j in range(i+1,n):
                if S[j]==b and flag == False:
                    for k in range(j+1,n):
                        if S[k]==c and flag == False: 
                            cnt += 1
                            flag = True
                            break
                    break
            break
print(cnt)

Measured memory_bytes: 68272
num = int(input())

def countOfDivisors(num: int) -> bool:
    result = []
    for i in range(1, int(num ** 0.5) + 1):
        if num % i == 0:
            result.append(i)
            if i != num // i:
                result.append(num // i)

    return True if len(result) == 8 else False

result = 0
for tmp in range(1, num + 1):
    if tmp % 2 == 0: continue
    if countOfDivisors(tmp): result += 1

print(result)

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

int main() {
	int a;
	cin >> a;
	if (a <= 599) {
		cout << 8;
	}else if (a <= 799) {
		cout << 7;
	}
	else if(a <= 999) {
		cout << 6;
	}
	else if(a <= 1199) {
		cout << 5;
	}
	else if(a <= 1399) {
		cout << 4;
	}
	else if(a <= 1599) {
		cout << 3;
	}
	else if(a <= 1799) {
		cout << 2;
	}
	else {
		cout << 1;
	}


	return 0;
}

Measured memory_bytes: 3592
# 私はDFSを書けるようになるまで諦めない！！
n, q = map(int, input().split())
edges = [[]for _ in range(n)]
count = [0]*n
for _ in range(n-1):
    a, b = map(lambda x: int(x)-1, input().split())
    edges[a].append(b)
    edges[b].append(a)
for _ in range(q):
    p, x = map(int, input().split())
    count[p-1] += x

stack = [0]
INF = 10**18
counter = [INF]*n
counter[0] = count[0]
while stack:
    v1 = stack.pop()
    for v2 in edges[v1]:
        if counter[v2] != INF:
            continue
        counter[v2] = counter[v1] + count[v2]
        stack.append(v2)

print(*counter)


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

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

using ll = long long;
using namespace std;

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

    int n; cin >> n;
    int ans = 1e6;
    REPI(i, n){
        ll x; cin >> x;
        int count = 0;
        while(x % 2== 0){
            x /= 2;
            count++;
        }ans = min(ans, count);
    }cout << ans;
}


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

int main(void){
    int A, B, M;
    cin >> A >> B >> M;
    vector<int> a(A), b(B);
    vector<vector<int>> m(M, vector<int>(3));
    for (int i = 0; i < A; i++) cin >> a[i];
    for (int i = 0; i < B; i++) cin >> b[i];
    for (int i = 0; i < M; i++) cin >> m[i][0] >> m[i][1] >> m[i][2];
    
    int ans = *min_element(a.begin(), a.end()) + *min_element(b.begin(), b.end());
    for (int i = 0; i < M; i++)
        ans = min(ans, a[m[i][0]-1] + b[m[i][1]-1] - m[i][2]);
    cout << ans;
}

Measured memory_bytes: 6528
N = int(input())
XY = [tuple(map(int,input().split())) for i in range(N)]
guuki = (XY[0][0] + XY[0][1]) % 2
for x,y in XY:
    if (x+y)%2 != guuki:
        print(-1)
        exit()

arms = []
n = 1
for i in range(39):
    arms.append(n)
    n *= 2
if guuki==0:
    arms.append(1)
arms.reverse()

dirs = {'R':(1,0),'U':(0,1),'L':(-1,0),'D':(0,-1)}

print(len(arms))
print(*arms)
for x,y in XY:
    nx = ny = 0
    s = ''
    if guuki==0:
        nx += 1
        s += 'R'
    for a in arms[-39:]:
        dist = float('inf')
        dr = ''
        for d,(dx,dy) in dirs.items():
            tmp = abs(x - (nx+dx*a)) + abs(y - (ny+dy*a))
            if tmp < dist:
                dist = tmp
                dr = d
        dx,dy = dirs[dr]
        nx += dx*a
        ny += dy*a
        s += dr
    print(s)

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

int main(){
	string str;
	while(cin >> str){
		int len = str.size();
		for(int i=0;i<len;i++){
			if(str[i] == '@'){
				i++;
				string tmp = "";
				tmp += str[i];
				istringstream iss(tmp);
				int cou = 0;
				iss >> cou;
				i++;
				for(int j=0;j<cou;j++){
					cout << str[i];
				}
			}
			else cout << str[i];
		}
		cout << endl;
	}
}

Measured memory_bytes: 1212