akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    private static long min = int.MaxValue;
    static void Main(string[] args)
    {
        var nmr = Input.ar;
        var ar = Input.ar;
        var ad = new List<int>[nmr[0]];
        var dis = new long[nmr[0], nmr[0]];
        for (var i = 0; i < nmr[0]; i++)
            ad[i] = new List<int>();
        for(var i = 0; i < nmr[1]; i++)
        {
            var inp = Input.ar;
            for(var j = 0; j < 2; j++)
            {
                ad[inp[j] - 1].Add(inp[(j + 1) % 2] - 1);
                dis[inp[j] - 1, inp[(j + 1) % 2] - 1] = inp[2];
            }
        }
        for (var i = 0; i < nmr[0]; i++)
            for (var j = 0; j < nmr[0]; j++)
                if (i != j && dis[i, j] == 0)
                    dis[i, j] = int.MaxValue;
        for (var k = 0; k < nmr[0]; k++)
            for (var i = 0; i < nmr[0]; i++)
                for (var j = 0; j < nmr[0]; j++)
                    dis[i, j] = Min(dis[i, j], dis[i, k] + dis[k, j]);
        for (var i = 0; i < nmr[2]; i++)
            dfs(ar, new bool[nmr[2]], i, 0, dis);
        WriteLine(min);
    }
    private static void dfs(int[] ar,bool[] th,int index,long sum,long[,] dis)
    {
        th[index] = true;
        if (th.Count(c => c) == ar.Length)
        {
            min = Min(min, sum);
            th[index] = false;
            return;
        }
        for (var i = 0; i < ar.Length; i++)
            if (!th[i])
                dfs(ar, th, i, sum + dis[ar[index]-1, ar[i]-1], dis);
        th[index] = false;
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public  static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


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

int main(void)
{   
    int k, a, b;
    cin >> k >> a >> b;
    for(int i = a; i <= b; i++) {
        if(i%k == 0) {
            puts("OK");
            return 0;
        }
    }
    puts("NG");
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
#define all(x) (x).begin(),(x).end()

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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(10);
    int A,B,C;
    cin >> A >> B >> C;
    string d;
    if(A+B+C>21){
        d = "bust";
    }else{
        d = "win";
    }
    cout <<d<< "\n";
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        int[,] x = new int[N, N];
        int[,] y = new int[N, N];
        for (int i = 0; i < N; i++)
        {
            int num = int.Parse(Console.ReadLine());
            for(int j = 0; j < num; j++)
            {
                string[] input = Console.ReadLine().Split();
                x[i,j] = int.Parse(input[0]);
                y[i, j] = int.Parse(input[1]);
            }
        }
        int[] temp = new int[N];
        for (int i = 0; i < N; i++)
        {
            temp[i] = 0;
        }
        int ans = 0;
        for (int loop = 0; loop < Math.Pow(2, N); loop++)
        {
            bool flag = true;
            for (int i = 0; i < N; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    if (temp[i] == 1)
                    {
                        if (x[i,j]!=0&&temp[x[i, j] - 1] != y[i, j]) { flag = false; }
                    }
                }
            }
            if (flag == true) { ans = Math.Max(ans,temp.Sum() ); }
            temp[0] += 1;
            for (int i = 0; i < N; i++)
            {
                if (i != N - 1 && temp[i] == 2) { temp[i + 1] += 1; temp[i] = 0; }
            }
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13268
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  string s,j;
  cin>>s>>j;
  if(s.size()!=j.size()){
    cout<<"NO"<<endl;
    return;
  }
  rep(i,s.size()){
    if(s[i] != j[s.size()-i-1]){
      cout<<"NO"<<endl;
      return;
    }
  }

  cout<<"YES"<<endl;
  return;

}

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


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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cout << (*begin) << " ";
    *begin++;
  }
  cout << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cout << " " << Array[i][j];
    }
    cout << endl;
  }
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cerr << head << " ";
  print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
  int val = ((a % mod) + (b % mod)) % mod;
  if (val < 0) { val += mod; }
  a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

// ------------------------------------------------------------------------------------------

signed main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << min(b / a, c) << endl;

  return 0;
}

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl



int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i,n){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    while(a.size()!=1){
        int count = 0;
        FOR(i,1,a.size()){
            int num = a[i]%a[0];
            if(num==0)continue;
            else{
                count++;
                a[count]=num;
            }
        }
        a.resize(count+1);
        if(a.size()!=1)sort(a.begin(),a.end());
        else break;
    }
    cout << a[0] << endl;
    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 repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                                     \
  ifstream in("abc145/abc145_d.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// 逆元
// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

ll factorialMod(int n) {
  ll ret = 1;
  rep(i, n) {
    ret *= i + 1;
    ret %= MOD;
  }
  return ret;
}

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  ll x, y;
  cin >> x >> y;

  if ((2 * x - y) % 3 != 0 || (2 * y - x) % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }
  ll a = (2 * x - y) / 3;
  ll b = (2 * y - x) / 3;
  if (a < 0 || b < 0) {
    cout << 0 << endl;
    return 0;
  }

  ll abf = factorialMod(a + b);
  ll apb = factorialMod(a) * factorialMod(b) % MOD;
  ll cnt = abf * modinv(apb, MOD) % MOD;

  cout << cnt << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    
    String[] S = new String[N];

    for (int i = 0; i < N; i++) {
      String s_ = sc.next();
      S[i] = s_.substring(0,1);
    }

    sc.close();

    // 0:M 1:A 2:R 3:C 4:H
    long[] arr = new long[5];

    for (int i = 0; i < N; i++) {
      if (S[i].equals("M")) {
        arr[0]++;
      } else if (S[i].equals("A")) {
        arr[1]++;
      } else if (S[i].equals("R")) {
        arr[2]++;
      } else if (S[i].equals("C")) {
        arr[3]++;
      } else if (S[i].equals("H")) {
        arr[4]++;
      }
    }

    long count = 0;

    count += arr[0] * arr[1] * arr[2];
    count += arr[0] * arr[1] * arr[3];
    count += arr[0] * arr[1] * arr[4];
    count += arr[0] * arr[2] * arr[3];
    count += arr[0] * arr[2] * arr[4];
    count += arr[0] * arr[3] * arr[4];
    count += arr[1] * arr[2] * arr[3];
    count += arr[1] * arr[2] * arr[4];
    count += arr[1] * arr[3] * arr[4];
    count += arr[2] * arr[3] * arr[4];

    System.out.println(count);
 
  }

}

Measured memory_bytes: 49780
L = input()

mod = 10 ** 9 + 7
n = len(L)
dp1 = 0
dp2 = 0

for i in range(n):
    if L[i] == "1":
        dp1 = (dp1 + pow(2, dp2, mod) * pow(3, n-i-1, mod)) % mod
        dp2 = dp2 + 1

dp1 = (dp1 + pow(2, dp2, mod)) % mod
print(dp1)


Measured memory_bytes: 65352
package main

import "fmt"

func diff(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func score(mask int, ls []int, goal int) int {
	vs := make([]int, 0)
	for i := uint(0); 1<<i <= mask; i++ {
		if mask&(1<<i) > 0 {
			vs = append(vs, ls[i])
		}
	}

	min := 1000000
	mask2 := 1<<uint(len(vs)) - 1
	for i := uint(1); i <= uint(mask2); i++ {
		mp := 0
		sum := 0
		for j := uint(0); 1<<j <= mask2; j++ {
			if i&(1<<j) > 0 {
				sum += vs[j]
				mp += 10
			}
		}
		mp += diff(sum, goal)
		mp -= 10
		if mp < min {
			min = mp
		}
	}
	return min
}

func main() {
	var n, a, b, c int
	fmt.Scan(&n, &a, &b, &c)
	ls := make([]int, n)
	for i := range ls {
		fmt.Scan(&ls[i])
	}

	min := 1000000

	for i := 0; i < 1<<uint(n); i++ {
		for j := 0; j < 1<<uint(n); j++ {
			if i&j != 0 {
				continue
			}
			k := (1<<uint(n) - 1) &^ i &^ j

			if v := score(i, ls, a) + score(j, ls, b) + score(k, ls, c); v < min {
				min = v
			}
		}
	}

	fmt.Println(min)
}


Measured memory_bytes: 1408
n = int(input())
s = ["" for i in range(n)]
for j in range(n):
    s[j] = str(input())
s.sort()
count = [0 for _ in range(len(set(s)))]
l = 0
name = list(sorted(set(s)))
for k in range(n-1):
    count[l] += 1
    if(s[k] != s[k+1]):
        l += 1

count[-1] += 1

m_v = max(count)
ansnum = []

for h in range(len(count)):
    if(count[h] == m_v):
        ansnum.append(name[h])

print("\n".join(sorted(ansnum)))

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

using namespace std;

long long a, b, c, d;

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


    cin >> a >> b >> c >> d;
    long long ans = max({b * d, a * c, a * d, b  * c});
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3656
#include<stdio.h>


int main(void){
  
  int i,j,u,k,n,g[101][101],x;

  scanf("%d",&n);

  // 初期化
  for(i = 1 ; i <= n ; i++)
    for(j = 1 ; j <= n ; j++ )
      g[i][j]=0;
  
  // 入力
  for(i = 0 ; i < n ; i++){
    scanf("%d%d",&u,&k);
    for(j = 0 ; j < k ; j++ ){
      scanf("%d",&x);
      g[u][x] = 1;
    }
  }
  
  // 出力
  for(i = 1 ; i <= n ; i++){
    for(j = 1 ; j <= n ; j++ ){
      if(j != 1) printf(" ");
      printf("%d",g[i][j]);
    }
    printf("\n");
  }
    
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

void solve() {
    ll K;
    cin >> K;
    int MAX = 1e7;
    ll a = 7;
    if((a%K) == 0) {
        cout << 1 << endl;
        return;
    }
    REP(cnt,MAX) {
        a = ((a*10)+7)%K;
        if (a == 0) {
            cout << cnt+2 << endl;
            return;
        }
    }
    cout << "-1" << endl;
}

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

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    int n, k;
    cin >> n >> k;
    int res = 0;
    while (n > 0){
        n /= k;
        res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 3568
N = int(input())
T, A = map(int, input().split())
delta = float('inf')
H = list(map(int, input().split()))
for i in range(N):
    # H = int(input())
    if delta > abs((T - H[i] * 0.006) - A):
        delta = abs((T - H[i] * 0.006) - A)
        answer = i + 1

print(answer)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(){
  int ans=1<<30;
  int A,B,C,a,b,c,bitf,cnt;
  cin >> A >> B >> C;
  //AB,BC,CA++をするか、しないかを決めて揃える。
  for(bitf=0;bitf<(1<<3);bitf++){
    a=A;b=B;c=C;cnt=0;
    if(bitf & 1<<0 ){a++;b++;cnt++;}
    if(bitf & 1<<1 ){b++;c++;cnt++;}
    if(bitf & 1<<2 ){c++;a++;cnt++;}
    //偶奇パリティチェック
    if(a%2==b%2 && a%2==c%2){
    int max_abc = max(a,max(b,c));
    cnt+=(3*max_abc-a-b-c)/2;
    ans = min(ans,cnt);
    }
  }
  cout << ans << endl;
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define repd(i, n) for (int i = (n - 1); i >= 0; --i)
#define repds(i, n) for (int i = (n); i > 0; --i)
#define loop(i, x, n) for (int i = (x); i < (n); ++i)
#define loops(i, x, n) for (int i = (x); i <= (n); ++i)
#define loopd(i, x, n) for (int i = (x); i > (n); --i)
#define loopds(i, x, n) for (int i = (x); i >= (n); --i)
#define itrep(i, a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i, a) for (auto i = rbegin(a); i != rend(a); ++i)
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using ld = long double;
template <class T>
using priority_queuel = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-9;
ll mod = static_cast<ll>(1e9 + 7);
template <class T>
constexpr int sz(const T &a) { return (int)a.size(); }
template <class T>
constexpr T pow2(const T a) { return a * a; }
template <class T, class... Args>
constexpr void mins(T &a, Args... args) { a = min<T>({a, args...}); }
template <class T, class... Args>
constexpr void maxs(T &a, Args... args) { a = max<T>({a, args...}); }
template <class A, int N, class T>
void fillArray(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

int n, p;
string s;
ll cnt[10005];
void solve() {
    cin >> n >> p >> s;
    if (p == 2 || p == 5) {
        ll ans = 0;
        rep(i, n) {
            int x = s[i] - '0';
            if (x % p == 0) ans += i + 1;
        }
        cout << ans << endl;
    } else {
        int res = 0, tmp = 1;
        cnt[0] = 1;
        repd(i, n) {
            int x = s[i] - '0';
            (res += x * tmp) %= p;
            (tmp *= 10) %= p;
            ++cnt[res];
        }
        ll ans = 0;
        rep(i, p) ans += cnt[i] * (cnt[i] - 1) / 2;
        cout << ans << endl;
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
#define REP(i,a,n) for(int (i)=(a); (i)<(int)(n); (i)++)
#define rep(i,n) REP(i,0,n)
#define vec vector 


int char_to_int(char c){
  switch(c){
    case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
  }
}


int main(){
  int N;
  cin >> N;
  vector <vector<int>> A(2, vector<int>(N));
  rep (i, N) cin >> A.at(0).at(i); 
  rep (i, N) cin >> A.at(1).at(i); 
  
  vector <int> ame(N);
  
  ame.at(0) = A.at(0).at(0);
  rep (i, N) ame.at(0) += A.at(1).at(i);
  
  rep (i, N-1) ame.at(i+1) = ame.at(i) + A.at(0).at(i+1) - A.at(1).at(i);
  
  int res = ame.at(0);
  rep(i,N) {
    if(res < ame.at(i)){
      res = ame.at(i);
    }
  }
  
  cout << res;
  
                         
                         
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include<string>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define intarr(arr, n)  ll arr[n];  for (ll i = 0; i < n; i++)  cin >> arr[i]
#define inpvec(vec,n) for(ll i=0;i<n;i++){ll v;cin>>v;vec.push_back(v);}
#define ff first
#define ss second
#define pb push_back
#define mkp make_pair
#define vec vector<ll>
#define pi pair<ll,ll>
#define changeline cout<<endl
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(),v.end()
#define mod2 998244353
#define NO cout << "NO" <<endl
#define YES cout << "YES" <<endl
#define mem(arr,val) memset(arr,val,sizeof(arr));
const ll mod=1e9+7;

bool prime(ll n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
bool subsequence_checker(string str1, string str2, ll m, ll n) 
{ 
    if (m == 0) return true; 
    if (n == 0) return false; 
    if (str1[m-1] == str2[n-1]) 
        return subsequence_checker(str1, str2, m-1, n-1); 
    return subsequence_checker(str1, str2, m, n-1); 
}
ll inv(ll a)
{
    ll p=mod2;
    ll b=p-2,ans=1;
    for(;b > 0;a = a * a % p,b >>= 1)if(b & 1)ans = ans * a % p;
    return ans;
}
ll ncr(ll n,ll m)
{
    ll p=mod2;
    if(m > n)return 0;
    ll up=1,down=1;
    for(int i=n-m+1;i<n+1;i++)up*=i,up%=p;
    for(int i=1;i<m+1;i++)down*=i,down%=p;
    return up*inv(down)%p;
}

ll countDigit(ll n)
{   
    return floor(log10(n) + 1); 
}  
ll a_pow_b(ll a,ll b)
{
    ll p=1000000007;
    ll ans=1;
    for(;b > 0;a = a * a % p,b >>= 1)if(b & 1)ans = ans * a % p;
    return ans;
}
ll gcd(ll a,ll b) 
{ 
    if (b==0) 
        return a; 
    return gcd(b,a%b);      
} 
ll lcm(ll a, ll b)  
{  
    return (a*b)/gcd(a, b);  
}
bool isPerfectSquare(ll x) 
{   
  long double sr = sqrt(x); 
  return ((sr - floor(sr)) == 0); 
}
ll ncr123(ll n, ll k){
    if (k == 1) {
        return n;
    }
    if (k == 2) {
        return n * (n - 1) / 2;
    }
    if (k == 3) {
        return n * (n - 1) * (n - 2) / 6;
    }
}
bool com(const pi &a,const pi &b)   //acc to second element sort for vec of pi
{ 
    if(a.second==b.second)
        return a.first<b.first;
    return a.second<b.second;
}



void solve(){

    ll k;
    cin>>k;

    ll ans=0,p=100;
    while(p<k){
        p=p+p/100;
        ans++;
    }

    cout<<ans;
    return ;
}
 
 
int main()
{
    IOS;
    ll t;
    //cin>>t;
    t=1;

    while(t--){
        solve();
        cout<<endl;
    }

    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> as(n);
  for(Int i=0;i<n;i++) cin>>as[i],as[i]--;

  vector<Int> cs(n,0);
  for(Int a:as) cs[a]++;

  vector<Int> ds(n+1,0);
  for(Int c:cs) ds[c]++;

  vector<Int> sm1(n+2,0),sm2(n+2,0);
  for(Int i=0;i<=n;i++){
    sm1[i+1]=sm1[i]+i*ds[i];
    sm2[i+1]=sm2[i]+1*ds[i];
  }

  vector<Int> fs(n+1,n+1);
  for(Int i=1;i<=n;i++) fs[i]=(sm1[i+1]+i*(sm2[n+1]-sm2[i+1]))/i;

  for(Int k=1,p=n;k<=n;k++){
    while(k>fs[p]) p--;
    cout<<p<<"\n";
  }
  cout<<flush;
  return 0;
}


Measured memory_bytes: 14976
#include <iostream>

using namespace std;

int main(void){
    int n, i, j, k, count=0;
    cin >> n;
    long *a = new long[n];
    for(i=0; i<n; i++)
        cin >> a[i];
    if(n>=3){
        for(i=0; i<n-2; i++)
            for(j=i+1; j<n-1; j++)
                for(k=j+1; k<n; k++){
                    if((a[i]+a[j]>a[k] && a[i]+a[k]>a[j] && a[k]+a[j]>a[i]) && (a[i] != a[j] && a[i] != a[k] && a[j] != a[k])){
                        // cout << i+1 << ' ' << j+1 << ' ' << k+1 << endl;
                        count++;
                    }
                }
        cout << count;
    }
    else
        cout << 0;
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2　//1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;

lol dp[105][100005] = {};
vector<lol> w(105), v(105);
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, W;
    cin >> N >> W;
    reps(i, N){
      cin >> w[i] >> v[i];
    }
    reps(i, N){
      dp[i + 1][w[i]] = max(dp[i + 1][w[i]], v[i]);
      reps(j, W){
	dp[i][j] = max(dp[i][j], dp[i - 1][j]);
	if(dp[i][j] != 0 && j + w[i] <= W){
	  dp[i + 1][j + w[i]] = max(dp[i + 1][j + w[i]], dp[i][j] + v[i]);
	}
      }
    }
    lol maxv = 0;
    reps(i, N + 1){
      reps(j, W){
	maxv = max(dp[i][j], maxv);
	//	cout << dp[i][j] << " ";
      }
      //  cout << '\n';
    }
    cout << maxv << '\n';
    return 0;
}


Measured memory_bytes: 79360
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
	int n, m, k; cin >> n >> m >> k;
	ll a[n + 1] = {};
	for (int i = 1; i <= n; i++)
		cin >> a[i], a[i] += a[i - 1];
	ll b[m + 1] = {};
	for (int i = 1; i <= m; i++)
		cin >> b[i], b[i] += b[i - 1];
	int ans = 0;
	for (int i = 0; i <= n; i++)
		if (k >= a[i])
			ans = max(ans, i + int(upper_bound(b, b + m + 1, k - a[i]) - b - 1));
	cout << ans << "\n";
}

Measured memory_bytes: 6740
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
  return os<<"{"<<p.fs<<","<<p.sc<<"}";
}
template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
  os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}
template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}



signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll l,r,d;cin>>l>>r>>d;
  ll ans=0;
  rep(i,l,r+1){
    if(i%d==0)ans++;
  }
  cout<<ans<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 3652
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
//#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define SZ(X) ((int64_t)((X).size()))
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define intmax (std::numeric_limits<int64_t>::max() / 4)
#define doublemax (std::numeric_limits<double>::max() / 4)
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);

//sort(ALL(v),greater<int>());


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

	int x, y;
	cin >> x >> y;
	int ans = intmax;
	rep(i, 4) {
		int xx = x, yy = y, aa = 0;
		if (i % 2) { xx *= -1; aa++; }
		if (i / 2) { yy *= -1; aa++; }
		if (yy < xx)continue;
		ans = min(ans, aa + yy - xx);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 768
using System;

class Program
{
    static void Main()
    {
        int[] spade = new int[13];
        int[] heart = new int[13];
        int[] club = new int[13];
        int[] diamond = new int[13];
        for(int i = 0;i< spade.Length; i++)
        {
            spade[i] = i + 1;
            heart[i] = i + 1;
            club[i] = i + 1;
            diamond[i] = i + 1;
        }
        
        int n = int.Parse(Console.ReadLine());
        string[] card;
        int num = 0;
        for (int i = 0;i < n; i++)
        {
            card = Console.ReadLine().Split(' ');
            switch (card[0])
            {
                case "S":
                    num = int.Parse(card[1]);
                    spade[num - 1] += 100;
                    break;
                case "H":
                    num = int.Parse(card[1]);
                    heart[num - 1] += 100;
                    break;
                case "C":
                    num = int.Parse(card[1]);
                    club[num - 1] += 100;
                    break;
                case "D":
                    num = int.Parse(card[1]);
                    diamond[num - 1] += 100;
                    break;
            }
        }

        for(int i = 0;i < 13; i++)
        {
            if (spade[i] < 100)
                Console.WriteLine("S {0}", spade[i]);
        }
        for (int i = 0; i < 13; i++)
        {
            if (heart[i] < 100)
                Console.WriteLine("H {0}", heart[i]);
        }
        for (int i = 0; i < 13; i++)
        {
            if (club[i] < 100)
                Console.WriteLine("C {0}", club[i]);
        }
        for (int i = 0; i < 13; i++)
        {
            if (diamond[i] < 100)
                Console.WriteLine("D {0}", diamond[i]);
        }
    }
}

Measured memory_bytes: 9132
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <set>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <regex>
#include <cmath>
#include <map>
#include <iterator>
#include <climits>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <array>
#include <valarray>
#include <complex>
#include <random>
#include <functional>
#include <cassert>
#include <chrono>
#include <memory>

using namespace std;

#define int long long
//region TEMPLATE
////@formatter:off
#define double long double
typedef long long ll;
typedef unsigned long long ull;
template<typename T>void __read(T &a) { cin >> a; }
template<typename T, typename ... Args> void __read(T &a, Args &... args) { cin >> a;__read(args...);}
#define make(t, ...) t __VA_ARGS__; __read(__VA_ARGS__)
#define makev(a, n) VI a(n); FOR(n) cin >> a[i];
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FORIT(p) for(auto it = p.begin(); it != p.end(); it++)
#define FOR(b) for(signed i = 0; i <(b); i++)
#define FORE(i, l, r) for(int i = (l); i < (r); i++)
#define NFOR(i, n) for(int i = (((int) n)-1); i >= 0; i--)
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<pair<int, int>, int> PPII;
constexpr ll M7 = 1000000007ll;
constexpr ll M9 = 1000000009ll;
constexpr ll MFFT = 998244353ll;
template<class T> void outv(T &a) { for (auto &x : a) cout << x << ' '; }
static mt19937 rnd(static_cast<unsigned>(chrono::steady_clock::now().time_since_epoch().count())); // NOLINT(cert-err58-cpp)
auto __fast_io__ = (ios_base::sync_with_stdio(false), cin.tie(nullptr)); // NOLINT(cert-err58-cpp,cppcoreguidelines-interfaces-global-init)
////@formatter:on
//endregion



int32_t main() {
    make(int, n);
    int ans = 0;
    for(int i = 2; i*i<=n; ++i){
        if (n % i == 0){
            int cnt = 0;
            while(n % i == 0){
                n /= i;
                cnt++;
            }
            for(int t = 1; t <= cnt; ++t){
                ans++;
                cnt -= t;
            }
        }
    }
    if (n > 1){
        ans++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if((c>=a)&&(c<=b)){
    	cout<<"Yes";
    	return 0;
  }
  if((c>=b)&&(c<=a)){
    	cout<<"Yes";
    	return 0;
  }
  cout<<"No";
}
  

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<bitset<16> >(x) << endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 10000000;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
typedef pair<int, int> P;

/** Problem0068 : Enclose Pins with a Rubber Band **/
// Implementation of Andrew's monotone chain 2D convex hull algorithm.
// Asymptotic complexity: O(n log n).
// Practical performance: 0.5-1.0 seconds for n=1000000 on a 1GHz machine.
typedef double coord_t;         // coordinate type
typedef double coord2_t;  // must be big enough to hold 2*max(|coordinate|)^2

struct Point {
	coord_t x, y;
	
	bool operator <(const Point &p) const {
		return x < p.x || (x == p.x && y < p.y);
	}
};

// 2D cross product of OA and OB vectors, i.e. z-component of their 3D cross product.
// Returns a positive value, if OAB makes a counter-clockwise turn,
// negative for clockwise turn, and zero if the points are collinear.
coord2_t cross(const Point &O, const Point &A, const Point &B)
{
	return (A.x - O.x) * (B.y - O.y) - (A.y - O.y) * (B.x - O.x);
}

// Returns a list of points on the convex hull in counter-clockwise order.
// Note: the last point in the returned list is the same as the first one.
vector<Point> convex_hull(vector<Point> P)
{
	int n = (int)P.size(), k = 0;
	vector<Point> H(2*n);
	
	// Sort points lexicographically
	sort(P.begin(), P.end());
	
	// Build lower hull
	for (int i = 0; i < n; ++i) {
		while (k >= 2 && cross(H[k-2], H[k-1], P[i]) <= 0) k--;
		H[k++] = P[i];
	}
	
	// Build upper hull
	for (int i = n-2, t = k+1; i >= 0; i--) {
		while (k >= t && cross(H[k-2], H[k-1], P[i]) <= 0) k--;
		H[k++] = P[i];
	}
	
	H.resize(k);
	return H;
}

int main()
{
	int N;
	
	while (cin>>N, N) {
		vector<Point> points;
		vector<Point> ch;
		char c;

		rep(k, N) {
			Point p;
			cin >> p.x >> c >> p.y;
			points.push_back(p);
		}
		
		ch = convex_hull(points);
		cout << (int)points.size()-((int)ch.size()-1) << endl;
	}
}

Measured memory_bytes: 1268
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
arr=Counter(limii())
m=ii()
mat=limii()

for i in mat:
    arr[i]-=1

chk=True
for i in arr:
    if arr[i]<0:
        chk=False

if chk:
    print("YES")

else:
    print("NO")





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

int main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++)
    {
        cin >> a.at(i);
    }
    
    int m4 = 0, m2 = 0, m0 = 0;
    for (int i = 0; i < N; i++)
    {
        if (a.at(i) % 4 == 0)
            m4++;
        else if (a.at(i) % 2 == 0)
            m2++;
        else
            m0++;
    }
    if (m0 <= m4 || (m2 == 0 && m0 == m4 + 1))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3796
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    let n = get!(u8);
    let mut s: Vec<_> = get().as_bytes().iter().cloned().collect();
    
    for c in s.iter_mut() {
        *c += n;
        if *c > b'Z' {
            *c -= b'Z' - b'A' + 1;
        }
    }
    let ans = String::from_utf8(s).unwrap();
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include<stdio.h>

int main() {
  int n,x,t,ans;
  scanf("%d %d %d\n", &n, &x, &t);
  if(x != 0)
    ans = n / x;
  int r = n % x;
  if(r==0){
    printf("%d\n", ans * t);
  } else {
    ans = ans + 1;
    printf("%d\n", ans * t);
  }
  return 0;
}


Measured memory_bytes: 1732
#include<iostream>
#define pb push_back
#define ll long long

int main(){
 std::string s;
  std::cin >> s;
  ll t=0;
  for(ll i=0;i<s.length();i++){
    t+=s[i]-48;
  }
  if(t%9==0) std::cout << "Yes";
  else std::cout << "No";
 return 0;
}


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

char map[101][7][7][7];

int main() {
	int N, M1, M2, a, b, c, C;
	set<int> A, B;
	for(int z=0; z<7; ++z) {
		for(int y=0; y<7; ++y) {
			for(int x=0; x<7; ++x) {
				for(int t=0; t<101; ++t) {
					map[t][z][y][x] = '0';
				}
			}
		}
	}
	C = 1;
	while(1) {
		cin >> N;
		if(!N) break;
		if(C>1) cout << endl;
		A.clear(); B.clear();
		for(int z=1; z<=5; ++z) {
			for(int y=1; y<=5; ++y) {
				for(int x=1; x<=5; ++x) {
					cin >> map[0][z][y][x];
				}
			}
		}
		cin >> M1;
		for(int i=0; i<M1; ++i) {
			cin >> a; A.insert(a);
		}
		cin >> M2;
		for(int i=0; i<M2; ++i) {
			cin >> b; B.insert(b);
		}
		
		for(int t=0; t<N; ++t) {
			for(int z=1; z<=5; ++z) {
				for(int y=1; y<=5; ++y) {
					for(int x=1; x<=5; ++x) {
						c = 0;
						for(int z1=-1; z1<=1; ++z1) {
							for(int y1=-1; y1<=1; ++y1) {
								for(int x1=-1; x1<=1; ++x1) {
									if(!x1&&!y1&&!z1) continue;
									if(map[t][z+z1][y+y1][x+x1]=='1') c++;
								}
							}
						}
						if(map[t][z][y][x]=='1') {
							map[t+1][z][y][x] = (B.find(c)==B.end()?'0':'1');
						}else {
							map[t+1][z][y][x] = (A.find(c)==A.end()?'0':'1');
						}
					}
				}
			}
		}
		
		cout << "Case " << C << ":" << endl;
		for(int z=1; z<=5; ++z) {
			for(int y=1; y<=5; ++y) {
				for(int x=1; x<=5; ++x) {
					cout << map[N][z][y][x];
				}
				cout << endl;
			}
			if(z!=5) cout << endl;
		}
		C++;
	}
	return 0;
}

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

int main(){
    map<string, int> a;//値が設定されてないキーに対する値はデフォルト値(0)を値に持ってるのかな
    int N;
    cin >> N;
    string s;
    for(int i=0;i<N;i++){
       cin >> s;
       a[s]++;          //map関数ではあるキーに対応する値は　変数[キー]　で表す
    }
    int M;
    cin >> M;
    string t;
    for(int i=0;i<M;i++){
        cin >> t;
        a[t]--;
    }
    int c=0;
     auto itr = a.begin();
    while (itr!= a.end()){
        c=max(c,itr->second);
        itr++;
    }

      /* for(auto itr =a.begin();itr!=a.end();itr++){
            c=max(c,itr->second);
        }; //mapはソートできないらしい*/
   cout << c <<endl;
   return 0;
}

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

int main(){
    int D,N;
    cin>>D>>N;
    int x=1;
    for (int i=0; i<D; i++) {
        x=x*100;
    }
    if (N!=100) {
         cout<<N*x<<endl;
    }else{
        cout<<(N+1)*x<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
 
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; }



void solve(){
    string s;
    ll k;
    cin>>s>>k;
    ll n=s.size();
    ll ans=0;
    for(ll i=1;i<n;i++){
        if(k==1){
            ans+=9;
        }
        else if(k==2){
            if(i==1) continue;
            ans+=9*(i-1)*9;
        }
        else if(k==3){
            if(i<k) continue;
            ans+=9*(i-1)*(i-2)/2*9*9;
        }
    }

    ll a=s[0]-'0';
    if(k==1) ans+=a;
    else if(k==2){
        ans+=(a-1)*(n-1)*9;
        bool ok=false;
        rep2(i,1,n){
            if(s[i]=='0'&&ok==false) continue;
            if(ok) ans+=9;
            else{
                if(s[i]!='0') ok=true;
                ll b=s[i]-'0';
                ans+=b;
            }
        }
    }
    else if(k==3){
        ans+=(a-1)*(n-1)*(n-2)/2*9*9;
        bool ok=false;
        ll sum=0;
        rep2(i,1,n){
            if(s[i]=='0'&&ok==false) continue;
            if(sum==1&&s[i]!='0'){
                ans+=(s[i]-'0');
                ans+=(n-i-1)*9;
                sum=0;
            }
            if(ok){
                ans+=(n-i-1)*9*9;
            }
            else{
                if(s[i]!='0') ok=true;
                ll b=s[i]-'0';
                ans+=(b-1)*(n-i-1)*9;
                sum=1;
            }
        }

    }
    // cout<<n<<endl;
    cout<<ans<<endl;


}


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

    solve(); 


    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define INF LLONG_MAX/3
#define P std::pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
signed main(){
	int d;
	cin>>d;
	if(d==25)puts("Christmas");
	else if(d==24)puts("Christmas Eve");
	else if(d==23)puts("Christmas Eve Eve");
	else puts("Christmas Eve Eve Eve");
	return 0;
}

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

using namespace std;

int main()
{
	int nProbCnt = 0;
	cin >> nProbCnt;

	long TotalTime = 0;
	vector<long> vProdTime(nProbCnt);
	for (int i = 0; i < nProbCnt; i++)
	{
		cin >> vProdTime[i];
		TotalTime += vProdTime[i];
	}

	int nDrinkCnt = 0;
	cin >> nDrinkCnt;
	vector<long> vNeoTotal(nDrinkCnt);		// Dring飲んだ後のTotal時間格納用
	for (int i = 0; i < nDrinkCnt; i++)
	{
		int nProblemNo;
		int nDrinkTime;
		cin >> nProblemNo >> nDrinkTime;

		// 指定の問題Noに対して、ドリンクなしとの差分を引けばよい
		long lnDopingTime = vProdTime[nProblemNo - 1] - nDrinkTime;
		vNeoTotal[i] = TotalTime - lnDopingTime;
	}

	for (int i = 0; i < nDrinkCnt; i++)
	{
		printf("%ld\n", vNeoTotal[i]);
	}
	return 0;
}


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

int main() {
  int data[] = {1,2,4,8,16,32,64,128,256,512};
  int n;
  while ( cin >> n ) {
    vector<int> num;
    num.clear();
    for ( int i = 9; i >= 0; i-- ) {
      if ( n - data[i] >= 0 ) {
	n-= data[i];
	num.push_back(data[i]);
      }
    }
    for ( int i = num.size()-1; i >= 0; i-- ) {
      if ( i == 0 ) cout << num[i] << endl;
      else cout << num[i] << " ";
    }
  }

  return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include<bits/stdc++.h>
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long;

long long ncr(int n, int r) {
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    long long ans = 1;
    int i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}
ll mod(ll a,ll b,ll m){
    if(b==0)return 1;
    if(b%2==0){
        ll y =  mod(a,b/2,m);
        return (y*y)%m;
    }
    else{
        return ((a%m)*mod(a,b-1,m))%m;
    }
}

ll modinv(ll a,ll m){
return mod(a,m-2,m);
//works only for prime m.
//else calculate phi(m)-1.
}



int main()
{
    int d,t,s;
    cin>>d>>t>>s;
    int p = (d+s-1)/s;

    if(p<=t)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;


    return 0;
}


Measured memory_bytes: 3648