akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main {
        public static void main(String args[]) {
                try (Scanner sc = new Scanner(System.in)) {
                        while (true) {
                                String S = sc.next();
                                if (S.equals("0")) {
                                        break;
                                }
                                long ans = 0;
                                for (int i = 0; i < S.length(); i++) {
                                        ans += S.charAt(i) - '0';
                                }
                                System.out.println(ans);
                        }
                }
        }
}

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

int main() {
    int64_t N;
    cin >> N;
    map<int64_t, int64_t> num;
    for (int64_t i = 0; i < N; i++) {
        int64_t A;
        cin >> A;
        num[A]++;
    }

    bool ok = true;
    for (auto& p : num) {
        if (p.second >= 2) {
            ok = false;
        }
    }

    cout << (ok ? "YES" : "NO") << endl;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
	int N, Q;
	string s;
	cin >> N >> s >> Q;
	vector<set<int>> st(26);
	for (int i = 0; i < N; ++i) {
		st[(int)(s[i] - 'a')].insert(i);
	}
	for (int i = 0; i < 26; ++i) {
		st[i].insert(N);
	}

	vector<int> ans;
	for (int q = 0; q < Q; ++q) {
		int t;
		cin >> t;
		if (t == 1) {
			int idx;
			char c;
			cin >> idx >> c;
			--idx;
			for (int i = 0; i < 26; ++i) {
				if (st[i].count(idx) > 0) {
					st[i].erase(idx);
				}
				if (i == (int)(c - 'a')) {
					st[i].insert(idx);
				}
			}
		} else {
			int l, r;
			cin >> l >> r;
			--l;
			int cnt = 0;
			for (int i = 0; i < 26; ++i) {
				cnt += *st[i].lower_bound(l) < r;
			}
			ans.emplace_back(cnt);
		}
	}
	for (int val : ans) { cout << val << endl; }

	return 0;
}


Measured memory_bytes: 25476
#include <vector>
#include <iostream>
using namespace std;
int binpow(unsigned long long a, unsigned long long b, int m) {
	// returns a^b mod m
	a %= m;
	int ans = 1;
	while (b > 0) {
		if (b & 1) ans = 1LL * ans * a % m;
		a = 1LL * a * a % m;
		b >>= 1;
	}
	return ans;
}
int binpow2(unsigned long long a, unsigned long long b, int m) {
	// returns a^0 + a^1 + a^2 + ... + a^(b-1) mod m
	a %= m;
	if (b == 0) return 0;
	if (b & 1) return (1LL * binpow2(a, b - 1, m) * a + 1) % m;
	return 1LL * binpow2(a, b / 2, m) * (binpow(a, b / 2, m) + 1) % m;
}
int binpow3(unsigned long long a, unsigned long long b, int m) {
	// return a^0 * 0 + a^1 * 1 + a^2 * 2 + ... + a^(b-1) * (b-1)
	a %= m;
	if (b == 0) return 0;
	if (b & 1) return (binpow3(a, b - 1, m) + 1LL * binpow(a, b - 1, m) * ((b - 1) % m)) % m;
	int r1 = binpow(a, b / 2, m);
	int r2 = binpow2(a, b / 2, m);
	int r3 = binpow3(a, b / 2, m);
	return (1LL * r3 * (r1 + 1) + 1LL * r2 * ((b / 2) % m) % m * r1) % m;
}
int main() {
	long long L, A, B; int M;
	cin >> L >> A >> B >> M;
	const int max_digits = 18;
	unsigned long long mult = 1;
	for (int i = 0; i < max_digits; ++i) {
		mult *= 10;
	}
	int ans = 0; unsigned long long curlen = 0;
	for (int i = max_digits; i >= 1; --i) {
		mult /= 10;
		long long pl = (mult < A ? 0 : (mult - A + B - 1) / B);
		long long pr = (mult * 10 < A ? 0 : (mult * 10 - A + B - 1) / B);
		if (pl > L) pl = L;
		if (pr > L) pr = L;
		if (pl == pr) continue;
		unsigned long long nlen = pr - pl;
		int bs = (mult * 10) % M;
		int c2 = binpow2(bs, nlen, M);
		int c3 = binpow3(bs, nlen, M);
		int sub = int(1LL * c2 * ((A + ((pr - 1) % M) * (B % M)) % M) % M) - int(1LL * c3 * (B % M) % M);
		if (sub < 0) sub += M;
		ans = (ans + 1LL * sub * binpow(10, curlen, M)) % M;
		if (ans >= M) ans -= M;
		curlen += nlen * (unsigned long long)(i);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
const ll mod = 1e9+7;

int main(){
  ll h, w, k;
  cin >> h >> w >> k;
  k--;
  vector<vector<ll>> dp(h+1,vector<ll>(w,0));
  dp[0][0] = 1;
  rep(i,h) {
    rep(j,w) {
      rep(k,1<<(w-1)) {
        bool can = true;
        rep(l,w-2) {
          if((k&(1<<l)) && (k&(1<<(l+1)))) can = false;
        }
        if(can) {
          if(j-1 >= 0 && (k&(1<<(j-1)))) (dp[i+1][j] += dp[i][j-1]) %= mod;
          if(j < w-1 && (k&(1<<j))) (dp[i+1][j] += dp[i][j+1]) %= mod;
          if(!(k&(1<<j)) && !(k&(1<<(j-1)))) (dp[i+1][j] += dp[i][j]) %= mod;
        }
      }
    }
  }
  cout << dp[h][k] << endl;
  return 0;
}

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

constexpr size_t DENOM = 1'000'000'007;

std::vector<size_t> binominal(size_t n, size_t r) {
    std::vector<size_t> v(r + 1, 0);
    v[0] = 1;

    for (size_t i = 1; i <= n; ++i) {
        for (size_t j = r; j > 0; --j) {
            v[j] += v[j - 1];
            if (v[j] > DENOM) v[j] = v[j] % DENOM;
        }
    }

    return v;
}

int main() {
    size_t n, k;
    std::cin >> n >> k;

    const auto c1 = binominal(n - k + 1, k);
    const auto c2 = binominal(k - 1, k - 1);

    for (size_t i = 1; i <= k; ++i)
        std::cout << (c1[i]*c2[i-1] % DENOM) << std::endl;
}

Measured memory_bytes: 256
//実装が重そうな問題はある程度考えてから書く
//初期化を忘れずに（特に二分探索とか）
//コーナーケースを考えて（特に場合分けとか）
//不可解すぎるバグは配列外参照（配列の長さ）を検討
#include "bits/stdc++.h"
#define YES "YES"
#define NO "NO"
#define YESNO OUT(three(solve(),YES,NO))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(a);i>=(LL)(b);i--)
#define REP(i,b) FOR(i,zero,b)
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,b-1,zero)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB emplace_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define int long long
#define zero 0LL
#define pb PB
using namespace std;
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr, Vpr ,greater<pr> > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
int dx[] = { 0,1,0,-1,0 }, dy[] = { 1,0,-1,0,0 };
const int SIZE1 =3e5 + 1000;
const int SIZE2 = 5010;
const int SIZE3 = 22;
const int SIZE = SIZE1;
const LL p = 7 + 1e9;
const LL INF = 1LL << 60;
const long double EPS = 1e-7;
ut N, M, K, X, L, Y,H,W,Q;
// ut A,B,C,D,E,F,G,H,I,J,O,P,Q,R,T,U;
VI edges[SIZE];
LL vals[SIZE], nums[SIZE], maps[SIZE3][SIZE3], answer = zero;
LL A[SIZE], B[SIZE];
LL ans[10][10][10][10];
bool able[10][10];
LL solve2(int i,int j,int k,int l) {
	EFOR(a, i, k) EFOR(b, j, l)
		if (able[a][b]) ans[i][j][k][l] += 1;
	return 0;
}
LL solve() {
	LL q;
	cin >> q;
	EFOR(i, 1, 8) EFOR(j, 1, 8) {
		if (i % 2 != 1 or j % 2 != 0) {
			able[i][j] = 1;
		}
	}
	EFOR(i, 1, 8) EFOR(j, 1, 8) EFOR(k, i, 8) EFOR(l, j, 8) solve2(i,j,k,l);
	REP(i, q) {
		LL a, b, c, d;
		cin >> a >> b >> c >> d;
		cout << ans[a][b][c][d] << endl;
	}

	return 0;
}
signed main() {
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(10);

	solve();
//	cin >> N;
	return 0;
}


Measured memory_bytes: 10308
#include<iostream>
#include<set>
using namespace std;
int main(){
  int N;
  cin >> N;
  int a[N] = {};
  for(int i=0; i<N; i++) cin >> a[i];

  int flag = 0;
  int counter = 1;
  for(int i=0; i<N-1; i++){
    if(flag == 0 && a[i+1]-a[i] > 0) flag = 1;
    if(flag == 0 && a[i+1]-a[i] < 0) flag = -1;
    if(flag == 1){
      if(a[i+1]-a[i] < 0){
        counter++;
        flag = 0;
      }
    }
    if(flag == -1){
      if(a[i+1]-a[i] > 0){
        counter++;
        flag = 0;
      }
    }
  }
  cout << counter << endl;
  return 0;
}

Measured memory_bytes: 640
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;

// ====================================================================

int main() {
  int n;
  cin >> n;
  vector<double> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }

  double dp[n + 1][n + 1];  // i枚目まで投げた時、j枚が裏を向く確率
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= n; j++) {
      dp[i][j] = 0;
    }
  }

  dp[0][0] = v[0];
  dp[0][1] = 1 - v[0];
  for (int i = 1; i < n; i++) dp[i][0] = dp[i - 1][0] * v[i];

  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= n; j++) {
      dp[i][j] = dp[i - 1][j - 1] * (1 - v[i]) + dp[i - 1][j] * v[i];
    }
  }

  double ans = 0;
  for (int i = 0; i < (n + 1) / 2; i++) {
    ans += dp[n - 1][i];
  }

  printf("%.10f\n", ans);
}


Measured memory_bytes: 70528
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
VVI dps;
VI indg;
VI pr;
queue<in> q;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in n;
  cin>>n;
  pr.resize(n);
  indg.resize(n);
  dps.resize(n);
  forn(i,n-1){
    cin>>pr[i+1];
    --pr[i+1];
    ++indg[pr[i+1]];
  }
  forn(i,n){
    if(indg[i]==0)
      q.push(i);
  }
  in u;
  while(!q.empty()){
    u=q.front();
    q.pop();
    sort(all(dps[u]));
    reverse(all(dps[u]));
    in mx=0;
    forv(i,dps[u])
      mx=max(mx,i+dps[u][i]+1);
    if(u==0){
      cout<<mx<<endl;
      return 0;
    }
    dps[pr[u]].PB(mx);
    --indg[pr[u]];
    if(indg[pr[u]]==0)
      q.push(pr[u]);
  }
  return 0;
}


Measured memory_bytes: 7296
#include <iostream>
#include <math.h>
#include <string>
using namespace std;





int main()
{
	string S;
	int i;

	cin >> S;

	for (i = 0; i < 3; i++) {
		if (S[i] == 'A' && S[i + 1] == 'C')	{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;

    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;

namespace bit
{
	int dat[345678];
	int siz;
	void init(int n_)
	{
		siz = 1;
		while (siz < n_)
		{
			siz <<= 1;
		}
	}
	void add(int x,int val)
	{
		while (x <= siz)
		{
			dat[x] += val;
			x += (x & -x);
		}
	}
	int query(int r)
	{
		//[1,r]
		int ret = 0;
		while (r > 0)
		{
			ret += dat[r];
			r -= (r & -r);
		}
		return ret;
	}
}

int main(void)
{
	int n, m;
	cin >> n >> m;
	bit::init(m + 2);
	vector<pair<int, int>>vec;//first=width second=left
	for (int i = 0; i < n; ++i)
	{
		int l, r;
		cin >> l >> r;
		vec.emplace_back(r - l + 1, l);
	}
	sort(vec.begin(), vec.end());
	int cash = n;
	for (int d = 1; d <= m; ++d)
	{
		int ans = cash;
		for (int index = 0; index <= m; index += d)
		{
			ans += (bit::query(index + 1));
		}
		cout << ans << endl;
		for (auto i = lower_bound(vec.begin(), vec.end(), make_pair(d, 0)); i != lower_bound(vec.begin(), vec.end(), make_pair(d + 1, 0)); ++i)
		{
			int width = i->first;
			int left = i->second;
			bit::add(left + 1,1);
			bit::add(left + width + 1, -1);
			cash--;
		}
	}
	return 0;
}


Measured memory_bytes: 4464
import sys
from io import StringIO
import unittest
import math


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """1"""
        output = """6.28318530717958623200"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """73"""
        output = """458.67252742410977361942"""
        self.assertIO(input, output)


def resolve():
    r = read()
    result = think(r)
    write(result)


def read():
    return read_int(1)[0]


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(data):
    return 2 * data * math.pi


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    resolve()


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


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

	int n;
	cin>>n;
	int a,b;
	cin>>a>>b;
	vector<int> p(n);
	int cnt1=0,cnt2=0,cnt3=0;
	for(int i=0;i<n;i++){
		cin>>p[i];
		if(p[i]<=a) cnt1++;
		if( p[i]>=(a+1) && p[i]<=b) cnt2++;
		if( p[i]>=(b+1) ) cnt3++;
	}
	int m=min(cnt1,min(cnt2,cnt3));
	cout<<m<<endl;
	return 0;

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int v[105];
int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    v[a] ++;
    v[b] --;
    v[c] ++;
    v[d] --;
    int ans = 0;
    for(int i = 0; i <= 102; ++i){
        v[i] += v[i-1];
        if(v[i] == 2){
            ++ans;
        }
    }

    cout << ans;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int asc(const void *a, const void *b) {
  long long *A = (long long *)a;
  long long *B = (long long *)b;
  if (*A > *B) return 1;
  if (*A < *B) return -1;
  return 0;
}


int main(void){
    long long int n, i, j, min, ans=0;
    scanf("%lld", &n);
    long long int d[n];
    for(i=0; i<n; i++) scanf("%lld", &d[i]);

    qsort(d, sizeof(d)/sizeof(long long int), sizeof(long long int), asc);
    printf("%lld", d[n/2]-d[n/2-1]);
}

Measured memory_bytes: 1788
# prd様のコードを参考にしました
# https://atcoder.jp/contests/abc091/submissions/3282677

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ans = 0
for k in range(30):
    T = 2 ** k
    A_mod = sorted([a % (2 * T) for a in A])
    B_mod = sorted([b % (2 * T) for b in B])

    tmp = 0

    r1, r2, r3 = 0, 0, 0
    for a in reversed(A_mod):
        # k-bit目が立つ条件 -> [T, 2T), [3T, 4T)の間にai + bj がある
        # しゃくとりっぽいやつ
        # rを毎回初期化すれば小さいほうからaを見てもできるけど、同じ区間を何回も見ることになってしゃくとりにならずTLEする
        while r1 < N and a + B_mod[r1] < T:
            r1 += 1
        while r2 < N and a + B_mod[r2] < 2 * T:
            r2 += 1
        while r3 < N and a + B_mod[r3] < 3 * T:
            r3 += 1

        # 差をとると、[T, 2T), [3T, 4T)の間に入っっている数が手に入る
        tmp += (r2 - r1) + (N - r3)

    if tmp % 2 == 1:
        ans += T

print(ans)


Measured memory_bytes: 144416
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int N = sc.nextInt();
        int[] A = new int[N];
        for(int i = 0; i < N; i++){
            A[i] = sc.nextInt();
        }
        int[] distance = new int[N];
        for(int i = 0; i < N-1; i++){
            distance[i] = A[i+1] - A[i];
        }
        distance[N-1] = K-A[N-1] + A[0];
        int all = 0;
        int min = Integer.MAX_VALUE;
        int count = 0;
        for(int i = 0; i < N; i++){
            all = all + distance[i];
        }
        for(int i = 0; i < N; i++){
            count = all - distance[i];
            if(min > count) min = count;
        }
        System.out.println(min);
    }
}

Measured memory_bytes: 82596
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        String[] num = str.split(" ",0);
        int a,b;

        a = Integer.valueOf(num[0]);
        b = Integer.valueOf(num[1]);

        if(a>b){
            System.out.println("a > b");
        }else if(b>a){
            System.out.println("a < b");
        }else{
            System.out.println("a == b");
        }
        scan.close();
    }
}



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


public class Main {
    static int n,A,B,C,D;
    static char[] s;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        //BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        //String[] buf = reader.readLine().split(" ");
        n = sc.nextInt(); A = sc.nextInt()-1;
        B = sc.nextInt()-1; C = sc.nextInt()-1; D = sc.nextInt()-1;
        s = sc.next().toCharArray();
        String ans = help()?"Yes":"No";
        System.out.println(ans);
    }
    static boolean help(){
        if(C<B&&B<D){ //A<C<B<D
            return check(A,C)&&check(B,D);
        } else if(B<C&&C<D){
            return check(B,D)&&check(A,C);
        } else{ // A<B<D<C
            if(!check(A,C)||!check(B,D)) return false;
            for(int i=B;i<=D;i++){
                if(s[i-1]!='#'&&s[i]!='#'&&s[i+1]!='#') return true;
            }
            return false;
        }
    }
    static boolean check(int start, int end){
        boolean[] dp = new boolean[n];
        dp[start] = true;
        for(int i=start+1;i<=end;i++){
            if(s[i]=='#') continue;
            dp[i] |= dp[i-1];
            if(i>=start+2) dp[i] |= dp[i-2];
        }
        return dp[end];
    }
}



Measured memory_bytes: 26652
S = input()
N = len(S)
l = []
p = 0
while True:
  i = S.find("L", p)
  i2 = S.find("R", i)
  if i2 < 0:
    i2 = N
  l.append((i-p, i2-i))
  if i2 == N:
    break
  p = i2
#print(l)
Cs = []
for n, m in l:
  for i in range(n-1):
    Cs.append(0)
  a = (n+m)//2
  b = (n+m)-a
  if n%2 == 0:
    Cs.append(a)
    Cs.append(b)
  else:
    Cs.append(b)
    Cs.append(a)
  for i in range(m-1):
    Cs.append(0)
print(" ".join(map(str, Cs)))


Measured memory_bytes: 14068
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		String[] inputMap = new String[h];
		String[] outputMap = new String[h];
		String word = sc.nextLine();

		for (int i = 0; i < h; i++) {
			inputMap[i] = sc.nextLine();
		}
		for (int i = 0; i < h; i++) {
			String outputLine = "";
			for (int j = 0; j < w; j++) {
				if (inputMap[i].substring(j, j + 1).equals(".")) {
					outputLine += getCountOfBomb(inputMap, i, j, h, w);
				} else {
					outputLine += "#";
				}
			}
			outputMap[i] = outputLine;
			System.out.println(outputLine);
		}
	}

	public static int getCountOfBomb(String[] map, int y, int x, int height, int width) {
		int count = 0;
		if (isThereBomb(map, y-1, x-1, height, width)) {
			count++;
		}
		if (isThereBomb(map, y-1, x, height, width)) {
			count++;
		}
		if (isThereBomb(map, y-1, x+1, height, width)) {
			count++;
		}
		if (isThereBomb(map, y, x-1, height, width)) {
			count++;
		}
		if (isThereBomb(map, y, x+1, height, width)) {
			count++;
		}
		if (isThereBomb(map, y+1, x-1, height, width)) {
			count++;
		}
		if (isThereBomb(map, y+1, x, height, width)) {
			count++;
		}
		if (isThereBomb(map, y+1, x+1, height, width)) {
			count++;
		}
		return count;
	}

	public static boolean isThereBomb(String[] map, int y, int x, int height, int width) {
		if (x >= 0 && x < width && y >= 0 && y < height) {
			return map[y].substring(x, x + 1).equals("#");
		} else {
			return false;
		}
	}

}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define SIZE 100005
#define MOD 1000000007
using namespace std;
typedef long long int ll;

int A[SIZE];
ll cnt[SIZE];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&A[i]);
	cnt[0]=3;
	ll ret=1;
	for(int i=0;i<n;i++)
	{
		int a=A[i];
		ret=ret*cnt[a]%MOD;
		cnt[a]--;
		cnt[a+1]++;
	}
	printf("%lld\n",ret);
	return 0;
}


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

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    vector<int> B(N, 1);
    int sum = 0;

    for(int i; i<N; i++){
        cin >> A.at(i);
        sum += A.at(i);
    }

    float bias = float(sum) / (4.0 * float(M));

    for(int i; i<N; i++){
        if(A.at(i) < bias){
            B.at(i) = 0;
        }else{
            continue;
        }
    }
    int num_satisfy = std::count(B.begin(), B.end(), 1);
    if (num_satisfy >= M){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}



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

#define ll long long int

#define Bit_off(val,pos)       (val & (~(1<<pos)))
#define Bit_on(val,pos)        (val | (1<<pos))
#define Bit_toggle(val,pos)    (val ^ (1<<pos))
#define Bit_check(val,pos)     (bool)(val & (1<<pos))
#define odd_even(val)          (bool)(val & 1)
#define koita_1_ase(val)       (__builtin_popcount(val))

ll ar[5000009],br[5000009],cr[5000009];
map<ll,ll>mp,mp1;
vector<ll>v;

//void seive()
//{
//    ll i,j;
//
//    for(i=3; i<=10000; i+=2)
//    {
//        if(Bit_check(status[i>>5],i%32)==0)
//        {
//            for(j=(i*i); j<=100000000; j+=(i<<1))
//            {
//                status[j>>5]=Bit_on(status[j>>5],j%32);
//            }
//        }
//    }
//    for(i=3; i<100000000; i+=2)
//    {
//        if(Bit_check(status[i>>5],i%32)==0)
//        {
//            ///Prime
//        }
//    }
//}
int main()
{
    ll a,b,c,i,j,k,x,y,z,f,g,h;
    string s,d;
    cin>>a>>b;
    if(a<10)
    {
        c=100*(10-a);
        b=b+c;
    }
    cout<<b<<endl;
}


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

using namespace std;

int main(void)
{
    int H,N;
    scanf("%d%d",&H,&N);
    int sum = 0;
    for (int i=1,A;i<=N;i++){
        scanf("%d",&A);
        sum+=A;
    }
    if (H>sum) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using ll = long long;

// a^b % mod
ll pow(ll a, ll b) {
  ll res{1};
  while (b) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}

int main(){
  ll X; std::cin >> X;
  for(ll a=-200; a<=200; a++){
    for(ll b=-200; b<=200; b++){
      if(pow(a, 5)-pow(b, 5)==X){
        std::cout << a << ' ' << b << std::endl;
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3688
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <numeric>
#include <climits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <utility>
#include <cctype>
#include <iterator>
////////////////////////////////////////////////
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  string s;
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  cout << (c - a) * 60 + d - b - e << endl;
}
//////////////////////////////////////////////


Measured memory_bytes: 3648
/*2019/10/19 */
/*template*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define MOD 1000000007
#define MIN 999999999
#define MAX -999999999
typedef long long int ll;
typedef unsigned long long int ull;
void llswap(ll *x,ll *y){ll tmp;tmp=*x;*x=*y;*y=tmp;}
void swap(int *x,int *y){int tmp;tmp=*x;*x=*y;*y=tmp;}
int rmax(int x,int y){return x>y?x:y;}
int rmin(int x,int y){return x>y?y:x;}
ll llrmax(ll x,ll y){return x>y?x:y;}
ll llrmin(ll x,ll y){return x>y?y:x;}
int asc(const void *a,const void *b){if(*(int*)a < *(int*)b)return -1;else if(*(int*)a == *(int*)b)return 0;else return 1;}
int desc(const void *a,const void *b){if(*(int*)a < *(int*)b)return 1;else if(*(int*)a == *(int*)b)return 0;else return -1;}
int llasc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return -1;else if(*(ll*)a == *(ll*)b)return 0;else return 1;}
int lldesc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return 1;else if(*(ll*)a == *(ll*)b)return 0;else return -1;}
int gcd(int x,int y){if(y==0)return x;return gcd(y,x%y);}
 
//int asc_t(const void *a,const void *b){if(((pair_t*)a)->d < ((pair_t*)b)->d)return -1;else if(((pair_t*)a)->d == ((pair_t*)b)->d)return 0;else return 1;}
//int asc_t(const void *a,const void *b){if(((pair_t*)a)->d < ((pair_t*)b)->d)return 1;else if(((pair_t*)a)->d == ((pair_t*)b)->d)return 0;else return -1;}
int main(){
    int n,d[200];

    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&d[i]);
    }
    int ans=0;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            ans+=d[i]*d[j];
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
const double pi = 3.14159265358979323846;
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
int main()
{
    speed;
    ll a[6];

    for(int i=1;i<=5;i++)
        cin>>a[i];
    for(int i=1;i<=5;i++)
        if(a[i]==0)
    {
        cout<<i;return 0;
    }
}


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 1e5 + 10;
ll h, w;
int n, x, y;
ii a[N];
unordered_map<int, unordered_set<int>> mp;
int ans[10];

inline void f(int X, int Y) {
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            int x = X - i;
            int y = Y - j;
            if (x > 0 && x <= h - 2 && y > 0 && y <= w - 2) {
                int num = 0;
                for (int dx = 0; dx < 3; ++dx) {
                    for (int dy = 0; dy < 3; ++dy) {
                        int nx = x + dx;
                        int ny = y + dy;
                        if (mp.count(nx) && mp[nx].count(ny))
                            ++num;
                    }
                }
                ++ans[num];
            }
        }
    }
}

int main() {
    cin >> h >> w >> n;
    for (int i = 0; i < n; ++i) {
        cin >> x >> y;
        a[i].first = x;
        a[i].second = y;
        mp[x].insert(y);
    }
    ll cnt = (h - 2) * (w - 2);
    for (int i = 0; i < n; ++i) {
        x = a[i].first;
        y = a[i].second;
        f(x, y);
    }
    for (int i = 1; i < 10; ++i) {
        ans[i] /= i;
        cnt -= ans[i];
    }
    cout << cnt << endl;
    for (int i = 1; i < 10; ++i) {
        cout << ans[i] << endl;
    }
    return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<int>d(N);
  for(int i=0;i<N;i++){
    cin >> d.at(i);
  }
  sort(d.begin(),d.end());
  int c=0,count=0;
  for(int i=0;i<N;i++){
    if(c<d.at(i)){
        c=d.at(i);
        count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<string>
#include<functional>
#include<utility>
using namespace std;
int main(){
	int n; cin >> n;
	pair<int, int> data[100000];
	for (int i = 0; i < n; ++i) {
		data[i].second = i + 1;
		cin >> data[i].first;
	}
	sort(data, data+n);
	for (int i = 0; i < n; ++i) {
		if (i) cout << " ";
		cout << data[i].second;
	}
	cout << endl;
	return 0;
}

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

A=[1]

i = 1
while True:
    if 6**i <= 100000:
        A.append(6**i)
    else:
        break
    i += 1

i = 1
while True:
    if 9**i <= 100000:
        A.append(9**i)
    else:
        break
    i += 1

A.sort()

dp = [N]*(N+1)
dp[0] = 0
for i in range(1, N+1):
    for j in range(len(A)):
        if i - A[j] >= 0:
            dp[i] = min(1+dp[i-A[j]], dp[i])

print(dp[-1])

Measured memory_bytes: 3956
import time
import random
import math
def sigmoid(x):
  if x<-100:
    return 0
  return 1/(1+math.exp(-x))
def score(a,c,s,d):
  l=[-1 for i in range(26)]
  r=0
  for i in range(d):
    l[a[i]]=i
    r+=s[i][a[i]]
    for j in range(26):
      r-=c[j]*(i-l[j])
  return r
  
st=time.time()
d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
  s.append(list(map(int,input().split())))

ans=[]
l=[-1 for i in range(26)]
ld=[]
for i in range(d):
  ms=-10**9
  mt=None
  for j in range(26):
    js=c[j]*(i-l[j])+s[i][j]
    if ms<js:
      ms=js
      mt=j
  l[mt]=i
  ans.append(mt)
  ld.append([l[mt],d])
  if l[mt]>=0:
    ld[l[mt]][1]=i

os=score(ans,c,s,d)
nt=st
rate=100
while nt-st<1.50:
  nt=time.time()
  na=[ans[i] for i in range(d)]
  na[random.randint(1,d-1)]=random.randint(0,25)
  ns=score(na,c,s,d)
  if sigmoid((ns-os)/rate/((2-nt+st)**4))>random.random():
    os=ns
    ans=na
 
  


for i in ans:
  print(i+1)

Measured memory_bytes: 85380
#include <iostream>
#include <set>

using namespace std;

int main ( void )
{
	int n, k;
	
	while (cin >> n >> k)
	{
		set<int> boat[k];
		
		for (int i = 0, m; i < k; ++i)
		{
			cin >> m;
			
			for (int j = 0, x; j < m; ++j)
			{
				cin >> x;
				boat[i].insert(x);
			}
		}
		
		set<int> ans;
		int m;
		
		cin >> m;
		for (int i = 0, x, y; i < m; ++i)
		{
			cin >> x >> y;
			
			for (int j = 0; j < k; ++j)
			{
				if (boat[j].count(x) && boat[j].count(y))
				{
					ans.insert(x);
					ans.insert(y);
					break;
				}
			}
		}
		
		cout << ans.size() << endl;
	}
	return 0;
}

Measured memory_bytes: 1196
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, math.MaxInt64)
}

func readInt() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func main() {
	n := readInt()
	var arr []int
	a, b := 0, 0
	for i := 0; i < n; i++ {
		arr = append(arr, readInt())
	}
	sort.Sort(sort.Reverse(sort.IntSlice(arr)))

	for i := 0; i < n; i++ {
		if i%2 == 0 {
			a += arr[i]
		} else {
			b += arr[i]
		}
	}
	fmt.Println(a - b)
}


Measured memory_bytes: 640
#include<stdio.h>
int matrix[101][101];
int level[101];
int queue[101];
void bfs(int n)
{
  int i;
  for(i=1;i<=n;i++)
   level[i]=-1;
  int qHead=0,qTail=0;
  queue[qTail++]=1;
  level[1]=0;
  while(qHead!=qTail){
   int v=queue[qHead++];
   for(i=1;i<=n;i++){
    if(level[i]==-1 && matrix[v][i]==1){
     level[i]=level[v]+1;
     queue[qTail++]=i;
    }
   }
  }
}
int main()
{
    int n,i,j,u,v,k;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d%d",&u,&k);
        for(j=0;j<k;j++){
            scanf("%d",&v);
            matrix[u][v]=1;
        }
    }
    bfs(n);
    for(i=1;i<=n;i++){
        printf("%d %d\n",i, level[i]);
    }
    return 0;
}



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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}

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

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

struct UF {
	vector<int> p;
	UF(int n) : p(n, -1) {};
	bool unite(int u, int v) {
		if ((u = find(u)) == (v = find(v))) return false;
		if (p[u] > p[v]) swap(u, v);
		p[u] += p[v]; p[v] = u;
		return true;
	}
	bool same(int u, int v) { return find(u) == find(v); }
	int find(int u) { return p[u] < 0 ? u : p[u] = find(p[u]); }
	int usize(int u) { return -p[find(u)]; }
};

int n, m, a, b, w, res;
vector<pair<int,pii> > e;

signed main() {
	while (1) {
		cin >> n >> m;
		if (n==0) break;
		e.clear();
		rep(i,m) {
			cin >> a >> b >> w;
			a--, b--;
			e.pb({w,{a,b}});
		}
		sort(all(e));
		res = inf;
		rep(i,m) {
			int l = e[i].fi;
			UF uf(n);
			reps(j,i,m) {
				uf.unite(e[j].se.fi, e[j].se.se);
				if (uf.usize(0)==n) {
					int r = e[j].fi;
					chmin(res, r-l);
					break;
				}
			}
		}
		if (res==inf) cout << -1 << ln;
		else cout << res << ln;
	}
}


Measured memory_bytes: 3172
import Control.Applicative
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.List
import Data.Char (isSpace)

main :: IO ()
main = getLine >> solve <$> f >>= print
  where
    f = readil B.readInt <$> B.getLine

solve :: [Int] -> Int
solve = fst . foldl' f (0, 300000)
  where
    f (ct, mn) x
      | mn > x = (ct + 1, x)
      | otherwise = (ct, mn)

readil :: Integral a =>  (ByteString -> Maybe (a, ByteString)) -> ByteString -> [a]
readil f = unfoldr $ \s -> do
  (n, s') <- f s
  return (n, B.dropWhile isSpace s')


Measured memory_bytes: 4348
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
int main(){
  int N, K;
  std::cin >> N >> K;
  std::vector<size_t> H;
  for (int i=0; i<N; i++){
    int x;
    std::cin >> x;
    H.push_back(x);
  }
  std::sort(H.begin(), H.end());
  size_t sum=0;
  if (N<=K){std::cout << 0 << std::endl;}
  else {
  for (int i=0; i<N-K; i++) {
    sum+=H[i];
  }
  std::cout << sum << std::endl;
  }
  return 0;
}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
int data[50];
int main(){
	int n,cnt=0;
	cin>>n;
	for(int i=0;i<n;i++)cin>>data[i];
	for(int i=0;i<n;i++){
		if(data[i]!=i+1)cnt++;
	}
	if(cnt>2)cout<<"NO\n";
	else cout<<"YES\n";
}

Measured memory_bytes: 256
import sys

def solve(n):
    ret = 0
    for a in range(10):
        for b in range(10):
            for c in range(10):
                for d in range(10):
                    if a+b+c+d == n:
                        ret += 1
    return ret;

for i in sys.stdin:
    print solve(int(i))

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

void solve(std::istream &in, std::ostream &out);

int main() {
#ifdef LOCAL
  freopen("../IO/b.in", "r", stdin);
//  freopen("../IO/b.in", "w", stdout);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
#endif
  solve(std::cin, std::cout);
  return 0;
}


void solve(std::istream &in, std::ostream &out) {
  int n, D;
  in >> n >> D;
  int64_t d = (int64_t) D * D;
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    int64_t x, y;
    in >> x >> y;
    cnt += x*x+y*y<=d;
  }
  out << cnt << '\n';
}

Measured memory_bytes: 3656
import java.util.*;

public class Main{
	static int[] count;

	static void solve(int n,int m,int sum){
		if(n == 0){
			count[sum]++;
			return;
		}
		for(int i=1;i<=m;i++) solve(n-1,m,sum+i);
	}

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		while(true){
			int n=sc.nextInt(), m=sc.nextInt(), k=sc.nextInt();
			if(n==0 && m==0 && k==0) break;

			count = new int[m*n+1];
			solve(n,m,0);

			int ans = 0;
			for(int i=0;i<count.length;i++){
				ans += (i>k ? i-k : 1) * count[i];
			}
			System.out.printf("%.8f\n", ans / Math.pow(m,n));
		}
	}
}

Measured memory_bytes: 12000
#include<stdio.h>

int sum(int a)
{
    int count = 0;
    while(a)
    {
        count = count + a%10;
        a = a/10;
    }
    return count;
}


int main()
{
    int a;
    scanf("%d",&a);
    int b = sum(a);
    if(a%b==0)
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}


Measured memory_bytes: 128
A, B = map(int, input().split())
S = input()
cnt = 0

for i in S:
    if i == '-':
        cnt += 1

if cnt == 1:
    post = S.split('-')
    if len(post[0]) == A and len(post[1]) == B:
        print('Yes')
        exit()

print('No')


Measured memory_bytes: 9108
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
using namespace std;
int main(){
   int N,ans=0;
   cin >> N;
   int a[N];
   for(int i=0;i<N;i++){
       cin >> a[i];
       ans = ans+a[i];
   }
   cout << ans - N << endl;

   }



Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize ("-O3")
    using namespace std;
    #define ll long long
    #define ld long double
    #define vll vector<ll>
    #define mll map<ll,ll>
    #define pll pair<ll,ll>
    #define ff first
    #define ss second
    #define pb push_back
    #define deb(x) cout<<#x<<" : "<<x<<endl;
    #define deb2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
    #define deb3(x,y,z) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;
    #define deb4(w,x,y,z) cout<<#w<<" : "<<w<<"\t"<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;
    #define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #define printv(a)  for(ll i=0;i<a.size();i++)  cout<<a[i]<<" ";
   
   
    const int mod=1e9+7;
    const int N=1e6+5; 
    const ll inf=1e18+5;
   
    bool sortbysec(const pair<pair<ll,ll>,ll> &a, 
                      const pair<pair<ll,ll>,ll> &b) 
        { 
            return (a.second > b.second); 
        } 
        ll powermod(ll x, ll y, ll p)
        {
            ll res = 1;
            x = x % p;
            while (y > 0)
            {
                if (y & 1) res = (res*x) % p;
                y = y>>1;
                x = (x*x) % p;
            }
            return res;
        }
       
        bool isprime(int n) 
        { 
            if (n <= 1)  return false; 
            if (n <= 3)  return true; 
            if (n%2 == 0 || n%3 == 0) return false; 
            for (int i=5; i*i<=n; i=i+6) 
                if (n%i == 0 || n%(i+2) == 0) 
                   return false; 
           return true; 
        }
       
        vector<ll> adj[N];
        pair<ll,ll> dfs(ll a,ll parent)
        {   pair<ll,ll> p;
             ll all_white=1;
            ll som_black=0;
            for(ll i=0;i<adj[a].size();i++)
            {
                if(adj[a][i]!=parent)
                {
                    p=dfs(adj[a][i],a);
                    
            ll old_white=all_white;
            all_white=(p.ss*all_white)%mod;
            som_black=((old_white*p.ff)%mod+(som_black*(p.ff+p.ss))%mod)%mod;
            }
            }
            return {all_white,all_white+som_black};
        }
        int main()
    {
        FAST;
        ll n;
        cin>>n;
        for(ll i=0;i<n-1;i++)
        {
            ll x,y;
            cin>>x>>y;
            adj[x].pb(y);
            adj[y].pb(x);
        }
        pair<ll,ll> p =dfs(1,-1);
        cout<<(p.ff+p.ss)%mod<<"\n";
        return 0;
    }

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

long long c[320][1000];

int main() {
	int x , a , b;
	cin >> x >> a >> b;
	if(b <= a){
        cout << "delicious";
	}
	else{
       if(x+a >= b){
        cout << "safe";
       }
       else{
        cout << "dangerous";
       }
	}
	return 0;
}


Measured memory_bytes: 256
// abc162_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    string N;
    cin >> N;

    bool include = false;
    REP(i, 3){
        if (N[i] == '7'){
            include = true;
            break;
        }
    }

    if (include){
        print("Yes");
    } else {
        print("No");
    }

    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    int n;cin>>n;
    map<string,int>a;
    rep(i,n){
        string s;cin>>s;
        a[s]++;
    }
    cout<<"AC x "<<a["AC"]<<endl;
    cout<<"WA x "<<a["WA"]<<endl;
    cout<<"TLE x "<<a["TLE"]<<endl;
    cout<<"RE x "<<a["RE"]<<endl;
}

Measured memory_bytes: 3596
#include <stdio.h>
int main(){
    int S, h, m, s;
    
    scanf("%d", &S);
    
    h=S/3600;
    S=S%3600;
    m=S/60;
    s=S%60;
    
    printf("%d:%d:%d\n",h,m,s);
    
    return 0;
}


Measured memory_bytes: 1968
//ProblemC

//#define USE_STDIO
//#define USE_LOG
//#define FILE_ERR

#ifdef _MYPC
#include "mypc.h"
#endif // _MYPC

#ifndef debug
#define debug(...)
#endif // !LOG

//include
#include <iostream>
#include <string>
#include <vector>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <memory>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iomanip>

using namespace std;

//for
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define forbe(i, begin, end) for(decltype(begin) i = (begin); i != (end); ++i)
#define forbes(i, begin, end, step) for(decltype(begin) i = (begin); i != (end); i += (step))

//int
using ll = long long;
using ull = unsigned long long;
using uint = unsigned;

//pair
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
#define fi first
#define se second

//vector
template <typename Value>
static inline void fillv(Value& x, const Value& val) { x = val; }
template <typename Vector, typename Value>
static inline void fillv(Vector& v, const Value& val) { for (auto& x : v) fillv(x, val); }

static inline void Solve();

int main(int argc, char* argv[]) {
#ifdef REDIRECT_STDIO
	REDIRECT_STDIO;
#endif // REDIRECT_STDIO

	Solve();
	return 0;
}

//ProblemC
void Solve() {
	int n;
	cin >> n;
	vector<int> a(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i] -= i + 1;
	}
	sort(a.begin(), a.end());
	ll b = a[a.size() / 2];
	ll ans = 0;
	for (auto x : a) {
		ans += abs(x - b);
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int M = Integer.parseInt(sc.next());
        Map<Integer,String> problemMap = new HashMap<>();
        int AC = 0;
        int[] WA = new int[101000];
        for(int i=0;i<M;i++){
            int probNo = Integer.parseInt(sc.next());
            String str = sc.next();
            if(problemMap.containsKey(probNo) && problemMap.get(probNo).equals("AC"))continue;
            problemMap.put(probNo,str);
            if(str.equals("AC")){
                AC++;
            }else{
                WA[probNo]++;
            }
        }
        int totalWA = 0;
        for(int i=1;i<=N;i++){
            if(problemMap.containsKey(i) && problemMap.get(i).equals("AC")){
                totalWA += WA[i];
            }
        }
        System.out.println(AC + " " + totalWA);
    }
}


Measured memory_bytes: 68272