akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
int gcd(int a,int b){if(a<b)swap(a,b);int c=a%b;while(c!=0){a=b;b=c;c=a%b;}return b;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};


int main(){
  int n; cin>>n;
  string s; cin>>s;
  vector<int> rc;
  vector<int> gc;
  vector<int> bc;

  rep(i,n){
    if(s[i]=='R') rc.pb(i);
    else if(s[i]=='G') gc.pb(i);
    else bc.pb(i);
  }

  ll ans=0;
  rep(i,n){
    if(s[i]=='R'){
      //次がg
      auto itg=upper_bound(ALL(gc),i);
      int idg=itg-gc.begin();
      for(int j=idg;j<gc.size();j++){
        // cout<<"j "<<j<<endl;
        auto itb=upper_bound(ALL(bc),gc[j]);
        int idb=itb-bc.begin();
        for(int k=idb;k<bc.size();k++){
          // cout<<"k "<<k<<endl;
          if((gc[j]-i)!=(bc[k]-gc[j])) ans++;
        }
      }
      //次がb
      auto itb=upper_bound(ALL(bc),i);
      int idb=itb-bc.begin();
      for(int j=idb;j<bc.size();j++){
        auto itg=upper_bound(ALL(gc),bc[j]);
        int idg=itg-gc.begin();
        for(int k=idg;k<gc.size();k++){
          if((bc[j]-i)!=(gc[k]-bc[j])) ans++;
        }
      }
    }else if(s[i]=='G'){
      //次がr
      auto itr=upper_bound(ALL(rc),i);
      int idr=itr-rc.begin();
      for(int j=idr;j<rc.size();j++){
        auto itb=upper_bound(ALL(bc),rc[j]);
        int idb=itb-bc.begin();
        for(int k=idb;k<bc.size();k++){
          if((rc[j]-i)!=(bc[k]-rc[j])) ans++;
        }
      }
      //次がb
      auto itb=upper_bound(ALL(bc),i);
      int idb=itb-bc.begin();
      for(int j=idb;j<bc.size();j++){
        auto itr=upper_bound(ALL(rc),bc[j]);
        int idr=itr-rc.begin();
        for(int k=idr;k<rc.size();k++){
          if((bc[j]-i)!=(rc[k]-bc[j])) ans++;
        }
      }
    }else{
      //次がr
      auto itr=upper_bound(ALL(rc),i);
      int idr=itr-rc.begin();
      for(int j=idr;j<rc.size();j++){
        auto itg=upper_bound(ALL(gc),rc[j]);
        int idg=itg-gc.begin();
        for(int k=idg;k<gc.size();k++){
          if((rc[j]-i)!=(gc[k]-rc[j])) ans++;
        }
      }
      //次がg
      auto itg=upper_bound(ALL(gc),i);
      int idg=itg-gc.begin();
      for(int j=idg;j<gc.size();j++){
        auto itr=upper_bound(ALL(rc),gc[j]);
        int idr=itr-rc.begin();
        for(int k=idr;k<rc.size();k++){
          if((gc[j]-i)!=(rc[k]-gc[j])) ans++;
        }
      }
    }
    // cout<<"i "<<i<<endl;
    // cout<<ans<<endl;
  }

  cout<<ans<<endl;


  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cmath>

void dump(int a[],int n)
{
  for (int codeTest = 0; codeTest < n; ++codeTest) {
    if (codeTest!=0)std::cout << " ";
    std::cout << a[codeTest];
  }
  std::cout << '\n';
}


int main() {
  int n,q,i,bit;
  int a[20],m[200],sum[(1<<20)];
  std::cin >> n;
  for (i = 0; i < n; ++i) {std::cin >> a[i];}
  std::cin >> q;
  for (i = 0; i < q;++i) {std::cin >> m[i];}
  for (bit = 0; bit < (1<<n); ++bit) {
    sum[bit]=0;
    for (i = 0; i < n; ++i){
      if (bit&(1<<i)){
        sum[bit]+=a[i];
      }
    }
  }
  for (i = 0; i < q; ++i) {
    for (bit = 0; bit < (1<<n); ++bit) {
      if (m[i]==sum[bit]){
        std::cout << "yes" << '\n';
        bit=(1<<n);
      }
    }
    if (bit!=(1<<n)+1)std::cout << "no" << '\n';

  }
}



Measured memory_bytes: 7132
n,k = map(int,input().split())
s = [1 if ele=="L" else 0 for ele in input()]

if s[0]==0:
    s=[(1-ele) for ele in s]

before = s[0]
cnt=0
for si in s:
    if si != before:
        cnt += 1
    before = si

score_max = len(s)-1
print(min(score_max, score_max-cnt+k*2))

Measured memory_bytes: 4636
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#include<cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<char,int>;

const ll MOD = INF + 7;


int main(){
   string s;
   cin >> s;
   vector<vector<int>> list(2000000);
   int now = 0;
   rep(i, s.size() - 1){
       if(s[i] == 'A'){
           list[now].push_back(0);
       }
       else if(s.substr(i, 2) == "BC"){
           list[now].push_back(1);
           i++;
       }
       else {
           now++;
       }
   }
   list[now].push_back(INF);
   
   ll res = 0;
   rep(i, now+1){
       ll end = list[i].size() - 1;
       if(list[i][list[i].size()-1] == INF)end--;
       rep(j, list[i].size()){
           if(list[i][j] == INF){
               cout << res << endl;
               return 0;
           }
           if(list[i][j] == 0){
               res += (end - j);
               end--;
           }
       }
   }
}



Measured memory_bytes: 51548
// https://atcoder.jp/contests/tenka1-2017/tasks/tenka1_2017_c
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    FOR(i, 1, 3501) {
        FOR(j, 1, 3501) {
            double t = 4.0 / n - 1.0 / i - 1.0 / j;
            if (abs(t) <= DBL_EPSILON || t < 0)
                continue;
            ll k = round(1.0 / t);
            if ((i * j + j * k + k * i) * n == 4 * i * j * k) {
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 384
h, w = gets.split.map(&:to_i)
s = Array.new(h + 1).map{Array.new(w + 1, 0)}
1.upto(h) do |i|
  c = 0
  l = 1
  b = gets.chomp.bytes
  1.upto(w) do |j|
    if b[j - 1] == 46
      l = j if c == 0
      c += 1
    elsif c > 0
      s[i][l, j - l] = Array.new(j - l, c)
      c = 0
    end
    if j == w && c > 0
      s[i][l, j - l + 1] = Array.new(j - l + 1, c)
    end
  end
end
ans = 0
1.upto(w) do |j|
  c = 0
  l = 1
  1.upto(h) do |i|
    if (s[i][j] > 0)
      l = i if c == 0
      c += 1
    elsif c > 0
      l.upto(i - 1) do |k|
        ans = s[k][j] + c if ans < s[k][j] + c
      end
      c = 0
    end
    if i == h && c > 0
      l.upto(i) do |k|
        ans = s[k][j] + c if ans < s[k][j] + c
      end
    end
  end
end
puts ans - 1

Measured memory_bytes: 88028
#include<iostream>

using namespace std;

int main(){
  int H, W, k = 1;
  while(k > 0){
    cin >> H >> W;
    if(H == 0 && W == 0)
      break;
    for(int i=1; i<=H; i++){
      for(int n=1; n<=W; n++){
        if(i%2 == 1 && n%2 == 1 || i%2 == 0 && n%2 == 0){
	  cout << "#";
        }else if(i%2 == 1 && n%2 == 0 || i%2 == 0 && n%2 == 1){
	  cout << ".";
        }
      }
      cout << endl;  
      }
      cout << endl;
   }
   return 0;
}



Measured memory_bytes: 3068
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

Graph g;

vector<int> color; 
bool dfs(int v, int c = 0){
  color[v] = c;
  for(auto nv : g[v]){
    if(color[nv] != -1){ 
      if(color[nv] == c)return false; 
    }
    else if(!dfs(nv, 1 - c))return false;
  }

  return true;
}

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

  g.resize(n);
  for(int i = 0; i < m; ++i){
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  color.assign(n, -1);
  if(dfs(0)){
    int whiteCount = 0;
    for(int i = 0; i < n; ++i){
      if(color[i] == 0)++whiteCount;
    }
    cout << whiteCount * (n - whiteCount) - m << endl;
  }
  else cout << n * (n - 1) / 2 - m << endl;
}


Measured memory_bytes: 6528
/*
2020-05-02
atcoder ABC
C - Rally
*/

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const ll mod = 1000000007;

int main() {
    ull ans = 0, cur = 100;
    ull X;
    cin >> X;

    while (cur < X){
        cur = floor(cur * 1.01);
        ans++;
    }
    cout << ans << endl;

    
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
template <typename T> void chmax(T &x,const T &y)
{
	if(x<y)x=y;
}
typedef long long ll;
typedef unsigned int ui;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
int a[3][105],dp[3][105];
int main()
{
	int	n; 
	cin>>n;
	rep(j,1,2)
	rep(i,1,n)cin>>a[j][i];
	rep(j,1,2)
	rep(i,1,n)dp[j][i]=max(dp[j][i-1],dp[j-1][i])+a[j][i];
	cout<<dp[2][n];
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
 
struct SegmentTree
{
  vector< int64 > data, lazy;
  int sz;
 
  SegmentTree(int n)
  {
    sz = 1;
    while(sz < n) sz <<= 1;
    data.assign(2 * sz - 1, 0LL);
    lazy.assign(2 * sz - 1, 0LL);
  }
  inline void Push(int k)
  {
    lazy[2 * k + 1] += lazy[k] / 2;
    lazy[2 * k + 2] += lazy[k] / 2;
    lazy[k] = 0;
  }
  inline void RangeAdd(int a, int b, int64 x, int k, int l, int r)
  {
    if(a >= r || b <= l) return;
    if(a <= l && r <= b) {
      lazy[k] += (r - l) * x;
    } else {
      Push(k);
      RangeAdd(a, b, x, 2 * k + 1, l, (l + r) >> 1);
      RangeAdd(a, b, x, 2 * k + 2, (l + r) >> 1, r);
      data[k] = data[2 * k + 1] + lazy[2 * k + 1] + data[2 * k + 2] + lazy[2 * k + 2];
    }
  }
  void RangeAdd(int a, int b, int64 x)
  {
    RangeAdd(a, b, x, 0, 0, sz);
  }
  inline int64 RangeSum(int a, int b, int k, int l, int r)
  {
    if(a >= r || b <= l) return(0);
    if(a <= l && r <= b) return(data[k] + lazy[k]);
    Push(k);
    return(RangeSum(a, b, 2 * k + 1, l, (l + r) >> 1) + RangeSum(a, b, 2 * k + 2, (l + r) >> 1, r));
  }
  int64 RangeSum(int a, int b)
  {
    return(RangeSum(a, b, 0, 0, sz));
  }
};
 
int N, Q;
int X[200000], D[200000], L[200000];
 
 
  
int main()
{
  
  scanf("%d %d", &N, &Q);
  for(int i = 0; i < Q; i++) {
    scanf("%d %d %d", &X[i], &D[i], &L[i]);
  }
 
  SegmentTree xpy(N + 1), xmy(N + 1);
  for(int i = 1; i < N + 1; i++) {
    xpy.RangeAdd(i, i + 1, i);
    xmy.RangeAdd(i, i + 1, i);
  }
 
  for(int i = Q - 1; i >= 0; i--) {
    if(D[i] == 1) {
      int low = 0, high = N + 1;
      while(high - low > 0) {
        int mid = (low + high + 1) >> 1;
        int64 Sum = xpy.RangeSum(mid, mid + 1);
        if(Sum <= X[i]) low = mid;
        else high = mid - 1;
      }
      xmy.RangeAdd(0, low + 1, -L[i] * 2);
    } else {
      int low = 0, high = N + 1;
      while(high - low > 0) {
        int mid = (low + high) >> 1;
        int64 Sum = xmy.RangeSum(mid, mid + 1);
        if(Sum <= X[i]) low = mid + 1;
        else high = mid;
      }
      xpy.RangeAdd(low, N + 1, L[i] * 2);
    }
  }
  for(int i = 1; i <= N; i++) {
    printf("%lld\n", (xpy.RangeSum(i, i + 1) - xmy.RangeSum(i, i + 1)) / 2);
  }
}

Measured memory_bytes: 19740
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');

        var pNum = int.Parse(input[0]);
        var cNum = int.Parse(input[1]);

        var dict = new Dictionary<int, Dictionary<int, int>>();

        for (var i = 0; i < cNum; i++)
        {
            var line = Console.ReadLine().Split(' ');
            var prefecture = int.Parse(line[0]);
            var year = int.Parse(line[1]);

            if (dict.ContainsKey(prefecture))
            {
                dict[prefecture].Add(i, year);
            }
            else
            {
                var d = new Dictionary<int, int>();
                d.Add(i, year);
                dict.Add(prefecture, d);
            }
        }

        var ansDict = new Dictionary<int, string>();

        for(var i = 1; i <pNum + 1; i++)
        {
            if (dict.ContainsKey(i))
            {
                var d = dict[i];
                var sortedDict = d.OrderBy(_ => _.Value);
                var j = 1;
                foreach (var city in sortedDict)
                {
                    ansDict.Add(city.Key, i.ToString("000000") + j.ToString("000000"));
                    j++;
                }
            }
        }

        var sortedAns = ansDict.OrderBy(_ => _.Key);
        foreach(var ans in sortedAns)
        {
            Console.WriteLine(ans.Value);
        }


        Console.ReadLine();

    }

  
}


Measured memory_bytes: 57820
import java.util.HashMap;
import java.util.Map;
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();
			int k = scanner.nextInt();
			Map<Integer, Integer> numberCountMap = new HashMap<>();
			IntStream.range(0, n).forEach(i -> {
				int number = scanner.nextInt();
				numberCountMap.put(number, numberCountMap.getOrDefault(number, 0) + 1);
			});
			int size = numberCountMap.size();
			if (size <= k) {
				System.out.println(0);
			} else {
				System.out.println(
						numberCountMap.entrySet().stream().mapToInt(x -> x.getValue()).sorted().limit(size - k).sum());
			}
		}
	}
}


Measured memory_bytes: 101120
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;
    int a[5][110];
    for(int i=1;i<=n;i++)cin>>a[1][i];
    for(int i=1;i<=n;i++)cin>>a[2][i];
    int ans=0;
    for(int i=1;i<=n;i++){
        int cnt=0;
        for(int j=1;j<=n;j++){
	    if(j<=i)cnt+=a[1][j];
	    if(j>=i)cnt+=a[2][j];
	}
        ans=max(ans,cnt);
    }
    cout<<ans<<endl;
}

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

using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	int x = 1;
	int a = 26;
	int sum = 0;
	while (a < N) {
		x++;
		N -= a;
		a *= 26;
	}
	N--;
	string res = "";
	for (int i = 0; i < x; i++) {
		res.push_back((N % 26) + 'a');
		N /= 26;
	}
	reverse(res.begin(), res.end());
	cout << res << endl;
}

Measured memory_bytes: 3652
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String s = br.readLine();
		String t = br.readLine();

		boolean flag = false;

		for (int i = 0; i < t.length(); i++) {
			if (t.equals(s)) {
				flag = true;
				break;
			}
			s = s.charAt(s.length() - 1) + s.substring(0, s.length() - 1);
		}

		System.out.println(flag ? "Yes" : "No");

	}

}


Measured memory_bytes: 21204
N = int(input())
H = [int(i) for i in input().split()]
ans = True
prev = -999
peek = 0
for i in range(N):
    h = H[i]
    if prev <= H[i] - 1:
        prev = H[i] - 1
    elif prev <= H[i]:
        prev = H[i]
    else:
        ans = False
        break
print("Yes" if ans else "No")


Measured memory_bytes: 14396
from math import atan, degrees
a, b, x = map(int, input().split())
if x == a * b * b:
    print(0)
else:
    x = x / a ** 2
    if x >= b / 2:
        print(90-degrees(atan(a / (2 * b - 2 * x))))
    else:
        print(90-degrees(atan(2 * a * x / b ** 2)))


Measured memory_bytes: 9332
#include <stdio.h>
#include <string.h>
int main(){
int D=0;
  scanf("%d",&D);
if(D==25){
printf("Christmas");
}else if(D==24){
printf("Christmas Eve");
}else if(D==23){
printf("Christmas Eve Eve");
}else if(D==22){
printf("Christmas Eve Eve Eve");
}

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <cstdio>

using namespace std;

double r(double x1[2], double x2[2]){
        return pow(pow(x1[0]-x2[0],2)+pow(x1[1]-x2[1],2),0.5);
}
int main(){
        int n = 0;
        char c;
        double x[20][2];
        double s = 0;
        while(cin >> x[n][0] >> c >> x[n][1]) ++n;
        for(int i = 1; i < n-1; i++){
                double d[3] = {0};
                d[0] = r(x[0],x[i]);
                d[1] = r(x[0],x[i+1]);
                d[2] = r(x[i],x[i+1]);
                double z = (d[0]+d[1]+d[2])/2;
                s += pow(z*(z-d[0])*(z-d[1])*(z-d[2]),0.5);
        }   
        printf("%.6f\n",s);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  int64_t A, B, K;
  cin >> A >> B >> K;
  if (A>=K) {
    cout << A-K << " " << B << endl;
  }
  else {
    if (A+B>=K) {
      cout << 0 << " " << A+B-K << endl;
    }
    else {
      cout << 0 << " " << 0 << endl;
    }
  }
}

Measured memory_bytes: 3620
import numpy as np
n,d=map(int, input().split())
p=[]
for i in range(n):
    p.append(np.array(list(map(int, input().split()))))

ans=0
for i in range(n):
    for j in range(i+1,n):
        val=np.sqrt(np.power(p[i]-p[j], 2).sum())
        if float.is_integer(val):
            ans+=1

print(ans)

Measured memory_bytes: 13108
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

typedef long long ll;
typedef vector <ll> v_ll;
typedef vector <vector <ll> > vv_ll;
typedef vector < pair <ll,ll> > vp_ll;
typedef pair <ll,ll> p_ll;

string S;
ll n1,n2;
int main(){
  cin >>S;
  n1=(S[0]-'0')*10+(S[1]-'0');
  n2=(S[2]-'0')*10+(S[3]-'0');
  //cout << n1 << n2 << endl;
  if ((n1<1 || n1>12) && (n2<1 || n2>12)) cout << "NA" << endl;
  else if (n1<1 || n1>12) cout << "YYMM" << endl;
  else if (n2<1 || n2>12) cout << "MMYY" << endl;
  else cout << "AMBIGUOUS" << endl;
}


Measured memory_bytes: 760
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(all(x));
#define RSORT(x) sort(rall(x));
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using vb = vector<bool>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;
const ll inf = 1ll<<29;
const ll mod = 1000000007;      
const double eps = 1e-9;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};

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() {
  ll S; cin >> S;

  const int v = 1000000000;
  ll X3 = (v-S%v)%v;
  ll Y3 = (S+X3)/v;

  cout << "0 0 1000000000 1 " << X3 << " " << Y3 << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

for i in range(N - 1):
    if A[i] + 1 == A[i + 1]:
        B.append(C[A[i] - 1])

print(sum(B))

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>

int main()
{
    char a[3];
    int i;
    int flag=1;
    for(i=0;i<3;i++)
    a[i]=getchar();
    if(a[0]==a[1])
    {
        if(a[1]==a[2])
            flag=0;
    }
    if(flag==0)
        printf("No");
    else
        printf("Yes");
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
	int i;
	int N;
	char S[100000];
	char top;
	int ans = 0;

	scanf("%d", &N);
	scanf("%s", &S);

	for (i = 0; i < N - 1; i++) {
		if (S[i] == S[i + 1]) {
			S[i] = 'A';
			top = S[i + 1];
		}
	}

	for (i = 0; i < N; i++) {
		if (S[i] != 'A') {
			ans++;
		}
	}

	printf("%d", ans);

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	static PrintWriter out;
	
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		
		long k = sc.nextInt();
		long A = sc.nextInt();
		long B = sc.nextInt();
		long ans = A;
		long ans2 = k+1;
		if(k < A-1) {
			k = 0;
		}
		
		if(k>0) {
		
			k-= (A-1);
			
			if(B > A) {
				if(k%2 != 0) {
					k--;
					ans++;
					}
				
				ans+= ((k/2)*B - (k/2)*A);
			}
			
			else if (B == A) {
				ans = B;
			}

			else if(B < A) {
				ans = k+1;
			}
		}
			
		out.println(Math.max(ans2,ans));
		out.flush();
	}
}
	
class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

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

	public double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public char nextChar() throws IOException {
		return next().charAt(0);
	}

	public Long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	public boolean ready() throws IOException {
		return br.ready();
	}

	public void waitForInput() throws InterruptedException {
		Thread.sleep(3000);
	}

}


Measured memory_bytes: 22868
s = str(input())
n = len(s)
s1 = ""
s2 = ""
for i in range(n):
    if(i&1):
        s1 += "0"
        s2 += "1"
    else:
        s1 += "1"
        s2 += "0"
ans1 = 0 ; ans2 = 0
for i in range(n):
    if(s[i] != s1[i]):
        ans1 += 1
    if(s[i] != s2[i]):
        ans2 += 1
print(min(ans1 , ans2))


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007 
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int n;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--){
        int n,k;
        cin>>n>>k;
        int a[n];
        for(int i=0;i<n;i++){
            cin>>a[i];
        }
        ll b[2][k+2];
        b[0][0]=1ll;
        for(int i=1;i<=k+1;i++)
            b[0][i]=0ll;
        for(int i=0;i<n;i++){
            for(int j=0;j<=k+1;j++)
                b[(i+1)%2][j]=0ll;
            for(int j=0;j<=k;j++){
                b[(i+1)%2][j]+=b[i%2][j];
                b[(i+1)%2][min(k+1,j+a[i]+1)]-=b[i%2][j];            
            }
            for(int j=1;j<=k+1;j++)
                b[(i+1)%2][j]=(b[(i+1)%2][j]+b[(i+1)%2][j-1]+MOD)%MOD;
        }
        cout<<b[n%2][k]<<"\n";
    }
    return 0;
}

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

public class Main {
    private void solve() {
        int K = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();

        for (int i = A; i <= B; ++i) {
            if (i % K == 0) {
                out.println("OK");
                return;
            }
        }
        out.println("NG");
    }

    private static PrintWriter out;
    private static MyScanner sc;

    private static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        private MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    public static void main(String[] args) {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        sc = new MyScanner();
        new Main().solve();
        out.close();
    }
}


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

using namespace std;

int main() {
    int K;
    int A, B;
    cin >> K >> A >> B;

    bool canDivideK = false;
    for (int i = A; i <= B; i++) {
        if (i % K == 0) {
            canDivideK = true;
        }
    }

    if (canDivideK) {
        cout << "OK" << endl;
    } else {
        cout << "NG" << endl;
    }

    return 0;
}

Measured memory_bytes: 3636
import sys
from collections import deque

sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n,x,y = map(int, input().split())

g = [[] for _ in range(n)]

for i in range(1, n):
    a = i - 1
    b = i
    g[a].append(b)
    g[b].append(a)
x -= 1
y -= 1
g[x].append(y)
g[y].append(x)


ans = [0] * n
for i in range(n):
    stack = deque()
    dis = [0] * n
    seen = [False] * n
    stack = deque()
    stack.append(i)
    seen[i] = True
    while stack:
        v = stack.popleft()
        for nv in g[v]:
            if seen[nv]:
                continue
            dis[nv] = dis[v] + 1
            seen[nv] = True
            stack.append(nv)
    for j in range(n):
        ans[dis[j]] += 1

for i in range(1, n):
    print(ans[i] // 2)


Measured memory_bytes: 76732
using System;
using System.Collections.Generic;

public class Test
{
	public static void Main()
	{
		// your code goes here
		List<string> list = new List<string>();
		
		int N, count = 0;
		
		N = int.Parse(Console.ReadLine());
		string[] line = Console.ReadLine().Split(' ');
		
		for(int i=0;i<N;i++)
		{
			if(0>list.IndexOf(line[i]))
			{
				count++;
				list.Add(line[i]);
			}
		}
		if(count==3)
		{
			Console.WriteLine("Three");
		}
		else
		{
			Console.WriteLine("Four");
		}
	}
	

}

Measured memory_bytes: 11100
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>

int main(void){
    int h,w;
    scanf("%d%d",&h,&w);
    int n=h*w;
    int a[h][w],ans1[n],ans2[n],ans3[n],ans4[n];
    for (int i=0; i<h; i++){
        for (int j=0; j<w; j++){
            scanf("%d",&a[i][j]);
        }
    }
    int count=0;
    bool zero=false;
    for (int i=0; i<h; i++){
        if (i%2==0){
            for (int j=0; j<w; j++){
                if (a[i][j]==0 && zero==false){
                    continue;
                } else {
                    zero=true;
                }
                if (i==h-1 && j==w-1){
                    break;
                }
                if (j+2<=w){
                    if (a[i][j]%2==1){
                        a[i][j]--;
                        a[i][j+1]++;
                        ans1[count]=i+1;
                        ans2[count]=j+1;
                        ans3[count]=i+1;
                        ans4[count]=j+2;
                        count++;
                    }
                } else {
                    if (a[i][j]%2==1){
                        a[i][j]--;
                        a[i+1][j]++;
                        ans1[count]=i+1;
                        ans2[count]=j+1;
                        ans3[count]=i+2;
                        ans4[count]=j+1;
                        count++;
                    }
                }
            }
        } else {
            for (int j=w-1; j>=0; j--){
                if (a[i][j]==0 && zero==false){
                    continue;
                } else {
                    zero=true;
                }
                if (i==h-1 && j==0){
                    break;
                }
                if (j!=0){ 
                    if (a[i][j]%2==1){
                        a[i][j]--;
                        a[i][j-1]++;
                        ans1[count]=i+1;
                        ans2[count]=j+1;
                        ans3[count]=i+1;
                        ans4[count]=j;
                        count++;
                    }
                } else {
                    if (a[i][j]%2==1){
                        a[i][j]--;
                        a[i+1][j]++;
                        ans1[count]=i+1;
                        ans2[count]=j+1;
                        ans3[count]=i+2;
                        ans4[count]=j+1;
                        count++;
                    }
                }
            }
        }
    }
    printf("%d\n",count);
    for (int i=0; i<count; i++){
        printf("%d %d %d %d\n",ans1[i],ans2[i],ans3[i],ans4[i]);
        
    }
    
    
    
    
    
	return 0 ;
}


Measured memory_bytes: 6912
#include <iostream>


int main() {

    int N, K;
    std::cin >> N >> K;

    long long int MAX = 1000000007;
    long long int min = 0, max = 0;
    long long int idx_min = 0, idx_max = N;
    for (;idx_min < K; idx_min++, idx_max--) {
        min += idx_min;
        max += idx_max;
    }
    long long int sum = 0;
    for (;idx_min <= N + 1; idx_min++, idx_max--) {
        sum += max - min + 1;
        sum = sum % MAX;
        min += idx_min;
        max += idx_max;
    }
    std::cout << sum << std::endl;
}


Measured memory_bytes: 3220
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
    int h, w;
    int hnum, wnum;

    cin >> h >> w;
    cin >> hnum >> wnum;

    cout << h * w - h * wnum - ( w - wnum ) * hnum << endl;


    return 0;
}

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

#define N 200010
#define pii pair <int, int>
#define fi first
#define se second
int n, q;
struct node {
	int s, t, x;
	void scan() {
		scanf("%d%d%d", &s, &t, &x); 
		s -= x;
		t -= x; 
	}
	bool operator < (const node &other) const {
		return x < other.x; 
	}
}qrr[N];
set <pii> se;
int res[N];

int main() {
	while (scanf("%d%d", &n, &q) != EOF) {
		memset(res, -1, sizeof res);
		se.clear(); 
		for (int i = 1; i <= n; ++i) {
			qrr[i].scan();
		}
		sort(qrr + 1, qrr + 1 + n);
		for (int i = 1, d; i <= q; ++i) {
			scanf("%d", &d);
			se.insert(pii(d, i)); 
		}
		for (int i = 1; i <= n; ++i) {
			if (qrr[i].t <= 0) {
				continue;
			}
			while (!se.empty()) {
				auto pos = se.lower_bound(pii(qrr[i].s, -1));
				if (pos == se.end()) {
					break;
				}
				if ((*pos).fi < qrr[i].t) {
					res[(*pos).se] = qrr[i].x;
					se.erase(pos);
				} else {
					break;
				}
			}
		}
		for (int i = 1; i <= q; ++i) {
			printf("%d\n", res[i]); 
		}
	}
	return 0;
}


Measured memory_bytes: 14336
#include<iostream>
using namespace std;
int main()
{
  const int n=100;
  int time[n]={},prono[n]={},newtime[n]={};
  int i=0,j=0,sum=0;
  int no;
  cin >> no;
  while(i<no && cin>>time[i]){
    sum+=time[i];
    i++;
  }
  int drinkno;
  cin >> drinkno;
  while(j<drinkno && cin >>prono[j] >> newtime[j]){
    j++;
  }
  int newsum=sum;
  for(int k=0;k<drinkno;k++){
      newsum=sum-time[prono[k]-1]+newtime[k];
      cout << newsum << endl;
  }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Contest
{
    class Scanner
    {
        private string[] line = new string[0];
        private int index = 0;
        public string Next()
        {
            if (line.Length <= index)
            {
                line = Console.ReadLine().Split(' ');
                index = 0;
            }
            var res = line[index];
            index++;
            return res;
        }
        public int NextInt()
        {
            return int.Parse(Next());
        }
        public long NextLong()
        {
            return long.Parse(Next());
        }
        public string[] Array()
        {
            line = Console.ReadLine().Split(' ');
            index = line.Length;
            return line;
        }
        public int[] IntArray()
        {
            return Array().Select(int.Parse).ToArray();
        }
        public long[] LongArray()
        {
            return Array().Select(long.Parse).ToArray();
        }
    }
    struct SS
    {
        public int X, Y;
        public SS(int x, int y)
        {
            X = x;
            Y = y;
        }
    }

    class Program
    {
        private int N;
        private void Scan()
        {
            var sc = new Scanner();
            N = sc.NextInt();
        }

        public void Solve()
        {
            Scan();
            Console.WriteLine(N / 3);

        }

        static void Main(string[] args)
        {
            new Program().Solve();
        }
    }
}

Measured memory_bytes: 11092
n,m=map(int,input().split())
a=[int(i) for i in input().split()]
b=0
c=0
for j in range(n):
	b+=a[j]
for k in range(n):
	if b/(4*m)<=a[k]:
		c+=1
if c>=m:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 3064
from collections import Counter

N = int(input())
A = sorted([int(x) for x in input().split()], reverse=True)
C = Counter(A)

ans = 0
for a in A:
    if C[a] == 0:
        continue
    pt = 2 ** len(format(a, 'b'))
    C[a] -= 1
    if C[pt - a] >= 1:
        C[pt - a] -= 1
        ans += 1
print(ans)


Measured memory_bytes: 33416
#include<iostream>
#include<cstring>
using namespace std;
int t[55][55];
int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	while(cin>>n>>m){
		if(!n)break;
		memset(t,0,sizeof(t));
		for(i=0;i<n;i++)t[0][i]=n-i;
		for(i=0;i<m;i++){
			cin>>a>>b;
			for(j=0;j<n;j++){
				if(j<b)t[i+1][j]=t[i][a+j-1];
				else if(j<a+b-1)t[i+1][j]=t[i][j-b];
				else t[i+1][j]=t[i][j];
			}
		}
		cout<<t[m][0]<<endl;
	}
}



Measured memory_bytes: 3024
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define EPS 0.0000000001
#define INF 1000000000
#define MOD 1000000007
typedef long long ll;

int main()
{
    int a,b;
    cin>>a>>b;
    cout<<a*b-a-b+1;
}


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

using namespace std;
using namespace atcoder;
typedef long long ll;

/*
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
void Add(ll &pos,ll val){pos=mod(pos+val);}
void mod_print(ll k){
    ll P=50000;
    rep(y,1,P){
        ll x=mod(y*k);
        
        if(abs(x)<=P||x+P>=i_7){
            if(x+P>=i_7){
                x-=i_7;
            }
            cout<<x<<"/"<<y<<endl;
            //cout<<setprecision(5)<<(dd)x/(dd)y;
            return;
        }
    }
    cout<<"nun"<<endl;
}
*/

#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

typedef long double dd;
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
dd EPS=1E-12;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second

#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
#define endl "\n"  //インタラクティブで消す！！！！！！！！！！！！！！！！！！！！！
#define all(c) c.begin(),c.end()
typedef vector<ll> vl;


//using mint = modint998244353;
using mint = modint1000000007;
//////////////////////////

int main(){fastio
    
    ll n,m;cin>>n>>m;
    scc_graph g(n);
    while(m--){
        ll a,b;cin>>a>>b;
        g.add_edge(a,b);
    }
    auto v=g.scc();
    cout<<v.size()<<endl;
    for(auto x:v){
        cout<<x.size()<<" ";
        for(auto y:x)cout<<y<<" ";
        cout<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 40624
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=1e5+10;
ll a[maxn];
int main()
{
    ll i,j,k,m,n;
    cin>>n;
    ll cnt=0,ans=0,sum=0;
    for(i=1; i<=n; i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    if((2*sum)%(n*(n+1))!=0)
    {
        cout<<"NO"<<endl;
        return 0;
    }
    else
    {
        ans=(2*sum)/(n*(n+1));
        for(i=1; i<=n; i++)
        {
            if(i==n)
            {
                if((a[i]-a[1]+ans)%n!=0||(a[i]-a[1]+ans)<0)
                {
                    cout<<"NO"<<endl;
                    return 0;
                }
            }
            else
            {
                if((a[i]-a[i+1]+ans)%n!=0||(a[i]-a[i+1]+ans)<0)
                {
                    cout<<"NO"<<endl;
                    return 0;
                }
            }
        }
        cout<<"YES"<<endl;
    }
    return 0;
}


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

void swap (int *x, int *y) {
  int temp;    // 値を一時保存する変数

  temp = *x;
  *x = *y;
  *y = temp;
}

/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (int array[], int left, int right) {
  int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}





int main(void){
   int N,i,p[50],cou=0,q[50];
   scanf("%d",&N);
   for(i=0;i<N;i++){
      scanf("%d",&p[i]);
      q[i]=p[i];
   }
   quick_sort(p,0,N-1);
   for(i=0;i<N;i++){
      if(q[i]!=p[i]){
         cou++;
      }
   }
   if((cou==2)||(cou==0)){
      printf("YES");
   }else{
      printf("NO");
   }
   return 0;
}


Measured memory_bytes: 128
import numpy as np
N = int(input())
hlist = list(map(int, input().split()))
inf = float("inf")
dp = np.full(N, inf, dtype=int)
dp[0] = 0
dp[1] = abs(hlist[1] - hlist[0])
for i in range(2, N):
    dp[i] = min(dp[i - 2] + abs(hlist[i - 2] - hlist[i]), dp[i - 1] + abs(hlist[i - 1] - hlist[i]))
print(dp[-1])


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

template <ll mod> class modint
{
private:
    ll x;
public:
    modint(ll a = 0) : x(a % mod) {}
    modint& operator+=(const modint rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    modint& operator-=(const modint rhs) {
        if ((x += mod - rhs.x) >= mod) x -= mod;
        return *this;
    }
    modint& operator*=(const modint rhs) {
        (x *= rhs.x) %= mod;
        return *this;
    }
    modint& operator/=(const modint rhs) {
        *this *= rhs.inv();
        return *this;
    }
    modint operator+(const modint rhs) const {return modint(*this) += rhs;}
    modint operator-(const modint rhs) const {return modint(*this) -= rhs;}
    modint operator*(const modint rhs) const {return modint(*this) *= rhs;}
    modint operator/(const modint rhs) const {return modint(*this) /= rhs;}

    modint pow(long long n) const {
        modint e = *this, ret = (modint)1;
        while (n) {
            if (n & 1) ret *= e;
            e *= e, n >>= 1;
        }
        return ret;
    }

    modint inv() const {
        return pow(mod - 2);
    }

    friend ostream& operator<<(ostream& os, const modint<mod>& m) {
        os << m.x;
        return os;
    }
};
using mint = modint<1000000007>;

template <typename T> class Combination
{
private:
    vector<T> _fact, _inv_fact;
    
public:
    Combination(int size) : _fact(size + 1), _inv_fact(size + 1) {
        _fact[0] = 1;
        for (int i = 1; i <= size; i++) _fact[i] = _fact[i-1] * i;
        _inv_fact[size] = (T)1 / _fact[size];
        for (int i = size - 1; i >= 0; i--) _inv_fact[i] = _inv_fact[i+1] * (i+1);
    }

    T fact(int k) const {return _fact[k];}
    T inv_fact(int k) const {return _inv_fact[k];}

    T P(int n, int r) {
        if (r < 0 || n < r) return 0;
        else return fact(n) * inv_fact(n - r);
    }

    T C(int n, int r) {
        if (r < 0 || n < r) return 0;
        else return fact(n) * inv_fact(r) * inv_fact(n - r);
    }

    T H(int n, int r) {
        if (n < 0 || r < 0) return 0;
        else return r == 0 ? 1 : C(n + r - 1, r);
    }
};

map<ll, int> factorize(ll n)
{
    map<ll, int> mp;
    for (ll i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            mp[i]++; n /= i;
        }
    }
    if (n != 1) mp[n] = 1;
    return mp;
}

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

    auto fac = factorize(m);
    int max_pw = 0;
    for (auto& e: fac) {
        if (e.second > max_pw) max_pw = e.second;
    }

    mint ans = 1;
    Combination<mint> cb(n + max_pw);
    for (auto& e: fac) {
        ans *= cb.H(n, e.second);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003,INF=1<<30;

int main(){
    
    int N,K;cin>>N>>K;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    
    int dp[N+1][256][N+1];
    for(int i=0;i<N+1;i++){
        for(int j=0;j<256;j++){
            for(int k=0;k<N+1;k++){
                dp[i][j][k]=0;
            }
        }
    }
    
    dp[0][0][0]=1;
    
    for(int i=0;i<N;i++){
        for(int j=0;j<256;j++){
            for(int k=0;k<=N;k++){
                if(k) dp[i+1][j][k]=(dp[i][(j^A[i])][k-1]+dp[i][j][k])%mod;
                else dp[i+1][j][k]=dp[i][j][k];
            }
        }
    }
    
    vector<ll> P(N+1,0);
    ll x=1;
    P[0]=1;
    for(int i=1;i<=N;i++){
        x*=i;
        x=x%mod;
        P[i]=x;
    }
    
    ll ans=0;
    
    for(int k=0;k<=N;k++){
        ans+=P[k]*dp[N][K][k];
        ans=ans%mod;
    }
    
    cout<<ans<<endl;
    
}



Measured memory_bytes: 10496
#!/usr/bin/env python3
#coding: utf-8

# Volume0 - 0001 (http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0001)

li = []
for x in range(10):
    s = input()
    s = int(s)
    li.append(s)

li.sort()
li.reverse()

for y in range(3):
    print(li[y])

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

#define int long long

signed main() {
    string s;
    cin >> s;
    string t = "CODEFESTIVAL2016";
    int ans = 0;
    for(int i=0; i<t.size(); ++i) if(s[i]!=t[i]) ans++;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<ctime>
#include<iostream>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<iomanip>
#include<list>
#include<bitset>
#include<sstream>
#include<fstream>
#include<complex>
#include<algorithm>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#define ll long long
using namespace std;
const int INF = 0x3f3f3f3f;
double pi=acos(-1.0); 
int main(){
	//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	double n;
	scanf("%lf",&n);
	printf("%.15lf\n",n*pi*2);
    return 0;
}


Measured memory_bytes: 3824
n = int(input())
pls = list(map(int,input().split()))
ans = 0
for r in range(1,n-1): 
    mls = [pls[r-1],pls[r],pls[r+1]]
    mls.sort()
    if mls[1] == pls[r]:
        ans += 1
print(ans)

Measured memory_bytes: 3060
function Main(input) {

	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n").filter(Boolean);
    input.shift();
    
    let xy = input.map(val => val.split(" ").map(Number));

    let arr0 = xy.map(val => val[0] + val[1]).sort((a, b) => (a < b) ? -1 : ((a > b) ? 1 : 0));
    let arr1 = xy.map(val => val[0] - val[1]).sort((a, b) => (a < b) ? -1 : ((a > b) ? 1 : 0));
    
    let arr0_calc = arr0[arr0.length - 1] - arr0[0];
    let arr1_calc = arr1[arr1.length - 1] - arr1[0];
 
    let ans = arr0_calc > arr1_calc ? arr0_calc : arr1_calc;
    
    console.log(ans.toString());
    
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 109032
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LL long long
int main(){
    string s,t;
    LL ans = 0;
    cin >> s;
    cin >> t;
    for (int i = 0; i < s.length(); i++) {
        if(s[i] == t[i]) {
           ans++; 
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
using ll =long long;
#define rep(i,n) ;for( int i =0; i < n ; i ++)
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int abs(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int fiv(int n){
  if(n==0){
    return 0;
  }
  else if(n==1){
    return 1;
  }
  return fiv(n-1)+fiv(n-2);
}
ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}
int main(){
  ll n;
 
  vector<vector<int>> a(3, vector<int>(3));
  rep(i,3){
    rep(j,3){
      cin>>a[i][j];
    }
  }
  cin >>n;
  vector<int> b(n);
  rep(i,n){
    cin>>b[i];
  }
  rep(i,3){
    rep(j,3){
      rep(k,n){
        if(b[k]==a[i][j]){
          a[i][j] = 101;
        }
      }
    }
  }
  bool ans = false;
  rep(i,3){
    if(a[i][0] ==a[i][1] && a[i][1]==a[i][2] ){
      ans = true;
      break;
    }
  }
  rep(j,3){
    if(a[0][j] ==a[1][j] && a[1][j]==a[2][j] ){
      ans = true;
      break;
    }
  }
  if(a[0][0] ==a[1][1] && a[1][1] ==a[2][2] ){
    ans=true;
  }
  else if(a[0][2]==a[1][1] && a[1][1] ==a[2][0]){
    ans =true;
  }
  
  if(ans ){
    cout <<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
   


  
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int MOD = 1e9+7;

const int MAX = 510000;


long long fac[MAX], finv[MAX], inv[MAX];


void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(LL n, LL k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(){
    COMinit();
    int H,W,A,B;cin >> H >> W >> A >> B;
    LL ans = 0;
    for(int i = B;i < W;i++){
        ans += COM(i+H-A-1, i)%MOD * COM(W-i+A-2, W-i-1)%MOD;
        ans %= MOD;
    }
    cout<<ans%MOD<<endl;
}


Measured memory_bytes: 12160