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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
//const int mod = 100000;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll 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++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  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;
  }
};

int main()
{
  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n, vector<int>(n, INF));
  vector<P> point(m);
  rep(i, m) {
    int a, b; cin >> a >> b;
    --a; --b;
    g[a][b] = g[b][a] = 1;
    point[i] = P(a, b);
  }

  int ans = 0;
  for(auto del : point) {
    vector<vector<int>> h = g;
    h[del.first][del.second] = h[del.second][del.first] = INF;
    rep(k, n) rep(i, n) rep(j, n) chmin(h[i][j], h[i][k]+h[k][j]);
    bool ok = true;
    rep(i, n) rep(j, n) if(h[i][j] == INF) ok = false;
    if(!ok) ++ans;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3648
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define lb long double
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define mod 1000000007LL
#define INF 1234567890123456
typedef pair<lb, int> P;
typedef pair<int, P> PP;

const int maxn =1e3 + 10;

//initialization here
//

//
//initialization finish


// your function is here
//

//
// your function finished



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	// your code is here
	//
	int n; cin >> n;
	ll m[5];
	rep(i, 5)m[i] = 0;

	rep(i, n)
	{
		string s; cin >> s;
		if (s[0] == 'M') m[0]++;
		else if (s[0] == 'A') m[1]++;
		else if (s[0] == 'R') m[2]++;
		else if (s[0] == 'C') m[3]++;
		else if (s[0] == 'H') m[4]++;
	}

	int cnt = 0;
	rep(i, 5)
	{
		if (m[i] == 0)cnt++;
	}

	ll ans = 0;
	if (cnt > 2)Print(0);
	else
	{
		rep(i, 5)FOR(j,i,5)FOR(k,j,5)
		{
			if (i == j || j == k || k == i)continue;

			ans += m[i] * m[j] * m[k];
		}
		Print(ans);
	}



	//
	// your code finished


	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int maxN = 1e5 + 10;
int n, h[maxN], dp[maxN];
int main()
{
	cin >> n;
	for(int i = 0; i < n; i++) cin >> h[i];
	dp[1] = abs(h[1] - h[0]);
	for(int i = 2; i < n; i++) dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
	cout << dp[n - 1] << endl;
	return 0;
}

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

int main() {

  int N, M;
  cin >> N >> M;

  vector<string> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  vector<string> B(M);
  for (int i = 0; i < M; i++) {
    cin >> B[i];
  }

  string answer = "No";

  for (int i = 0; i <= N - M; i++) {

    vector<string> a(M);
    for (int j = 0; j <= N - M; j++) {
      for (int k = 0; k < M; k++) {
        a[k] = A[i + k].substr(j, M);
      }

      if (B == a) {
        answer = "Yes";
        break;
      }

    }

    if (answer == "Yes") {
      break;
    }

  }

  cout << answer << endl;

}

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

using namespace std;

int main(void){
  string st;
  cin >> st;
  int p = 0;
  int q = size(st);
  for(int i = 0;i < q;i ++){
    p = p + (st[i] - '0');
  }
  if(p % 9 == 0){
    cout << "Yes" << endl;
  }else{
   cout << "No"<< endl;
  }
  
  return 0;
}

Measured memory_bytes: 3744
#include <stdio.h>
int main(){
  char a[3];
  for(int i=0; i<4; i++){
    scanf("%s",&a[i]);
  }
  if(a[0]==a[1] || a[1]==a[2] || a[2]==a[3]){
    printf("Bad");
  }else{
    printf("Good");
  }
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<math.h>

using namespace std;

double menseki(double x1, double y1, double x2, double y2, double x3, double y3){
	double s;
	s=1.0/2*(y1*(x2-x3)+y2*(x3-x1)+y3*(x1-x2));
	if(s<0)s=-s;
	return s;
}

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	double s,sp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		s=menseki(x1,y1,x2,y2,x3,y3);
		sp=menseki(xp,yp,x2,y2,x3,y3)+menseki(x1,y1,xp,yp,x3,y3)+menseki(x1,y1,x2,y2,xp,yp);
		if(sp>s)cout<<"NO"<<endl;
		else cout<<"YES"<<endl;
	}
	return 0;
}

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

primes = [2]
primes_mod5 = [[] for _ in range(5)]
for cand in range(3, 1400, 2):
    root = int(cand**0.5)
    for p in primes:
        if p > root:
            primes += [cand]
            primes_mod5[cand % 5] += [cand]
            if len(primes_mod5[cand % 5]) == N:
                print(' '.join(map(str, primes_mod5[cand % 5])))
                exit()
            break
        elif cand % p == 0:
            break

Measured memory_bytes: 3064
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			System.out.println(IntStream.range(0, n).map(i -> {
				int a = scanner.nextInt(), count = 0;
				while (0 == (a & 1)) {
					count++;
					a >>= 1;
				}
				return count;
			}).sum());
		}
	}
}


Measured memory_bytes: 49256
n,k = map(int,input().split())
a = list(map(int,input().split()))
import math
import bisect

a.sort(reverse=True)
idx = 0
result = 0

bottom, top = 0, max(a)

while top - bottom > 1:
    mid = (top + bottom) // 2
    cnt = 0
    for i in range(n):
        cnt += a[i] // mid
        if a[i] % mid == 0:
            cnt -= 1
    if cnt <= k:
        top = mid
    else:
        bottom = mid

print(top)
    

Measured memory_bytes: 30928
import numpy as np
import sys
input = sys.stdin.readline
n = int(input())
a = np.array([list(input().rstrip()) for i in range(n)])
ans = 0
for i in range(n):
  c = np.roll(a,i,axis=0)
  if np.array_equal(c,c.T):
    ans += 1
print(ans*n)

Measured memory_bytes: 21240
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    map<int, ll> mp;
    for (int i = 2; i <= n; i++) {
        int tmp = i;
        for (int j = 2; j <= i; j++) {
            if (tmp % j == 0) {
                mp[j] = (mp[j] + 1) % MOD;
                tmp /= j;
                j = 1;
            }
        }
    }
    ll ans = 1;
    for (int i = 2; i <= n; i++) {
        ans = (ans * (mp[i] + 1) % MOD) % MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
def main():
    n, k = [int(x) for x in input().split()]
    scores = [int(x) for x in input().split()]
    for index, new in enumerate(scores[k:]):
        # zip にすると2つのリストを作るのか，これよりも少し時間とメモリ増。
        print('Yes' if scores[index] < new else 'No')


if __name__ == '__main__':
    main()


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

#define int long long
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
using namespace std;

const unsigned int M = 1e9 + 7;

int32_t main() {
	fastio;

	int x;
	cin >> x;
	int p = 100, count = 0;
	while(p < x) {
		p += p / 100;
		++count;
	}
	cout << count;

	return 0;
}


Measured memory_bytes: 3612
import java.util.Scanner;

class Main {
    static final long mod = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int b[] = new int[n];// 自分より小さい数の数

        for (int i = 0; i < n; i++) {
            int num = a[i];
            int cnt = 0;
            for (int j = i + 1; j < n; j++) {
                if (num > a[j]) {
                    cnt++;
                }
            }
            b[i] = cnt;
        }
        long c[] = new long[n]; // 自分より少ない
        for (int i = 0; i < n; i++) {
            int num = a[i];
            int cnt = 0;
            for (int j = 0; j < i; j++) {
                if (num > a[j]) {
                    cnt++;
                }
            }
            c[i] = cnt;
        }
        long ans = 0;

        long hh = k;
        long hhh = hh * (hh + 1) / 2;
        hhh %= mod;

        for (int i = 0; i < n; i++) {
            ans += b[i] * hhh % mod;
            ans %= mod;
        }

        long kk = k;
        long kkk = kk * (kk - 1) / 2;
        kkk %= mod;
        for (int i = 0; i < n; i++) {
            ans += kkk * c[i] % mod;
            ans %= mod;
        }

        System.out.println(ans);

        sc.close();
    }
}


Measured memory_bytes: 26368
import sys
input = sys.stdin.readline
N = int(input())
a = [list(map(int, input().split())) for _ in range(N)]
for i in range(N): a[i][1] += 1
a.sort()
ls = [x[0] for x in a]
rs = [x[1] for x in a]

class SegTree:
  def segfunc(self, x, y):
    return min(x, y) #ここ判定関数（ただし結合則があるもの）
  def __init__(self, n, ide_ele, init_val):
    #####単位元######
    self.ide_ele = ide_ele
    #num:n以上の最小の2のべき乗
    self.num = 2 ** (n - 1).bit_length()
    self.seg = [self.ide_ele] * 2 * self.num
    #set_val
    for i in range(n):
      self.seg[i + self.num - 1] = init_val[i]    
    #built
    for i in range(self.num - 2, -1, -1) :
      self.seg[i] = self.segfunc(self.seg[2 * i + 1], self.seg[2 * i + 2]) 
  def update(self, k, x):
    k += self.num - 1
    self.seg[k] = x
    while k + 1:
      k = (k - 1) // 2
      self.seg[k] = self.segfunc(self.seg[k * 2 + 1], self.seg[k * 2 + 2]) 
  def query(self, p, q):
    if q <= p:
      return self.ide_ele
    p += self.num - 1
    q += self.num - 2
    res = self.ide_ele
    while q - p > 1:
      if p & 1 == 0:
        res = self.segfunc(res, self.seg[p])
      if q & 1 == 1:
        res = self.segfunc(res, self.seg[q])
        q -= 1
      p = p // 2
      q = (q - 1) // 2
    if p == q:
      res = self.segfunc(res, self.seg[p])
    else:
      res = self.segfunc(self.segfunc(res, self.seg[p]), self.seg[q])
    return res
class Seg2ree:
  def segfunc(self, x, y):
    return max(x, y) #ここ判定関数（ただし結合則があるもの）
  def __init__(self, n, ide_ele, init_val):
    #####単位元######
    self.ide_ele = ide_ele
    #num:n以上の最小の2のべき乗
    self.num = 2 ** (n - 1).bit_length()
    self.seg = [self.ide_ele] * 2 * self.num
    #set_val
    for i in range(n):
      self.seg[i + self.num - 1] = init_val[i]    
    #built
    for i in range(self.num - 2, -1, -1) :
      self.seg[i] = self.segfunc(self.seg[2 * i + 1], self.seg[2 * i + 2]) 
  def update(self, k, x):
    k += self.num - 1
    self.seg[k] = x
    while k + 1:
      k = (k - 1) // 2
      self.seg[k] = self.segfunc(self.seg[k * 2 + 1], self.seg[k * 2 + 2]) 
  def query(self, p, q):
    if q <= p:
      return self.ide_ele
    p += self.num - 1
    q += self.num - 2
    res = self.ide_ele
    while q - p > 1:
      if p & 1 == 0:
        res = self.segfunc(res, self.seg[p])
      if q & 1 == 1:
        res = self.segfunc(res, self.seg[q])
        q -= 1
      p = p // 2
      q = (q - 1) // 2
    if p == q:
      res = self.segfunc(res, self.seg[p])
    else:
      res = self.segfunc(self.segfunc(res, self.seg[p]), self.seg[q])
    return res
res = 0
segls = Seg2ree(N, 0, ls)
segrs = SegTree(N, 10 ** 10, rs)
#print(a)
for i in range(N - 1):
  l1 = segls.query(0, i)
  l2 = segls.query(i + 1, N)
  r1 = segrs.query(0, i)
  r2 = segrs.query(i + 1, N)
  if l1 == 0: l1 = 10 ** 10
  if r1 > 10 ** 9: r1 = a[i][1]
  t = a[i][1] - a[i][0] + max(0, min(r1, r2) - l2)
  t = max(t, max(0, r1 - a[i][0]) + r2 - l2)
  #print(i, t, l1, l2, r1, r2)
  res = max(res, t)
print(res)

Measured memory_bytes: 112604
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
  	vector<string>v(a);
	for (int i = 0; i < a; ++i) {
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	for (int i = 0; i < a; ++i) {
		cout << v[i];
	}
	cout << endl;
}

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

int main() {
  int W,a,b; cin >> W >> a >> b;
  int mind = 0;
  if ( a+W < b ) cout << b-(a+W) << endl;
  else if ( b+W < a ) cout << a-(b+W) << endl;
  else cout << 0 << endl;
  return 0;
}


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

const int MAX=205;
const long long int INF=(1LL<<32);

long long int D[MAX][MAX];
int N;

void floyd(){
    for(int k=0;k<N;k++){
        for(int i=0;i<N;i++){
            if(D[i][k]==INF) continue;
            for(int j=0;j<N;j++){
                if(D[k][j]==INF) continue;
                D[i][j]=min(D[i][j],D[i][k]+D[k][j]);
            }
        }
    }
}

int main(){
    
    int N;cin>>N;
    vector<int> S(N);
    for(int i=0;i<N;i++){
        cin>>S[i];
    }
    int cnt=0;
    for(int i=1;i<N;i++){
        if(S[i-1]==i){
            cnt++;
            swap(S[i-1],S[i]);
        }
    }
    if(S[N-1]==N) cnt++;
    cout<<cnt<<endl;
}



Measured memory_bytes: 640
main = getLine >>=  print . compute . map read . words

compute :: [Int] -> Int
compute [n,m] = abs ((n-2)*(m-2))

{-
compute [1,1] = 1
compute [1,m] = m-2
compute [n,1] = n-2
compute [n,m] = (n-2)*(m-2)
-}

{-
中の n-2 * m-2 個は9回反転するから裏
###
###
###

辺の(n-2+m-2)*2個は6回反転するから表
###
###
...

角の4個は4回反転するから表
##.
##.
...

細いとき、中のm-2個は3回反転するから裏
...
###
...

端の2個は2回反転するから表
...
.##
...

点のとき、その1個は裏
...
.#.
...
-}

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

int n, k, x;
vector <int> a;

int main(){
    cin.tie(0);
    cin.sync_with_stdio(0);
    cin >> n >> k;
    while(n-- && cin >> x)
        a.push_back(x);
    sort(a.rbegin(), a.rend());
    long long ans = 0;
    for(int i = 0 ; i < k ; i++)
        ans += a[i];
    cout << ans << endl;
    return 0;
}


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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

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

const int L_MAX = 1e5+10;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n;
  cin >> n;
  vector<int32> v(n),w(n);
  REP(i,n)cin >> v[i] >> w[i];
  int32 dpsize = min<int32>(n,(1<<9)-1);
  vector<vector<int32>> dp(dpsize,vector<int32>(L_MAX,0));
  REP(i,dpsize){
    if(i > 0){
      int32 p = (i-1)/2;
      dp[i] = dp[p];
    }
    FORR(j,L_MAX-1,w[i]){
      dp[i][j] = max(dp[i][j], dp[i][j-w[i]] + v[i]);
    }
  }
  int32 q;
  cin >> q;
  REP(_,q){
    int32 u,l;
    cin >> u >> l;
    --u;
    vector<pii> vw;
    while(u>=dpsize){
      vw.emplace_back(v[u],w[u]);
      u = (u-1)/2;
    }
    int32 ans = 0;
    for(int32 mask = 0; mask < (1<<vw.size()); ++mask){
      int32 vs = 0, ws = 0;
      REP(i,vw.size()){
        if(mask>>i&1){
          vs += vw[i].fi;
          ws += vw[i].se;
        }
      }
      if(ws > l)continue;
      ans = max(ans, dp[u][l-ws]+vs);
    }
    ANS(ans);
  }
  return 0;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll d,n; cin>>d>>n;
  ll ans=1;
  rep(i,d) ans*=100;
  
  if(n==100){
    ans*=101;
  }else{
    ans*=n;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
using ll = long long;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repp(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)


int main() {
  ll x, k, d;  cin >> x >> k >> d;
  x = abs(x);
  ll n=0, a=0, b=0;
  n = x / d;
  if (n >= k) {
    cout << x - k * d << endl;
    return 0;
  }
  a = x - (n * d);
  b = a - d;

  if ((k - n) % 2 == 1) cout << b * -1 << endl;
  else cout << a << endl;
}

Measured memory_bytes: 3632
/* ********************************* JAI SAI RAM ************************************* */
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double lb;
#define endl "\n"
ll P=1000000007;
ll MAX=1e18;
ll arr[1000001];
int main()
{
    ll i,j,k,l,m,n,o,p,q,r,s,t,start,end,mid;
    ll ans=0;
    cin>>n;
    arr[0]=0;
    for(i=1;i<=1000000;i++)
    {
        arr[i]=arr[i-1]+i;
    }
    //cout<<arr[1000000]<<endl;
    for(i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            l=0;
            while(n%i==0)
            {
                n/=i;
                l++;
            }
            start=1;
            end=1000000;
            r=0;
            while(start<=end)
            {
                mid=(start+end)/2;
                if(arr[mid]<=l)
                {
                    r=mid;
                    start=mid+1;
                }
                else 
                end=mid-1;
            }
            ans+=r;
        }
    }
    if(n>1)
    ans+=1;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 11500
#include <algorithm>
#include <cstdio>

#define int long long
#define dotimes(i, n) for (int i : range(n))

using namespace std;

class range {
  class iterator {
    int i, s;
  public:
    iterator(int i, int s): i(i), s(s) {}
    int& operator*() {
      return i;
    }
    void operator++() {
      i += s;
    }
    bool operator!=(iterator const& that) {
      return i < that.i;
    }
  };
  iterator b, e;
public:
  range(int e): b({0, 1}), e({e, 1}) {}
  range(int b, int e): b({b, 1}), e({e, 1}) {}
  range(int b, int e, int s): b({b, s}), e({e, s}) {}
  iterator begin() {
    return b;
  }
  iterator end() {
    return e;
  }
};

int rint() {
  int n;
  scanf("%lld", &n);
  return n;
}

void wint(int n) {
  printf("%lld\n", n);
}

template<typename T>
inline int size(T container) {
  return static_cast<int>(container.size());
}

template<typename T>
inline bool maxs(T& a, T const& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template<typename T>
inline bool mins(T& a, T const& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main() {
  const int inf = 1e9 + 1;
  int n = rint();
  int dp[n+1];
  dp[0] = -1;
  dotimes(i, n) {
    dp[i+1] = inf;
    int a = rint();
    mins(dp[lower_bound(dp, dp + i + 1, a) - dp], a);
  }
  wint(lower_bound(dp, dp + n + 1, inf) - dp - 1);
  return 0;
}



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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k, c, len;
  cin >> n >> k >> c;
  string s;
  cin >> s;
  len = s.length();
  vector<int> f, r;
  for(int i = 0; i < len; i++) {
    if(s[i] == 'o' && (f.size() == 0 || f.back() + c <= i)) {
      if(f.size() < k)
        f.push_back(i + 1);
      else if(f.size() == k)
        return 0;
    }
  }
  for(int i = len - 1; i >= 0; i--) {
    if(s[i] == 'o' && (r.size() == 0 || r.back() - c - 1 > i))
      if(r.size() < k)
        r.push_back(i + 1);
      else if(r.size() == k)
        return 0;
  }
  vector<int> out;
  sort(r.begin(), r.end());
  set_intersection(f.begin(), f.end(), r.begin(), r.end(),
                   inserter(out, out.end()));
  for(int i = 0; i < out.size(); i++) cout << out[i] << '\n';
}

Measured memory_bytes: 4236
#include <bits/stdc++.h>
#define REP(i, n) for (int i=0, i##_len=(n); i<i##_len; ++i)
#define FOR(i, a, b) for (int i=(a); i<(b); ++i)
using ll = long long;
using namespace std;

int main()
{
    int D, G;
    cin >> D >> G;
    int P[D], C[D];
    REP(i, D) cin >> P[i] >> C[i];

    int ret = INT_MAX;
    REP(i, pow(2, D))
    {
        int n = 0;
        int s = 0;

        REP(j, D)
        {
            if (i >> j & 1)
            {
                s += (j+1)*100*P[j]+C[j];
                n += P[j];
            }
        }

        for (int j=D-1; j>=0; --j)
        {
            if (s >= G) break;
            if (i >> j & 1) continue;

            int m = min((G-s)/((j+1)*100), P[j]);
            s += (j+1)*100*m;
            n += m;
        }

        ret = min(ret, n);
    }

    cout << ret << endl;
    return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  for(int i = 0; i < M; i++) {
    int t;
    cin >> t;
    N -= t;
  }
  if (N >= 0) {
    cout << N << endl;
  }
  else {
    cout << "-1" << endl;
  }
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
using namespace std;
int gcd(int a, int b){
  if(a < b) return gcd(b, a);
  int r;
  while((r = a%b)){
    a = b;
    b = r;
  }
  return b;
}
int main()
{
  int n;
  cin >> n;
  int tmp;
  int tmpgcd;
  cin >> tmpgcd;

  for(int i = 1; i < n; i ++){
    cin >> tmp;
    tmpgcd = gcd(tmpgcd, tmp);
    if(tmpgcd == 1){
      break;
    }
  }
  cout << tmpgcd << endl;
}


Measured memory_bytes: 256
#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
// https://atcoder.jp/contests/abc166/tasks/abc166_b
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll ans = 0;
    ll n,k;
    cin >> n >> k;
    vector<ll> v[101];
    for(int i = 1;i<=k;i++){
        ll d;
        cin >> d;
        for(int j = 0;j<d;j++){
            ll e;
            cin >> e;
            v[e].push_back(i);
        }
    }
    for(int i = 1;i<=n;i++){
        if(v[i].size() == 0)
            ans++;
    }
    cout << ans;
	return 0;
}

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


int main() {
    int x=0,y=0;
    string s;
    cin >> s;
    int z=s.size();
    vector<char> v(z);
    rep(i,z){
        v.at(i)=s.at(i);
    }
    char a='0';
    rep(i,z){
        if(s.at(i)==a) x++;
        else y++;
        if(a=='0') a='1';
        else a='0';
    }
    cout << min(x,y) << endl;
}

Measured memory_bytes: 512
n, x, y = map(int, input().split())
x -= 1
y -= 1
a = [0] * n
for i in range(n - 1):
    for j in range(i, n):
        a[min(j - i, abs(i - x) + 1 + abs(j - y))] += 1
for i in range(1, n):
    print(a[i])

Measured memory_bytes: 3444
import math
a, b, x = map(float, input().split())
s = a * b * math.sin(math.radians(x)) / 2
l = a + b + math.sqrt(a * a + b * b - 2 * a * b * math.cos(math.radians(x)))
h = b * math.sin(math.radians(x))
print('%f' % s)
print('%f' % l)
print('%f' % h)


Measured memory_bytes: 5692
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  char S[MAX];
  scanf("%s", S);
  int n = strlen(S);

  int ok = 1;
  // 条件１
  if ( S[0] != 'A' ) ok = 0;
  if ( 'A' <= S[1] && S[1] <= 'Z' ) ok = 0;
  int C = 0;
  rep(i, 2, n - 1) {
    if ( S[i] == 'C' ) C++;
    else if ( 'A' <= S[1] && S[1] <= 'Z' ) ok = 0;
  }
  if ( C != 1 ) ok = 0;
  if ( 'A' <= S[n-1] && S[n-1] <= 'Z' ) ok = 0;
  printf(ok ? "AC\n" : "WA\n");
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
#define LEN 500001
#define NIL -1

int trance_command(char []);
void insert(int);
void print();
void inorder(int);
void preorder(int);

int P[LEN], L[LEN], R[LEN], Key[LEN];
int root=NIL;

int main()
{
  char command[10];
  int n, id;
  int z=0;
  int i, j, k;

  //intelization
  for(i=0; i<LEN; i++)
    {
      P[i]=NIL;
      L[i]=NIL;
      R[i]=NIL;
      Key[i]=NIL;
    }

  //read
  scanf("%d", &n);
  for(i=0; i<n; i++)
    {
      scanf("%s", command);
      //insert
      if(trance_command(command)==0)
	{
	  scanf("%d", &id);
	  Key[z]=id;
	  insert(z);
	  z++;
	}
      //print
      else
	{
	  inorder(root);
	  printf("\n");
	  preorder(root);
	  printf("\n");
	}
    }

  return 0;
}


//-------------------------
//this method is trancing command.
int trance_command(char c[])
{
  if(strcmp(c, "insert")==0)return 0;
  else if(strcmp(c, "print"))return 1;
}

void insert(int z)
{
  int y=NIL;
  int x=root;

  while(x!=NIL)
    {
      y = x;
      if(Key[z]<Key[x])x = L[x];
      else x = R[x];
    }
  P[z]=y;

  if(y==NIL)root=z;
  else if(Key[z]<Key[y])L[y]=z;
  else R[y]=z;
}

void inorder(int t)
{
  if(t!=NIL)
    {
      inorder(L[t]);
      printf(" %d", Key[t]);
      inorder(R[t]);
    }
}

void preorder(int t)
{
  if(t!=NIL)
    {
      printf(" %d", Key[t]);
      preorder(L[t]);
      preorder(R[t]);
    }
}

Measured memory_bytes: 8232
import Control.Applicative
import Control.Monad
import Control.Monad.ST
-- import qualified Data.ByteString as BS
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
--import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
import GHC.ST
-- import System.IO.Unsafe
 
-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
getDoubles = map readDouble . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
tjoin :: (Show a, Show b) => (a, b) -> String
tjoin (x, y) = show x ++ (' ' : show y)
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
coverC :: Ord a => (a, a) -> a -> Bool
coverC (l,r) x = l<=x && x<=r
coverH :: Ord a => (a, a) -> a -> Bool
coverH (l,r) x = l<=x && x<r
ibsearch :: (Int -> Bool) -> (Int,Int) -> Int
ibsearch f (ok,ng) = if abs (ok-ng) <= 1 then ok else let mid = (ok + ng) `div` 2 in ibsearch f (if f mid then (mid,ng) else (ok,mid))
-- templete



main = do
    cs <- map head . filter (apply2 (==)) . splitRec 2 . sort  . map (apply2 (,) . sort) <$> replicateM 6 getInts
    if length cs == 3 then do
        let [(a,b),(c,d),(e,f)] = cs
        putStrLn $ cond "yes" "no" $ (a==c && b==e && d==f) || (a==c && b==f && d==e)
    else putStrLn "no"


Measured memory_bytes: 3712
package main

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

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

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

func main() {
	n := nextInt()

	p := 1
	for i := 1; i <= n; i++ {
		p = (p * (i % mod)) % mod
	}

	fmt.Println(p)
}


Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
	int pasta = 2000;
	int juice = 2000;
	int tmp;
	int i;
	
	for (i = 0; i < 3; i++){
		scanf("%d", &tmp);
		if (pasta > tmp){
			pasta = tmp;
		}
	}
	for (i = 0; i < 2; i++){
		scanf("%d", &tmp);
		if (juice > tmp){
			juice = tmp;
		}
	}
	
	printf("%d\n", pasta + juice - 50);
	
	return (0);
}

Measured memory_bytes: 592
from collections import deque
import sys 
input = sys.stdin.readline
sys.setrecursionlimit(10**5)
n, m = map(int, input().split())
adjacent_list = [[] for i in range(n+1)]
not_root = set()
for i in range(m):
    x, y = map(int, input().split())
    not_root.add(y)
    adjacent_list[x].append(y)
dp = [-1 for i in range(n+1)]
def cul(x):
    if dp[x] != -1:
        return dp[x]
    else:
        if len(adjacent_list[x]) == 0:
            return 0
        dp[x] = max([cul(i) + 1 for i in adjacent_list[x]])
        return dp[x]
for i in range(1,n+1):
    cul(i)
print(max(dp))

Measured memory_bytes: 186204
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdlib>
#include<iomanip>
#include<queue>
#include<set>
#include <valarray>
#include<stack>
#include<sstream>

using namespace std;

double EPS = 1e-10;
double PI = 3.141592653589793238462643383279;

double add(double a, double b)
{
    if(abs(a + b) < EPS * (abs(a) + abs(b)))return 0;
    return a + b;
}

struct point
{
    double x, y;
    point(){}
    point(double x,double y) : x(x) , y(y){}
    
    point operator + (point p)
    {
        return point(add(x, p.x), add(y, p.y));
    }
    
    point operator - (point p)
    {
        return point(add(x, -p.x), add(y, -p.y));
    }
};

struct circle
{
    point p;
    double r;
};

double dot(point a, point b){return (a.x * b.x + a.y * b.y);}
double cross(point a, point b){return (a.x * b.y - a.y * b.x);}
double norm(point a){return sqrt(a.x*a.x+a.y*a.y);}

double dist(point a,point b)
{
    return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}

double distance_ls_p(point a, point b, point c)
{
    if ( dot(b-a, c-a) < EPS ) return norm(c-a);
    if ( dot(a-b, c-b) < EPS ) return norm(c-b);
    
    return abs(cross(b-a, c-a)) / norm(b-a);
}

int crossCS(point a, point b, circle c)
{
    double res=distance_ls_p(a,b,c.p);
    double ac=dist(a,c.p);
    double bc=dist(b,c.p);
    
    if(res>c.r || (ac<c.r && bc<c.r))return 0;
    else if(c.r-res<EPS ||(ac<c.r && bc>=c.r)||(ac>=c.r && bc<c.r))return 1;
    else return 2;
}

int main()
{
    int n,m;
    circle c[100];
    point t,s;
    
    while(cin >> n,n)
    {
        for(int i=0;i<n;i++)
            cin >> c[i].p.x >> c[i].p.y >> c[i].r;
        
        cin >> m;
        
        for(int i=0;i<m;i++)
        {
            cin >> t.x >> t.y >> s.x >> s.y;
            
            int fg=0;
            for(int j=0;j<n;j++)fg+=crossCS(t,s,c[j]);
            
            if(fg==0)cout << "Danger" << endl;
            else cout << "Safe" << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 1228
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    vector<int>vec;
    while(n--)
    {
        int p;
        cin>>p;
        vec.push_back(p);
    }
    sort(vec.begin(),vec.end());
    int sum=0;
    for(int i=0;i<k;i++)
    {
        sum=sum+vec[i];
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3600
#include<iostream>
#include<math.h>
#include<algorithm>
typedef long long ll;
using namespace std;
int n,c;
char s[55];
int main(){	
cin>>n;
for(int i=0;i<n;i++)
cin>>s[i];
for(int i=0;i<n;i++){
if(s[i]=='B'){
	if(s[i-1]=='A'&&s[i+1]=='C')
	c++;
}
}
cout<<c;
return 0;
} 

Measured memory_bytes: 3616
// Nguyen Anh Tu
#include <bits/stdc++.h>
#define FOR(x,a,b) for(int x=a;x<=b;x++)
#define FORD(x,a,b) for(int x=a;x>=b;x--)
#define maxn 100005
#define maxc 1000000007
#define MOD 1000000007
#define reset(x,y) memset(x,y,sizeof(x))
#define task "frog"
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define pii pair<int,int>
#define ll long long
#define bit(p,x) ((x>>p) & 1)
#define remain(a,b) (a+b >= MOD) ? (a+b - MOD) : (a+b)

using namespace std;
int n,a[maxn],dp[maxn];
int main()
{
//    #ifndef ONLINE_JUDGE
    ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);
//    freopen(task".inp","r",stdin);
//    freopen(task".out","w",stdout);
//    #endif
    cin >> n;
    for(int i=1; i<=n; ++i)
    {
        cin >> a[i];
    }
    a[0] = maxc;
    for(int i=2; i<=n; ++i) dp[i] = min(dp[i-1] + abs(a[i] - a[i-1]), dp[i-2] + abs(a[i] - a[i-2]));
    cout << dp[n];
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] h = new int[n];
        for(int i = 0;i < n;i++) h[i] = sc.nextInt();
        long[] memo = new long[n];
        for(int i = 0;i < n;i++) memo[i] = -1;
        System.out.println(dp(n, k, h, n - 1, memo));
    }

    private static long dp(int n, int k, int[] h, int i, long[] memo) {
        if(i == 0) return 0;
        else if(memo[i] != -1) return memo[i];
        else {
            long minCost = Long.MAX_VALUE;
            for(int j = k;j > 0;j--) {
                int tmpIdx = i - j;
                long tmpCost = Long.MAX_VALUE;
                if(tmpIdx >= 0) tmpCost = dp(n, k, h, tmpIdx, memo) + Math.abs(h[i] - h[tmpIdx]);
                if(minCost > tmpCost) minCost = tmpCost;
            }

            memo[i] = minCost;
            return minCost;
        }
    }

}


Measured memory_bytes: 60744
#include <iostream>
using namespace std;
int main(void){
  int a;
  cin >> a;
  if (a % 2 == 0){
    cout << (double)0.5 << endl;
  } else {
    cout << (double)(a / 2 + 1)  / (double)(a)   << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef long long ll;

int main(){
  int n, y;

  while(cin >> n, n){
    cin >> y;

    int maxID = -1;
    double maxMon = 0;

    for(int i = 0; i < n; i++){
      int b, r, t;
      cin >> b >> r >> t;

      double cal;

      if(t == 1){ //ツつスツづアツづィ
        cal = 1 + y * (r / 100.0);
      }
      else{
        cal = pow(1 + r / 100.0, y);
      }

      if(maxMon < cal){
        maxMon = cal;
        maxID = b;
      }
    }

    cout << maxID << endl;
  }
}

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

int main() {
  string S, T;
  cin >> S >> T;
  int n = (int)S.size();
  int ans = 0;
  rep(i,n) {
    if(S.at(i) != T.at(i)) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3920
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int readint() {
    return readln.chomp.to!int;
}

int[] readints() {
    return readln.split.map!(to!int).array;
}

/// ?????? ab ?????? p ????????????
bool isOnSegment(Vec2 p, Vec2 a, Vec2 b) {
    auto ab = b - a;
    auto ap = p - a;

    if (ab.cross(ap) != 0)
        return false;

    // ab ??¨ ap ????????????
    if (ab.dot(ap) < 0)
        return false;

    // p ??? ab ?????????????????????
    if (ab.magSq() >= ap.magSq())
        return true;

    return false;
}

/// ab, cd ????????????????????????
bool isIntersectLineSegments(Vec2 a, Vec2 b, Vec2 c, Vec2 d) {
    auto s = (b - a).cross(c - a) * (b - a).cross(d - a);
    auto t = (d - c).cross(a - c) * (d - c).cross(b - c);

    // ??????????????????(????????????????????????)
    if (s < 0 && t < 0)
        return true;

    // ????????????????????????
    if (isOnSegment(c, a, b) || isOnSegment(d, a, b) || isOnSegment(a, c, d) || isOnSegment(b, c, d)) {
        return true;
    }
    return false;
}

double distance(Vec2 a, Vec2 b, Vec2 c, Vec2 d) {

    double dist(Vec2 p, Vec2 a, Vec2 b) {
        auto ab = b - a;
        auto ap = p - a;
        if (ab.dot(ap) < 0)
            return ap.mag();

        auto ba = a - b;
        auto bp = p - b;
        if (ba.dot(bp) < 0)
            return bp.mag();

        return abs(ab.cross(ap)) / ab.mag();
    }

    if (isIntersectLineSegments(a, b, c, d))
        return 0;

    return min(dist(c, a, b), dist(d, a, b), dist(a, c, d), dist(b, c, d));
}

void main() {
    int q = readint();
    for (int i = 0; i < q; i++) {
        auto xs = readints();
        auto a = Vec2(xs[0], xs[1]);
        auto b = Vec2(xs[2], xs[3]);
        auto c = Vec2(xs[4], xs[5]);
        auto d = Vec2(xs[6], xs[7]);

        auto ans = distance(a, b, c, d);
        writefln("%.8f", ans);
    }
}

struct Vec2 {
    immutable double x;
    immutable double y;

    this(double x, double y) {
        this.x = x;
        this.y = y;
    }

    Vec2 opAdd(Vec2 other) {
        return Vec2(this.x + other.x, this.y + other.y);
    }

    Vec2 opSub(Vec2 other) {
        return Vec2(this.x - other.x, this.y - other.y);
    }

    Vec2 opMul(double d) {
        return Vec2(this.x * d, this.y * d);
    }

    double dot(Vec2 other) {
        return this.x * other.x + this.y * other.y;
    }

    double cross(Vec2 other) {
        return this.x * other.y - other.x * this.y;
    }

    double mag() {
        return sqrt(magSq());
    }

    double magSq() {
        return this.x * this.x + this.y * this.y;
    }

    Vec2 normalize() {
        auto m = mag();
        if (m != 0 && m != 1)
            return Vec2(this.x / m, this.y / m);
        return this;
    }

    static double distance(Vec2 a, Vec2 b) {
        return (a - b).mag();
    }
}

Measured memory_bytes: 2964
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(a) (long long)((a).size())
const double pi = 3.14159265358979323846;

bool ok(ll t, vector<ll>&h, ll a, ll b)
{
    ll n = sz(h);
    ll i,j,req=0;
    for(i=0;i<n;i++)
    {
        ll cur = h[i]-b*t;
        if(cur>0) req += (cur+(a-b)-1)/(a-b);
    }
    return (req<=t);
}

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
    
    ll n,a,b,i,j;
    cin>>n>>a>>b;
    vector<ll> h(n);
    for(i=0;i<n;i++) cin>>h[i];
    
    ll x = 0;
    for(ll z=1e10;z>0;z/=2)
    {
        while(!ok(x+z,h,a,b)) x+=z;
    }
    cout<<x+1;
}


Measured memory_bytes: 1024
object Main {

	def main(arg:Array[String]) = {
		var list = scala.io.StdIn.readLine().split(" ").map(_.toInt);
		if(List(list(0), list(1), list(0) + list(1)).exists(_ % 3 == 0)) println("Possible");
		else println("Impossible");
	}

}


Measured memory_bytes: 25412
#include <bits/stdc++.h>
#define x first
#define y second
#pragma gcc optimize("O3")
#pragma gcc optimize("Ofast")
#pragma gcc optimize("unroll-loops")
using namespace std;
const long long INF = 1e18;
typedef long long ll;
typedef long double ld;
typedef pair <int,int> pi;
typedef pair <ll,ll> pl;
typedef vector <int> vec;
ll n;
ll mod = 1e9+7;

ll mpow(ll x,ll m) {
    if(!m) return 1;
    ll tmp = mpow(x,m/2);
    if(m % 2) return tmp*tmp%mod*x%mod;
    else return tmp*tmp%mod;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    if(n == 1) cout << 0;
    else {
        cout << (mpow(10,n)-mpow(9,n)*2+mpow(8,n)+mod*3)%mod << '\n';
    }
}


Measured memory_bytes: 3652
N, K = list(map(int, input().strip().split()))
A = list(map(int, input().strip().split()))

if N == K:
  print('No')
else:
  for n in range(N-K):
    Tgt1 = A[n]
    Tgt2 = A[K+n]
    if Tgt1 < Tgt2:
      print('Yes')
    else:
      print('No')

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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;

#define MAX_NUM (998244353)

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

template <typename T>
static inline T ArraySum(vector<T>& A) {
  T res = 0;
  for (auto itr = A.begin(); itr < A.end(); ++itr) res += *itr;
  return res;
}

bool Sec_compare(pair<uint64_t, uint64_t> a, pair<uint64_t, uint64_t> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

u64 dec_dig(u64 num) {
  u64 res = 0;
  while (num > 0) {
    num /= 10;
    ++res;
  }
  return res;
}

i64 modinv(i64 a, i64 m) {
  i64 b = m, u = 1, v = 0;
  while (b) {
    i64 t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

u64 gcd(u64 a, u64 b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }

  return b ? gcd(b, a % b) : a;
}

i64 My_Comb(u64 n, u64 k, i64 m) {
  if (n < k) return 0;
  if (k == 0 || n == k) return 1;
  u64 res = 1;
  k = (n / 2 < k) ? n - k : k;
  for (u64 i = 1; i <= k; ++i)
    res = (((res * (n + 1 - i)) % m) * modinv(i, m)) % m;
  return res;
}

u64 My_Pow(u64 a, u64 n, i64 m) {
  u64 tmp = n, calc = 1;
  while (tmp > 0) {
    if (tmp % 2) {
      tmp--;
      calc *= a;
      calc %= m;
    } else {
      a *= a;
      a %= m;
      tmp /= 2;
    }
  }
  return calc;
}

int main() {
  cout << setprecision(18);

  i64 N, M, K;
  cin >> N >> M >> K;
  i64 res = 0;
  vector<i64> MI(N), Fact(N), calc(N);
  MI[0] = modinv(1, MAX_NUM);
  Fact[0] = 1;
  calc[0] = 1;
  for (i64 i = 1; i <= N - 1; ++i) {
    // MI[i] = modinv(i, MAX_NUM);
    // Fact[i] = i;
    calc[i] = (calc[i - 1] * (N - i)) % MAX_NUM;
    calc[i] = (calc[i] * modinv(i, MAX_NUM)) % MAX_NUM;
  }
  // i64 calc = 1;
  for (i64 i = 0; i <= K; ++i) {
    i64 Col;
    Col = (M * My_Pow(M - 1, N - i - 1, MAX_NUM)) % MAX_NUM;
    Col = (Col * calc[i]) % MAX_NUM;
    res += Col;
    res %= MAX_NUM;
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 8008
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			long num = sc.nextLong() - 1;
			String name = "";

			while (num >= 0) {
				int mod = (int) (num % 26);
				name = ((char) ('a' + mod) + name);
				num = num / 26 - 1;
			}
			System.out.println(name);
		}
	}
}


Measured memory_bytes: 39328
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){

	int n, ans=0, tmp=0;
	vector<int> v;

	cin>> n;
	v.resize(n);
	for(int i=0;i<n;i++) cin>> v[i];

	for(int i=0;i<n-1;i++){
		if(v[i+1]<=v[i]) tmp++;
		else{
			ans=max(ans, tmp);
			tmp=0;
		}
	}
	ans=max(ans, tmp);

	cout<< ans << endl;

}

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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    string S, T;

    cin >> S >> T;

    cout << (T.find(S) == 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3632