akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    vector<int> a(4);
    rep(i,4) a[i] = s[i] - '0';
    rep(op1,2){
        rep(op2,2){
            rep(op3,2){
                int num = a[0];
                num += (op1 ? a[1] : -a[1]);
                num += (op2 ? a[2] : -a[2]);
                num += (op3 ? a[3] : -a[3]);
                if(num != 7) continue;
                cout << a[0];
                cout << (op1 ? "+" : "-") << a[1];
                cout << (op2 ? "+" : "-") << a[2];
                cout << (op3 ? "+" : "-") << a[3];
                cout << "=7" << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

typedef long long ll;

ll mod=1000000007ll;

map<pair<ll,ll>,ll>dp;

ll dfs(ll s,ll x){

	if(dp[make_pair(s,x)]!=0){
		return dp[make_pair(s,x)];
	}
	if(s==0ll&&x==0ll){
		return dp[make_pair(s,x)]=1ll;
	}

	ll res=dfs(s/2ll,x/2ll);

	if(s>=1ll&&x>=1ll){
		res+=dfs((s-1ll)/2ll,(x-1ll)/2ll);
		res%=mod;
	}
	if(s>=2ll){
		res+=dfs((s-2ll)/2ll,x/2ll);
		res%=mod;
	}

	return dp[make_pair(s,x)]=res%mod;

}

int main(){

	ll N;
	scanf("%lld",&N);

	cout<<dfs(N,N)<<endl;

	return 0;
}

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

using namespace std;

#define all(x) (x).begin(), (x).end()
typedef long double ld;
typedef long long ll;

const int M = 100100;

int n, a[M];

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

bool check(int k) {
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] != k && a[i] != k - 1)
            return false;
        if (a[i] == k - 1)
            ++cnt;
    }
    if (cnt > k)
        return false;
    if (cnt == k && n != k)
        return false;
    if (n - cnt < 2 * (k - cnt))
        return false;
    return true;
}


int main() {
#ifdef LOCAL
  assert(freopen("b.in", "r", stdin));
#endif

  ios_base::sync_with_stdio(false);

  read();
  if (check(a[0]) || check(a[0] + 1))
      cout << "Yes\n";
  else
      cout << "No\n";

}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
signed main()
{
    int n;
    cin >> n;
    int z = 0;
    int t = n;
    while (t > 0) {
        z += t % 10;
        t /= 10;
    }
    yorn(n % z == 0);
    return 0;
}

Measured memory_bytes: 3600
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc *bufio.Scanner

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

type restaurant struct {
	i int
	s string
	p int
}

type restaurants []restaurant

func (r restaurants) Len() int {
	return len(r)
}

func (r restaurants) Swap(i, j int) {
	r[i], r[j] = r[j], r[i]
}

func (r restaurants) Less(i, j int) bool {
	if r[i].s != r[j].s {
		return r[i].s < r[j].s
	}
	return r[i].p > r[j].p
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt()

	var rest restaurants = make([]restaurant, n)
	for i := range rest {
		sc.Scan()
		rest[i].i, rest[i].s, rest[i].p = i+1, sc.Text(), nextInt()
	}
	sort.Sort(rest)

	for _, r := range rest {
		fmt.Println(r.i)
	}
}


Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;

#define loop(i, N) for (int i = 0; i < N; ++i)
#define scanInt(x) int x; scanf("%d", &x); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &x); getchar();
#define scanVecInt(A, N) vector<int> A(N); loop(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); loop(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(N);
    scanVecInt(A, N);
    sort(A.begin(), A.end());
    printf("%d\n", A.back() - A.front());
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main() {
	string s;
	cin >> s;

	for (int i = 1; i < 4; i++){
		if (s[i] == s[i - 1]){
			cout << "Bad" << endl;
			break;
		}
		if (i == 3){
			cout << "Good" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
N=int(input())
abc=[tuple(map(int,input().split())) for i in range(N-1)]
g=[set() for i in range(N)]
for a,b,c in abc:
  g[a-1].add((b-1,c))
  g[b-1].add((a-1,c))
memo=[-1]*N

Q,K=map(int,input().split())
import collections
q=collections.deque([(K-1,0)])
memo[K-1]=0
while(q):
  
  x,w = q.popleft()
  for a,b in g[x]:
    if memo[a]==-1:
      memo[a]=w+b
      q.append((a,w+b))
  
for i in range(Q):
  x,y=map(int,input().split())
  print(memo[x-1]+memo[y-1])


Measured memory_bytes: 76884
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <bitset>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long N;
  cin >> N;
  vector<long> A(N + 1);
  rep (i, N+1) cin >> A[i];
  vector<long> B(N);
  rep (i, N) cin >> B[i];

  long ans = 0;

  rep (i, N) {
    long foo = min(A[i], B[i]);
    ans += foo;
    A[i] -= foo;
    B[i] -= foo;
    foo = min(A[i+1], B[i]);
    ans += foo;
    A[i+1] -= foo;
    B[i] -= foo;
  }

  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 1792
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  str s;
  cin >> s;
  int n = s.length();
  vector<ll> x_len;
  str x_str;
  int x_cnt = 0;
  REP(i,n){
    if(s[i]!='x'){
      x_len.push_back(x_cnt);
      x_cnt = 0;
      x_str = x_str + s[i];
    }else{
      x_cnt++;
    }
    if(s[i]!='x'&&i==n-1) x_len.push_back(0);
    if(s[i]=='x'&&i==n-1) x_len.push_back(x_cnt);
  }
  //cout << x_str << endl;
  //for(int cnt:x_len) cout << cnt << endl;
  str x_reversed(x_str);
  reverse(x_reversed.begin(),x_reversed.end());
  if(x_reversed!=x_str){
    cout << -1 << endl;
    return 0;
  }
  int k = x_len.size()/2;
  int ans = 0;
  REP(i,k){
    ans += abs(x_len[i]-x_len[x_len.size()-1-i]);
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
	int n, m, a[101];
	cin >> n >> m;
	int s = 0;
	rep(i, n) {
		cin >> a[i];
		s += a[i];
	}
	int c = 0;
	rep(i, n) {
		if (a[i] >= (s + 4 * m - 1)/(4*m))c++;
		
	}
	cout << (c >= m ? "Yes" : "No") << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

#define MOD 1000000009
typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;



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

    if(abs(x-a)>abs(x-b))
        cout<<"B"<<endl;
    else
        cout<<"A"<<endl;

 return 0;
}


Measured memory_bytes: 3584
package main

import (
	"fmt"
)

func main() {
	var i int
	fmt.Scan(&i)

	arr := make([]int, 0, i)
	for j := 0; j < i; j++ {
		var k int
		fmt.Scan(&k)
		arr = append(arr, k)
	}

	count := 0

	for j := 1; j < i-1; j++ {
		if (arr[j-1] < arr[j] && arr[j] < arr[j+1]) || (arr[j+1] < arr[j] && arr[j] < arr[j-1]) {
			count++
		}
	}

	fmt.Println(count)
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

int memo[52][52][52][52];

int main(){
  int w,h;
  while((w = getInt()) + (h = getInt())){
    int tx = getInt();
    int ty = getInt();
    int kx = getInt();
    int ky = getInt();

    w += 2; h += 2;
    vector<vector<int> > m(h, vector<int>(w, 1));

    REP(i,h-2) REP(j,w-2)
      m[i+1][j+1] = getInt();

    //REP(i,h){ REP(j,w) printf("%d ",m[i][j]); puts(""); }

    memset(memo, -1, sizeof(memo));

    typedef pair<pair<int,int>,pair<int,int> > data;
    queue<data> q;

#define MP(a,b,c,d) mp(mp(a,b),mp(c,d))
    q.push(MP(tx,ty,kx,ky));
    memo[tx][ty][kx][ky] = 0;

    while(!q.empty()){
      data d = q.front();

      int txx = d.f.f;
      int tyy = d.f.s;
      int kxx = d.s.f;
      int kyy = d.s.s;

      int now = memo[txx][tyy][kxx][kyy];

      if(now == 100){
        puts("NA");
        break;
      }
      if(txx == kxx && tyy == kyy){
        printf("%d\n",memo[txx][tyy][kxx][kyy]);
        break;
      }

      //printf("%d,%d : %d,%d\n",txx,tyy,kxx,kyy);
      q.pop();

      REP(i,4){
        int txxx = txx + _dx[i];
        int tyyy = tyy + _dy[i];

        int kxxx = kxx - _dx[i];
        int kyyy = kyy - _dy[i];

        if(m[tyyy][txxx] == 1){
          txxx = txx;
          tyyy = tyy;
        }

        if(m[kyyy][kxxx] == 1){
          kxxx = kxx;
          kyyy = kyy;
        }

        if(memo[txxx][tyyy][kxxx][kyyy] == -1){
          memo[txxx][tyyy][kxxx][kyyy] = now + 1;
          q.push(MP(txxx,tyyy,kxxx,kyyy));
        }
      }
    }
    if(q.empty()){
      puts("NA");
    }
  }
  return 0;
}

Measured memory_bytes: 28000
#include <cstdio>
#include <cstdint>

constexpr intmax_t mod = 1e9+7;

int main() {
  intmax_t n, k;
  scanf("%jd %jd", &n, &k);

  if (n > k) return puts("0"), 0;

  intmax_t res = 1;
  for (int i = 0; i < n; ++i)
    (res *= k-i) %= mod;

  printf("%jd\n", res);
}



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

#define x first
#define y second

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

const int mod=1000000000+7;

int addm(int& a,int b) {return (a+=b)<mod?a:a-=mod;}

template<class T,class U> bool smin(T& a,U b) {return a>b?(a=b,1):0;}
template<class T,class U> bool smax(T& a,U b) {return a<b?(a=b,1):0;}

string mat[500];
int colct[500],N,rowct[500],m=INT_MAX,ec;

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

	cin >> N;
	bool sb=0;
	for (int i=0;i<N;i++) {
		cin >> mat[i];
		for (int j=0;j<N;j++) if (mat[i][j]=='#') {
			colct[j]++;
			rowct[i]++;
			sb=1;
		}
	}

	if (!sb) {
		cout << "-1\n";
		return 0;
	}

	for (int i=0;i<N;i++) if (colct[i]!=N) ec++;

	for (int i=0;i<N;i++) {
		smin(m,N-rowct[i]+(colct[i]==0));
	}

	cout << ec+m << endl;

	
}

Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>

int main(void){
  char s[10];
  int i = 0;
  int hnum = 0;
  int inum = 0;
  scanf("%s", s);
  if (strlen(s) < 2 || strlen(s)%2 != 0){
    printf("No");
    return 0;
  }
  for(i=0;i<strlen(s);i++){
    if(i%2==0){
      if(s[i]!='h'){
        printf("No");
        return 0;
      }
    }
    if(i%2!=0){
      if(s[i]!='i'){
        printf("No");
        return 0;
      }
    }
  }
  printf("Yes");
}

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

using namespace std;

int main(){
  string s;
  string t;
  string u;
  int a;
  int b;
  cin >> s >> t;
  cin >> a >> b;
  cin >> u;
  if(s==u){
    a--;
  }
  if(t==u){
    b--;
  }
  cout << a << " " << b << endl;

  return 0;
}


Measured memory_bytes: 256
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/icl/interval_map.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::integer;

using ll = long long;
namespace bst = boost;
namespace icl = boost::icl;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

ll fact(ll a, ll b) {
  return (b ? a * fact(a - 1, b - 1) % 1000000007LL : 1);
}

ll mpow (ll a, ll b) {
  ll tmp = (b % 2) ? a : 1;
  return (b ? (tmp * mpow((a * a) % 1000000007LL, b / 2)) % 1000000007LL : 1);
}

auto solve() {
  in<ll> N, M;
  
  ll f = fact(M, N), rig = f, r = f, s = 1, permu = N;
  REP(i, N) {
    rig = rig * mpow(M-i, 1000000005LL) % 1000000007LL;
    if (s > 0)
      r = (r + 1000000007LL - rig * permu % 1000000007LL) % 1000000007LL;
    else
      r = (r + rig * permu) % 1000000007LL;
    s *= -1;
    permu = (permu * (N-i-1) % 1000000007LL) * mpow(i + 2, 1000000005LL) % 1000000007LL;
  }

  return r * f % 1000000007LL;
}

template<typename T> void plot(const T& func) { cout << setprecision(9) << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }

int main() {
  plot(solve);

  return 0;
}



Measured memory_bytes: 11372
#include <chrono>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 10;
//    const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 179;
//    const ld PI = 3.1415926535;
#endif

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")

const int mod = 998244353;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    #else
//        freopen("capitals.in", "r", stdin);
//        freopen("capitals.out", "w", stdout);
    #endif
    int n, s;
    cin >> n >> s;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<int> dp(s + 1, 0);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] > s) continue;
        if (a[i] == s) {
            ans += (i + 1) * (n - i);
            ans %= mod;
        } else {
            ans += (dp[s - a[i]] * (n - i)) % mod;
            ans %= mod;
            vector<int> add(s + 1, 0);
            add[a[i]] = i + 1;
            for (int j = 0; j < s - a[i]; j++) {
                add[j + a[i]] += dp[j];
                add[j + a[i]] %= mod;
            }
            for (int j = 0; j < s; j++) {
                dp[j] += add[j];
                dp[j] %= mod;
            }
        }
    }
    cout << ans;
}
/*

*/


Measured memory_bytes: 384
n,m=map(int,input().split())
ans=[0]*n
num1=[[] for _ in range(n)]
def ap(num01,num02):
    num1[num01-1].append(num02)
    num1[num02-1].append(num01)
for i in range(m):
    a,b=map(int,input().split())
    ap(a,b)
queue=[1]
def apq(num01):
    queue.append(num01)
def qp():
    return queue.pop(0)
for i in range(n):
    if len(queue)==0:
        break
    num=qp()
    for j in range(len(num1[num-1])):
        if ans[num1[num-1][j]-1]==0:
            apq(num1[num-1][j])
            ans[num1[num-1][j]-1]=num
if ans.count(0)!=0:
    print("No")
else:
    print("Yes")
    for i in range(1,n):
        print(ans[i])


Measured memory_bytes: 33856
using System;
class Program
{
        static void Main(string[] args)
        {
                // スペース区切りの整数の入力
                string[] input = Console.ReadLine().Split(' ');
                int a = int.Parse(input[0]);
                int b = int.Parse(input[1]);
   
        int ans = calcNum(a, b);  
      
                //出力
                Console.WriteLine(ans);
        }
  
    static int calcNum(int A, int B)
    {
        int rNum = 0;


        // Aの値を確認(四捨五入)
        // Aが2の場合minAは25、maxAは37
        // Aが8の場合minAは100、maxAは112
        // Aが19の場合minAは238、maxAは249
        int minA = (int)Math.Floor(A / 0.08 + 0.5);
        int maxA = (int)Math.Floor(((A+1) / 0.08) + 0.5) - 1;


        // Bの値を確認(四捨五入)
        // Bが2の場合minAは20、maxAは37
        // Bが10の場合minBは100、maxBは109
        // Bが99の場合minBは990、maxBは999
        int minB = (int)Math.Floor(B / 0.1 + 0.5);
        int maxB = (int)Math.Floor(((B+1) / 0.1) + 0.5) - 1;


        // 最小値の範囲で比較
        if(minA <= minB)
        {
            if(minB <= maxA)
            {
                rNum = minB;
            }
            else
            {
                rNum = -1;
            }
        }
        else
        {
            if(minA <= maxB)
            {
                rNum = minA;
            }
            else
            {
                rNum = -1;
            }
        }


        return rNum;
    }


}

Measured memory_bytes: 13268
import copy

h, w, k = map(int, input().split())
cs = []
ans = 0

def count_sharps(tmp):
  sharp = 0
  for y in range(h):
    sharp += tmp[y].count("#")
  if sharp == k:
    return True
  else:
    return False



for _ in range(h):
  cs.append(list(input()))

for i in range(2 ** h):
  for j in range(2 ** w):
    tmp = copy.deepcopy(cs)
    for p in range(h):
      if ((i >> p) & 1):
        for x in range(w):
          tmp[p][x] = "r"
    for q in range(w):
      if ((j >> q) & 1):
        for y in range(h):
          tmp[y][q] = "r"

    if count_sharps(tmp):
      ans += 1

print(ans)

Measured memory_bytes: 72060
N = int(input())
A = list(input().split(" "))
A = [int(i) for i in A]
joushi={}
for i in range(1,N+1):
    joushi[i]=0
for i in A:
    if i in joushi:
        joushi[i]+=1
for v in joushi.values():
    print(v)

Measured memory_bytes: 40080
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    int n;
    cin >> n;
    cout << 48 - n << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		if (s.equals("AAA") || s.equals("BBB")) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < int(n); ++i)
#define rrep(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = int(s); i < int(n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==v.size()-1?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,m;
    cin >> n >> m;
    vvi G(n);
    rep(i,m) {
        int a,b;
        cin >> a >> b;
        a--; b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    vb seen(n);
    seen[0] = true;
    vi ans;
    ans.pb(0);
    rep(_,2) {
        int now = 0;
        while(true) {
            bool ok = false;
            for(int i : G[now]) {
                if(seen[i]) continue;
                ok = true;
                now = i;
                ans.pb(now);
                seen[now] = true;
                break;
            }
            if(!ok) break;
        }
        reverse(all(ans));
    }
    cout << ans.size() << '\n';
    for(int i : ans) cout << i+1 << ' ';
    cout << '\n';
}


Measured memory_bytes: 9308
from collections import defaultdict


def main():
    s = input()
    ans = ""
    for c in s:
        if c in ["0", "1"]:
            ans += c
        elif c == "B" and len(ans) > 0:
            ans = ans[:len(ans) - 1]
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n);
	
	printf("%s\n", (n >= 30 ? "Yes" : "No"));
	return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh
int a[2][230];
//int t[100005] , x[100005] , y[100005];
int main(){
	dhoom;
	int n;
	cin >> n;
	ll ans = 0;
	for(int i = 1 ; i <= n ;i++){
		if(i%3 != 0 && i%5 != 0)
			ans += i;
	}
	cout << ans << endl;
	return 0;
}


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

#define ff first
#define ss second
#define PI acos(-1)
#define pb push_back
#define int long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int M = (1e9)+7;
const int N = 1e6+5;

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        int st,en;
        int h1,m1,h2,m2,x;
        cin>>h1>>m1>>h2>>m2>>x;
        st = h1*60 + m1;
        en = h2*60 + m2;
        en -= x;
        cout<<en-st<<endl;
    }
    return 0;
}


Measured memory_bytes: 3652
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int a;
    cin >> a;
    int ans=0;
    rep(i,a){
        int m;
        cin >> m;
        ans+=(m-1);
    }

    cout << ans;

    return 0;
}

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

int main(void){
  int h,w;
  while(1){
    cin >> h >> w;
    if(h==0 && w==0) break;
    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
        if(i==0 || i==h-1 || j==0 || j==w-1){
          printf("#");
        }else{
          printf(".");
        }
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}



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


signed main(){
    int n,k, ans=0;
    cin>>n>>k;
    vector<int> arr(n);
    for(int &x: arr) cin>>x;
    sort(arr.begin(), arr.end());
    for(int i=0; i<k; i++) ans+= arr[i];
    cout<<ans<<endl;
}

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

int main()
{
    int n;
    cin >> n;
    int t[n] = {};
    int sum = 0;
    for(int i=0; i<n; i++){
        cin >> t[i];
        sum += t[i];
    }
    
    int m;
    cin >> m;
    for(int i=0; i<m; i++){
        int p, x;
        cin >> p >> x;
        p--;
        cout << sum - t[p] + x << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
s = 0
mod = 10**9+7
asum = 0
for i in a:
    asum += i % mod
for i in range(n-1):
    s += ((a[i]%mod)*(asum-(a[i]%mod)))%mod
    asum = asum-(a[i]%mod)
s %= mod
print(str(s))


Measured memory_bytes: 31588
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
typedef long long int64;
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
struct Edge {
	int to;
	int id;
};
vector<vector<Edge>> g;
vector<int> ans;

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void dfs(int q, int c = -1, int p = -1) {
	int k = 1;
	rep (i, g[q].size()) {
		int u = g[q][i].to; int ei = g[q][i].id;
		if (u == p) continue;
		if (k == c) ++k;
		ans[ei] = k; k++;
		dfs(u, ans[ei], q);
	}
	return;
}

void solve() {
		int n; cin >> n;
		ans = vector<int>(n - 1);
		g.resize(n);
		rep (i, n - 1) {
			int a, b; cin >> a >> b;
			a--;
			b--;
			g[a].push_back({b, i});
			g[b].push_back({a, i});
		}
		dfs(0);
		int mc = -1;
		rep (i, ans.size()) {
			mc = max(mc, ans[i]);
		}
		cout << mc << endl;
		rep (i, ans.size()) {
			cout << ans[i] << endl;
		}
    return;
}

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



Measured memory_bytes: 8320
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

const int mod = 1000000007;
class mint {
    long long x;
public:
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { 
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }
 
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};
 
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(200010);

int main(){
    ll N,K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i,N){
        cin >> A[i];
    }
    if(K == 1){
        cout << 0 << endl;
        return 0;
    }
    sort(A.begin(), A.end());
    vector<ll> dp(N+1);
    mint MS=0,ms=0;
    for(ll i=N-1;i>=0;i--){
        MS += (mint(A[i])*comb(i,K-1));
    }
    rep(i,N){
        ms += mint(A[i])*comb(N-i-1,K-1);
    }
    cout << MS-ms << endl;
    /*REP(i,K-1,N){
        dp[i+1] += dp[i];
        dp[i+1] += (A[i] - A[i-1])*comb(i,K-1);

    }*/
    /*rep(i,N-K+1){
        REP(j,i+K-1,N){
            A[];
        }        
    }*/

}

Measured memory_bytes: 8012
#include <stdio.h>

int main(){
  int n;
  scanf("%d", &n);
  if(n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8) puts("pon");
  else if(n % 10 == 3) puts("bon");
  else puts("hon");
  return 0;
}

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

using namespace std;
using namespace __gnu_pbds;

typedef long long lint;

template<typename Key, typename Value>
using hash_map = cc_hash_table<Key, Value>;

const int INF = 0x3f3f3f3f;
const lint INFL = 0x3f3f3f3f3f3f3f3fLL;

template<typename T, typename U> void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> void amax(T &x, U y) { if (x < y) x = y; }

const int MOD = 1000000007;

bool solve(int testNumber) {
	int n;
	if (!(cin >> n)) return false;
	vector<string> S(2);
	for (string &str: S) cin >> str;
	vector<bool> hor;
	for (int i = 0; i < n; i++) {
		if (S[0][i] == S[1][i]) hor.push_back(false);
		else {
			hor.push_back(true);
			i++;
		}
	}
	n = hor.size();
	vector<int> dp(n + 1);
	dp[0] = 1;
	for (int i = 1; i <= n; i++) {
		bool h = hor[i - 1], hh = i > 1 ? hor[i - 2] : false;
		int mul;
		if (h) {
			if (i == 1) mul = 6;
			else if (hh) mul = 3;
			else mul = 2;
		} else {
			if (i == 1) mul = 3;
			else if (hh) mul = 1;
			else mul = 2;
		}
		dp[i] = (lint)dp[i - 1] * mul % MOD;
	}
	int ans = dp.back();
	printf("%d\n", ans);
	return true;
}

void init(const char *in = nullptr, const char *out = nullptr) {
	if (in) freopen(in, "r", stdin);
	if (out) freopen(out, "w", stdout);
}

int main() {
	ios_base :: sync_with_stdio(false);
	cin.tie(nullptr);
	init();
	for (int i=1; solve(i); i++);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;

int main() {
	int n, m; cin >> n >> m;
	vector<int> a(m, 0);
	rep(i, n) {
		int k; cin >> k;
		for (int j = 0; j < k; ++j) {
			int idx;
			cin >> idx;
			--idx;
			++a[idx];
		}
	}
	int ans = 0;
	rep(i, m) {
		if (a[i] == n) ++ans;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
A = sorted(list(map(int, input().split())))
F = sorted(list(map(int, input().split())))[::-1]
def is_time(x):
  c = 0
  for i in range(n):
    c += max(0, A[i] - x//F[i])
  if c <= k:
    return True
  return False
ng = -1
ok = 0
for i in range(n):
  ok = max(ok, A[i]*F[i])
while ok - ng > 1:
  m = (ng + ok)//2
  if is_time(m):
    ok = m
  else:
    ng = m
print(ok)

Measured memory_bytes: 122572
N,K = map(int,input().split())
G = [list(map(int,input().split())) for _ in range(N)]
#print(G)
MOD = 10**9+7

def dot(a,b):
  res = [[0] * N for _ in range(N)]
  for i in range(N):
    for j in range(N):
      res[i][j] = sum(a[i][k] * b[k][j] for k in range(N)) % MOD
  return res

ans = [[0] * N for _ in range(N)]
for i in range(N):
  ans[i][i] = 1

while(K>0):
  K,x = divmod(K,2)
  if x == 1:
    ans = dot(ans,G)
  G = dot(G,G)
print(sum(sum(a) % MOD for a in ans) % MOD)

Measured memory_bytes: 73436
import java.util.Scanner;


public class Main{

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String ans = "YES";
		String A = reader.next();
		String B = reader.next();
		String C = reader.next();
		char a1 = A.charAt(A.length()-1);
		char b1 = B.charAt(0);
		char b2 = B.charAt(B.length()-1);
		char c1 = C.charAt(0);
		if (a1 != b1 || b2 != c1) {
			ans = "NO";
		}



		System.out.println(ans);
		reader.close();

	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define RFOR(i, a, b) for(int i = a; i >= b; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
const int INF = 1e9;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
int main() {
    int n, m;
    cin >> n >> m;
    vi broken(n+1);
    REP(i, m) {
        int a;
        cin >> a;
        broken[a] = 1;
    }
    vi dp(n+2);
    dp[n] = 1;
    const int mod = 1000000007;
    RFOR(i, n-1, 0) {
        if(broken[i]) {
            dp[i] = 0;
            continue;
        }
        dp[i] = (dp[i+1] + dp[i+2]) % mod;
    }
    cout << dp[0] << endl;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

#define MAX_H 22
#define MAX_W 22

int W, H, X, Y, A;

char tile[MAX_H][MAX_W];

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

void dfs(int x, int y)
{
	tile[y][x] = '@';

	for (int i = 0; i < 4; i++)
	{
		if (0 <= x + dx[i] && x + dx[i] <= W - 1 && 0 <= y + dy[i] && y + dy[i] <= H - 1)
		{
			if (tile[y + dy[i]][x + dx[i]] == '.')
			{
				dfs(x + dx[i], y + dy[i]);
			}
		}
	}
}

int main()
{
	while (true)
	{
		cin >> W >> H;

		if (W == 0 && H == 0) { break; }

		for (int i = 0; i < H; i++)
		{
			for (int j = 0; j < W; j++)
			{
				cin >> tile[i][j];

				if (tile[i][j] == '@')
				{
					X = j;
					Y = i;
				}
			}
		}

		dfs(X, Y);

		A = 0;

		for (int i = 0; i < H; i++)
		{
			for (int j = 0; j < W; j++)
			{
				if (tile[i][j] == '@')
				{
					A++;
				}
			}
		}

		cout << A << endl;
	}

	return 0;
}

Measured memory_bytes: 1168
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/
ll n;
int main(){FAST;
  cin>>n;
  long double p = 1.01;
  ll am = 100;
for(ll i=1;i<=1000000;++i){
  am = (long double)am*p;
  if(am>=n){
    cout<<i;
    return 0;
  }
}
return 0;
}

/*
 WA? check edge cases, N=1,M=1 etc. Read code fully once and check all variables.
 Read the question again and see what you might have missed.
 Consider changing your solution or find more cases.
 */


Measured memory_bytes: 3652
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val m = sc.nextInt()
  val c = sc.nextInt()
  val b = (1..m).map { sc.nextInt() }
  val anm = mutableListOf<List<Int>>()
  for (i in 0 until n) {
    val ai = (1..m).map { sc.nextInt() }
    anm.add(ai)
  }
  println(abc121b(n, m, c, b, anm))
}

private fun abc121b(n: Int, m: Int, c: Int, b: List<Int>, anm: List<List<Int>>): Int {
  var count = 0
  for (ai in anm) {
    var sum = 0
    for (j in 0 until m) {
      sum += ai.get(j) * b.get(j)

    }
    sum += c
    if (sum > 0) count++
  }

  return count
}


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

int main(void)
{
  int N;
  cin >> N;
  int *A;
  int *B;
  int *C;

  A = (int *)malloc(sizeof(int)*N);
  B = (int *)malloc(sizeof(int)*N);
  C = (int *)malloc(sizeof(int)*N);

  int i;
  for (i=0;i<N;i++){
    cin >> A[i];
    A[i] -= 1;
  }
  for (i=0;i<N;i++){
    cin >> B[i];
  }
  for (i=0;i<N-1;i++){
    cin >> C[i];
  }

  int ans = 0;
  ans += B[A[0]];

  for (i=1;i<N;i++){
    ans += B[A[i]];
    if (A[i] == A[i-1]+1){
      ans += C[A[i-1]];
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,b,e) for(int i=b;i<e;i++)
using ll = int_fast64_t;
const ll MOD = 1e9+7;

int main(){
        int n;
        scanf("%d", &n);

        char s[n+1], t[n+1];
        scanf("%s %s", s, t);

        ll alp[26] = {};
        alp[s[0]-'a'] = 1;
        REP(i, 1, n-1){
                alp[s[i]-'a'] += alp[t[i]-'a'];
                alp[s[i]-'a'] %= MOD;
        }

        printf("%ld\n", alp[t[n-1]-'a']);
        return 0;
}


Measured memory_bytes: 3368
<?php

$arr = explode(' ', fgets(STDIN));

foreach ($arr as $key => $value) {
  $arr[$key] = intval($value);
}

$arr_count = count($arr);
$count = 0;

for ($i = 0; $i < $arr_count; $i++) {
  for ($j = $i + 1; $j < $arr_count; $j++) {
    if ($arr[$i] === $arr[$j]) {
      $count++;
    }
  }
}
if ($arr_count - $count === 0) {
  echo 1;
} else {
  echo $arr_count - $count;
}
?>

Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,j,sum=0;
	cin>>n;
	for(long long i=1;i<=n-1;i++)
	{
		if(n%i==0)
		sum+=n/i-1;
		else
		sum+=n/i;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
const int M=2e5+50;
struct Node{int l,r,v,s;}t[M<<2];
int n,q,head[M<<1],cnt=1,tot,siz[M],res[M],id[M],rk[M];
struct node{int to,nex;}e[M<<1];
void add(int x,int to){
    e[cnt].to=to;
    e[cnt].nex=head[x];
    head[x]=cnt++;
}
void dfs(int x,int fa){
    id[x]=++tot;
    rk[tot]=x;
    siz[x]=1;
//    cout<<x<<endl;
    for(int i=head[x];~i;i=e[i].nex){
        if(e[i].to==fa)continue;
        dfs(e[i].to,x);
        siz[x]+=siz[e[i].to];
    }
}
void build(int k,int l,int r){
    t[k].l=l;t[k].r=r;t[k].s=t[k].v=0;
    if(l==r)return ;
    int mid=(l+r)>>1;
    build(k*2,l,mid);
    build(k*2+1,mid+1,r);
}
void down(int k){
    if(t[k].s){
        t[k*2].s+=t[k].s;
        t[k*2].v+=t[k].s;
        t[k*2+1].s+=t[k].s;
        t[k*2+1].v+=t[k].s;
        t[k].s=0;
    }
}
void update(int k,int l,int r,int v){
    if(l<=t[k].l&&t[k].r<=r){
        t[k].s+=v;
        t[k].v+=v;
        return ;
    }
    down(k);
    int mid=(t[k].l+t[k].r)>>1;
    if(l<=mid)update(k*2,l,r,v);
    if(mid<r)update(k*2+1,l,r,v);
}
void ask(int k){
    if(t[k].l==t[k].r){
        res[rk[t[k].l]]=t[k].v;
        return ;
    }
    down(k);
    ask(k*2);
    ask(k*2+1);
}
int main(){
    memset(head,-1,sizeof(head));
    scanf("%d%d",&n,&q);
    for(int x,y,i=1;i<n;i++){
        scanf("%d%d",&x,&y);
        add(x,y);add(y,x);
    }
//    for(int x=1;x<=n;x++){
//        cout<<x<<" :";
//        for(int i=head[x];~i;i=e[i].nex)cout<<e[i].to<<" ";cout<<endl;
//    }
    dfs(1,0);
//    for(int i=1;i<=n;i++)cout<<rk[i]<<" ";cout<<endl;
    build(1,1,n);
//    for(int i=1;i<=15;i++)cout<<t[i].l<<" "<<t[i].r<<" "<<t[i].s<<" "<<t[i].v<<endl;
    int x,y;
    while(q--){
        scanf("%d%d",&x,&y);
        update(1,id[x],id[x]+siz[x]-1,y);
    }
    ask(1);
    for(int i=1;i<=n;i++)cout<<res[i]<<" ";
    return 0;
}




Measured memory_bytes: 28160
//hinagata.cpp
//作成日
//更新日
//目的
//手段
/*includes*/
#include <bits/stdc++.h>
/*namespace*/
using namespace std;
using ll= long long;
/*define macro*/
#define REP(i,n) for(ll i=0;i<(n);i++)
#define REPi(i,a,b) for(ll i=(a);i<(b);i++)
#define REPRi(i,a,b) for(ll i=(a);i>(b);i--)
#define ALL(x) (x).begin(),(x).end()

int main(){
    ll N,K;
    cin>>N>>K;
    ll count=0;
    ll kon=K;
    while(1){
            if(N-N%kon>0){
                N-=N%kon;
                count+=1;
                kon*=K;

            }else{
                count+=1;
                break;
            }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 384
h,w = map(int,input().split())
C = [list(input()) for i in range(h)]

queue = []
visited = [] 
visited = [[0 for i in range(w)] for i in range(h)]
ans = 0

for i in range(h):
    for j in range(w):
        if C[i][j] == '.':
            queue.append([i,j])
            visited[i][j] = 1

            dy_dx = [[1,0],[0,1],[-1,0],[0,-1]]

            while len(queue) > 0:
                now = queue.pop(0)
                for k in range(4):
                    y = now[0]+dy_dx[k][0]
                    x = now[1]+dy_dx[k][1]
                    if 0 <= y < h and 0 <= x < w:
                        if C[y][x] != '#' and visited[y][x] == 0:
                            visited[y][x] = visited[now[0]][now[1]]+1 #移動回数のカウント
                            queue.append([y,x])
                    
        for l in range(h):
            for m in range(w):
                ans = max(ans,visited[l][m])
            
        queue = []
        visited = [[0 for i in range(w)] for i in range(h)]              
        
print(ans-1)

Measured memory_bytes: 73952
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  char a, b;
  cin >> a >> b;
  if(a == 'H') cout << b << endl;
  else cout << (char)('H' + 'D' - b) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>

using namespace std;

const long long p=1000000007ll;
long long f[3001][3001];
int n,m;

long long dp(int n,int m){
    memset(f,0,sizeof(f));
    for(int i=0;i<=n;++i)f[0][i]=1ll;
    for(int i=1;i<=m;++i)for(int j=0;j<=n;++j){if(j)(f[i][j]+=f[i-1][j]+f[i-1][j-1])%=p;if(j<n)(f[i][j]+=f[i-1][j]+f[i-1][j+1])%=p;}
    long long res=0ll;for(int i=0;i<=n;++i)(res+=f[m][i])%=p;return res;
}

int main(){
    scanf("%d%d",&n,&m);
    printf("%lld",(dp(n,m)-dp(n-1,m)+p)%p);
}

Measured memory_bytes: 70656
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def isp(S):
    m = len(S)
    flag = True
    for i in range(m//2):
        if S[i] != S[m-i-1]:
            flag = False
    return flag


def solve(S: str):
    n = len(S)
    if isp(S) and isp(S[:(n-1)//2]) and isp(S[(n+1)//2:]):
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


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

int main() {
    string s;
    cin >> s;
    int n=0;

    for (int i = 0; i < 4; i++) {
        if (s[i] == '+') {
            n++;
        } else {
            n--;
        }
    }

    cout << n;
}

Measured memory_bytes: 256
N = int(input())
S = input()
L = len(S)
S = list(S)
for i in range(L):
    for j in range(N):
        if S[i] != 'Z':
            S[i] = chr(ord(S[i])+1)
        else:
            S[i] = 'A'
print("".join(S))

Measured memory_bytes: 40048
#include <iostream>
using namespace std;
int main(void){
   int a=0,b=0,n;
   string A,B;
   cin>>n;
   for(int i=0;i<n;i++){
       cin>>A>>B;
       if(A==B){
           a++;
           b++;
       }
       else if(A>B) a+=3;
       else b+=3;
   }
   cout<<a<<" "<<b<<endl;
  
   }


Measured memory_bytes: 3220