akhauriyash/Code-Regression huggingface dataset:
using System;

namespace AtCoder.ABC097
{
    class b
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Trim();
            var X = int.Parse(line);
            var list = new bool[1001];
            list[0] = true;
            list[1] = true;
            for(var b = 2; b < X; ++b)
            {
                var p = 2;
                while (Math.Pow(b, p) <= X)
                {
                    list[(int)Math.Pow(b, p)] = true;
                    ++p;
                }
            }
            for(var i = X; i >= 1; --i)
            {
                if (list[i])
                {
                    Console.WriteLine(i);
                    break;
                }
            }
        }
    }
}


Measured memory_bytes: 13140
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

int64_t a[2'999];
int64_t d[3'000][3'000];
int64_t r[3'000][3'000];

int64_t eval(int64_t *co, int dim, int64_t val, int64_t m)
{
    int64_t result = 0;
    for (int i = dim; i >= 0; i--)
    {
        result = (result * val % m + co[i] + m) % m;
    }
    return result;
}

int64_t dpow(int64_t x, int64_t y, int64_t m)
{
    if (y == 0)
    {
        return 1;
    }
    if (y % 2 == 0)
    {
        return dpow(x * x % m, y / 2, m);
    }
    else
    {
        return x * dpow(x, y - 1, m) % m;
    }
}

int64_t inv(int64_t x, int64_t m)
{
    return dpow(x, m - 2, m);
}

int main()
{
    int64_t p;
    cin >> p;
    for (int i = 0; i < p; i++)
    {
        cin >> a[i];
    }

    fill(d[0], d[0] + p + 1, 0);
    d[0][0] = 1;
    for (int i = 1; i < p; i++)
    {
        for (int j = 0; j <= p; j++)
        {
            d[i][j] = j != 0 ? d[i - 1][j - 1] : 0;
            d[i][j] = (d[i][j] - d[i - 1][j] * (int64_t)(i - 1) % p + p) % p;
        }
    }

    fill(r[0], r[0] + p + 1, 0);
    for (int i = 1; i <= p; i++)
    {
        int64_t rr = eval(r[i - 1], i - 1, i - 1, p);
        int64_t dd = eval(d[i - 1], i - 1, i - 1, p);
        int64_t c = (a[i - 1] - rr + p) % p * inv(dd, p) % p;

        //cout << "i=" << i << " rr=" << rr << " dd=" << dd << endl;

        for (int j = 0; j <= p; j++)
        {
            r[i][j] = (c * d[i - 1][j] % p + r[i - 1][j]) % p;
        }
    }

    for (int i = 0; i < p; i++)
    {
        cout << r[p][i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 141056
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int n;
		Scanner scanner = new Scanner(System.in);
		// 1 <= n <= 100, 整数
		n = scanner.nextInt();
		int ans;
		ans  = n / 3;
		
		System.out.println(ans);
		
		scanner.close();
	}

}


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

int main() {
  int x,y,z;
  cin >> x >> y >> z;
  int bin1;
  bin1 = x;
  x = y;
  y = bin1;
  
  bin1 = x;
  x = z;
  z = bin1;
  
  cout << x <<" "<< y <<" "<<z << endl;
}





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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a;
    string bs;
    cin >> a >> bs;
    ll b = (bs[0]-'0')*100+(bs[2]-'0')*10+(bs[3]-'0');
    ll ans=a*b/100;
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 3640
#include<stdio.h>

int main(){
	char S[5];
	int count = 0, i;
	scanf("%c %c %c %c", &S[0], &S[1], &S[2], &S[3]);
	for (i = 0; i < 4; i++){
		if (S[i] == '+'){
			count++;
		}
		else if (S[i] == '-'){
			count--;
		}
	}
	printf("%d\n", count);
	return 0;
}

Measured memory_bytes: 128
program prob2
    implicit none
    integer(8) :: n, a, b, ans
    read(*,*) n, a, b   
    ans = (N / (A + B)) * A
    if(mod(N, (A+B)) >= A)then
        ans = ans + A
    else
        ans = ans + mod(N, (A+B))
    end if

    write(*,*) ans


    stop
contains
end program prob2

Measured memory_bytes: 2828
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 100005
using namespace std;
inline int read(){
	int sum = 0, t = 1; char ch = getchar();
	while(ch < '0' || ch > '9'){ if(ch == '-') t = -1; ch = getchar(); }
	while(ch >= '0' && ch <= '9'){ sum = sum * 10 + ch - '0'; ch = getchar(); }
	return sum * t;
}

char s[N], t[N];
int a[N], b[N], n, m;

int f(int x, int y){
	if(x > y) swap(x, y);
	if(!x) return y;
	if(x == 1 && y == 1) return 2;
	if(x == 1 && y == 2) return 0;
	return 1;
}

int g(int x, int y){
	if(!y) return x;
	if(!x) return 3 - y;
	if(x == 1) return y == 1 ? 0 : 2;
	if(x == 2) return y == 1 ? 1 : 0;
}

int main(){
	scanf("%s%s", s + 1, t + 1);
	n = strlen(s + 1); m = strlen(t + 1);
	for(int i = 1; i <= n; i++) a[i] = s[i] == 'A' ? 1 : 2;
	for(int i = 1; i <= m; i++) b[i] = t[i] == 'A' ? 1 : 2;
	for(int i = 1; i <= n; i++) a[i] = f(a[i - 1], a[i]);
	for(int i = 1; i <= m; i++) b[i] = f(b[i - 1], b[i]);
	for(int q = read(); q ; q--){
		int x = read(), y = read(), c = read(), d = read();
		if(g(a[y], a[x - 1]) == g(b[d], b[c - 1])) puts("YES");
		else puts("NO");
	}
}


Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
using namespace std;
using ll = long long;

ll gcd(ll a,ll b){
    if(a < b){
        return gcd(b,a);
    }else{
        if(a%b == 0){
            return b;
        }else{
            return gcd(b,a%b);
        }
    }
}

int main(){
    ll N;
    cin >> N;
    ll A[N];
    for(ll i=0; i<=N; i++){
        cin >> A[i];
    }
    ll answer = A[0];
    for(ll j=1; j<N; j++){
        answer = gcd(answer,A[j]);
    }
    cout<< answer <<endl;
    return 0 ;
}


Measured memory_bytes: 1024
from functools import reduce
N, M = map(int,input().split())
ary1 =[]
for x in range(N):
  ary1.append(list(map(int,input().split())))

ary2 = sorted(ary1)
count = 0
total_sum = 0
for i in range(N):
  if count + ary2[i][1] <= M:
    total_sum += ary2[i][0] * ary2[i][1]
    count += ary2[i][1]
  elif count > M :
    break
  else:
    zan = M - count
    total_sum += ary2[i][0] * zan
    count += zan

print(total_sum)

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

int main(void) {
  int miti[7], f1 = 0, f2 = 0, f3 = 0, f4 = 0, ans = 0;

  for(int i = 0; i < 6; i++) {
    if(scanf("%d", &miti[i]) == 1);
    if(miti[i] == 1) {
      f1++;
    } else if(miti[i] == 2) {
      f2++;
    } else if(miti[i] == 3) {
      f3++;
    } else {
      f4++;
    }
  }

  for(int i = 0; i < 4; i++) {
    if(f1 == 2) {
      ans++;
      f1 = 0;
    } else if(f2 == 2) {
      ans++;
      f2 = 0;
    } else if(f3 == 2) {
      ans++;
      f3 = 0;
    } else if(f4 == 2) {
      ans++;
      f4 = 0;
    }
  }

  if(ans == 2) {
    printf("YES");
  } else {
    printf("NO");
  }

  return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
const ll LL_MAX=LLONG_MAX;

struct In{
    template<typename T>
    operator T(){
        T x;
        cin >> x;
        return x;
    }
};
In in;

template <typename T,typename U>
void forin(T* x,U n){
    for (U i=0;i<n;i++) cin >> x[i];
}

template <typename T>
int div1(T x) {
    return x%1000000007;
}

template <typename T>
void out(T x){
    cout << x << endl;
}

template <typename T>
T gcd(T x,T y){
    if (y == 0) return x;
    return gcd(y,x%y);
}

template <typename T>
T lcm(T x,T y){
    return x*y/gcd(x,y);
}

int main(){
    int h=in,n=in,a,sum=0;
    for (int i=0;i<n;i++){
        a=in;
        sum+=a;
    }
    if (sum>=h) out("Yes");
    else out("No");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=1e6+10;
int cal(int n)
{
    int cnt=0;
    for(int i=1,x;i<=n;++i)
    {
        scanf("%d",&x);
        if(x-1==cnt)
            ++cnt;
    }
    if(cnt==0)
        return -1;
    else
        return n-cnt;
}
int main()
{
    int n;scanf("%d",&n);
    cout<<cal(n)<<endl;
    return 0;
}


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

long long n, d, p, q, cnt;

int main() {
	
	ios_base::sync_with_stdio(false);
	cin >> n >> d;
	cnt = 0;
	for(int i = 0; i < n; i++) {
		cin >> p >> q;
		if((p*p + q*q) <= d*d) cnt++;
	}
	cout << cnt;
}

Measured memory_bytes: 3664
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;


int main(){
	int n, k;
	string s;
	cin >> n >> k >> s;
	vector<int> people;
	if (s[0] == '0') people.push_back(0);
	for (int i = 0; i < n; i++){
		int temp = 1;
		while (s[i] == s[i+1]){
			temp++;
			i++;
		}
		people.push_back(temp);
	}
	if (s[n-1] == '0') people.push_back(0);

	int len = min(2*k+1, (int)people.size());

	int sum = 0, ans;
	for (int i = 0; i < len; i++){
		sum += people[i];
	}
	ans = sum;
	for (int i = 0; i < people.size()-len; i+=2){
		sum -= people[i];
		sum -= people[i+1];
		sum += people[i+len];
		sum += people[i+len+1];
		ans = max(ans, sum);
	}
	cout << ans << endl;
 	return 0;
 }



Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

const lint MOD = 1e9+7;
lint n, k;
vector<lint> a;

int main() {
    cin >> n >> k;
    a.resize(n);
    for(lint i = 0; i < n; i++)  cin >> a[i];

    vector<lint> sr(n, 0);
    for(lint i = 0; i < n; i++) {
        for(lint j = i+1; j < n; j++) {
            if(a[i] > a[j])  sr[i]++;
        }
    }

    vector<lint> sl(n, 0);
    for(lint i = 1; i < n; i++) {
        for(lint j = 0; j < i; j++) {
            if(a[j] < a[i])  sl[i]++;
        }
    }

    lint ans = 0;
    for(lint i = 0; i < n; i++) {
        ans += sr[i] * k;
        ans %= MOD;
        ans += k*k%MOD*(sl[i]+sr[i])%MOD;
        ans %= MOD;
        ans -= k*(k+1)/2%MOD*(sl[i]+sr[i])%MOD;
        ans %= MOD;
        if(ans < 0)  ans += MOD;
    }
    cout << ans << endl;
}

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

using namespace std;

typedef long long LL;

int main(void){
  int n;
  int ans = 1;

  cin >> n;
  int d[n] = {}; //initialize

  for(int i = 0; i < n; i++){
    int val;
    cin >> val;
    d[val]++;
  }

  int judge = 1;


  if(n % 2 == 0){
    if(d[0] != 0) judge = 0;
    for(int i = 1; i <= n/2; i++){
      if(d[2*i - 1] != 2) judge = 0;
    }
  }
  else{
    if(d[0] != 1) judge = 0;
    for(int i = 1; i < n/2; i++){
      if(d[2*i] != 2) judge = 0;
    }
  }



  if(judge == 1){
    for(int i = 0;i < n/2; i++){
      ans = ans * 2 % int(1e9 + 7);
    }
  }
  else{
    ans = 0;
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

int main()
{
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  int max = a>b?a:b;
  max=max>c?max:c;
  int area = a*b*c/(2*max);
  printf("%d",area);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  string S, T;
  cin >> N >> S >> T;
  for(int i = 0; i < N; i++){
    cout << S[i] << T[i];
    if(i == N-1){
      cout << endl;
    }
  }
}

Measured memory_bytes: 3612
#include<stdio.h>
int main(void){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(a+b>c+d){
        printf("Left\n");
    }
    else if(a+b<c+d){
        printf("Right\n");
    }
    else{
        printf("Balanced\n");
    }
    return 0;
}

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

int main(){
	int k,s;
	cin >> k >> s;
	int cnt = 0;
	for(int x=0; x<=k; ++x){
		for(int y=0; y<=x; ++y){
			for(int z=0; z<=y; ++z){
				if(x+y+z==s) {
					if(x==y && y==z){
						cnt += 1;
					} else if(x==y || y==z) {
						cnt += 3;
					} else {
						cnt += 6;
					}
				}
			}
		}
	}
	cout << cnt << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
const ll inf = 1e9 + 10;
const ll maxn = 1e5 + 163;
const ll alf = 26;
const ll dlm = 1e9+7;
const ll del = 10979 ;
const int eps = 1e-7 ;
const int maxq = 3e3+132 ;

int n,k;
int h[maxn] ;
ll dp[maxn] ;

int main()
{
    ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);
    cin>>n>>k;
    for(int i=1;i<=n;i++)cin>>h[i] ;
    for(int i=1;i<=n;i++)dp[i] = inf;
    dp[1] = 0 ;
    for(int i=2;i<=n;i++){
        for(int j=i-1;j>=max(i-k,1);j--){
            dp[i] = min( (dp[i]) , (dp[j] + abs(h[i]-h[j])) );
        }
    }
    cout<<dp[n];
    return 0;
}



Measured memory_bytes: 1408
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef map<int, int> mii;
typedef map<char,int> mci;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vii;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define F first
#define S second
#define in insert
const int INF = 1e9 + 7;

int main(){
    int a, b, c;  cin>>a>>b>>c;
    cout<<max(a*10+b+c,max(a+b*10+c,c*10+b+a));
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#define LL long long
#define Max(a,b) (a>b?a:b)
#define Min(a,b) (a<b?a:b)
using namespace std;

inline LL read() {
	LL x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9') {if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9') {x=(x<<3)+(x<<1)+(c^48);c=getchar();}
	return x*f;
}

int main()
{
	LL A, B, C, X, Y, ans=0;
	A = read(), B=read(), C = read(), X=read(), Y = read();
	if(C*2<=A+B) {
		LL t = Min(X, Y);
		//cout<<"t=  "<<t<<endl;
		ans += t*2*C;
		X-=t, Y-=t;
		//cout<<"X=  "<<X<<"Y=  "<<Y<<endl;
		if(X==0 && C*2<B) ans+=2*C*Y;
		else if(Y==0 && C*2<A) ans+=2*C*X;
		else ans += X*A + Y*B;
	}
	else {
		ans = X*A+Y*B;
	}
	printf("%lld\n", ans);
	return 0;
 } 

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
typedef long long ll;

int A[100005];
int N;

inline ll getAns() {
    ll ret1 = 0, ret2 = 0, sum = 0;
    for(int i = 1; i <= N; i++) {
        sum += A[i];
        if(i&1) {
            if(sum <= 0) {
                ret1 += -sum + 1; sum = 1;
            }
        } else {
            if(0 <= sum) {
                ret1 += sum + 1; sum = -1;
            }
        }
    }
    sum = 0;
    for(int i = 1; i <= N; i++) {
        sum += A[i];
        if(i&1) {
            if(0 <= sum) {
                ret2 += sum + 1; sum = -1;
            }
        } else {
            if(sum <= 0) {
                ret2 += -sum + 1; sum = 1;
            }
        }
    }
    return min(ret1, ret2);
}

int main() {
    scanf("%d", &N); for(int i = 1; i <= N; i++) scanf("%d", &A[i]);
    printf("%lld\n", getAns());
    return 0;
}

Measured memory_bytes: 512
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

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

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 100100)

	s := getString()

	l := 0
	r := len(s) - 1
	//n := len(s)
	cnt := 0
	ans := 0
	for {
		//out(l, r, cnt, string(s[l]), string(s[r]))
		if l >= r {
			break
		}
		if s[l] == s[r] {
			l++
			r--
			cnt += 2
			//out(string(s[l]))
		} else if s[l] == 'x' && s[r] != 'x' {
			//out("l++")
			l++
			cnt++
			ans++
		} else if s[l] != 'x' && s[r] == 'x' {
			//out("r--")
			r--
			cnt++
			ans++
		} else {
			out(-1)
			return
		}
	}
	//out(l + r)
	out(ans)
}


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

typedef long long ll;
// int = ll;

int main(){
	
ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
	
	ll a,b;
	
	cin >> a >> b;
	
	cout << (6-(a+b)) << endl;
	
	
	
return 0;	
}

Measured memory_bytes: 3588
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int A = sc.nextInt();
		int B = sc.nextInt();
		
		if(A <= 8 && B<=8) {
			out.println("Yay!");
		}else {
			out.println(":(");
		}
		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

}


Measured memory_bytes: 23892
#pragma region GNUC
//以下を参考にした
//https://yukicoder.me/wiki/auto_vectorization
#ifdef __GNUC__
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#endif
#pragma endregion

#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>

#include <string>
#include <cstring>
#include <vector>
#include <valarray>
//#include <array>//x C++ (G++ 4.6.4)

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <cassert>//assert();
#include <fstream>
#include <random>
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)

/////////
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#define PII pair<int,int>
/////////
using namespace::std;

// 最大公約数
template<class T>
inline T gcd(T a, T b){return b ? gcd(b, a % b) : a;}
//inline T gcd(T a, T b){return b == 0 ? a : gcd(b, a % b);}

// 最小公倍数
template<class T>
inline T lcm(T a, T b){return a / gcd(a, b) * b;}
//inline T lcm(T a, T b){return a * b / gcd(a, b);}
////////////////////////////////

void solve(){
	LL A,B,X;
	cin >> A >> B >> X;
	LL ans = B/X;
	if( A ) ans -= (A-1)/X;
	else ++ans;
	cout << ans;
}

signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	//std::cout << std::fixed;//小数を10進数表示
	//cout << setprecision(16);//小数点以下の桁数を指定
	
	solve();
}


Measured memory_bytes: 256
fun main(args: Array<String>) {

    val num = readLine()!!.toInt()

    var isDivided = num
    var sum = 0
    while (isDivided > 0) {
        sum += isDivided % 10
        isDivided /= 10
    }

    if (num % sum == 0)
        println("Yes")
    else
        println("No")
}


Measured memory_bytes: 29844
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().solve(new Scanner(System.in));
	}
	
	public void solve(Scanner sc) {
		int[] count = new int[4];
		for(int i=0; i<6; i++) {
			int a = Integer.parseInt(sc.next());
			count[--a]++;
			if(count[a] >= 3) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}
}


Measured memory_bytes: 23124
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;

using namespace std;

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	string S;
	cin >> S;
	for (int i = 0;i < S.size();i++) {
		cout << "x";
	}
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){

    //input from txt （提出時にこの箇所は削除すること）
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    
    int64_t N;
    cin >> N;
    int64_t M = N;
    vector<char> vec(26);
    for(int i=0; i<26; i++){
        int x = 'a' + i;
        vec[i] = char(x);
    }
    int64_t now = 1;
    int64_t cnt = 1;
    while(N > now*26){
        N -= now*26;
        now *= 26;
        cnt++;
    }
    string ans = "";
    N--;
    for(int i=0; i<cnt-1; i++){
        ans += vec[N / now];
        N = N % now;
        now /= 26;
    }
    ans += vec[N];
    
    /*int64_t num = 0;
    
    for(int64_t i=1; i<30; i++){
        if(num + pow(26,i) > 1000000000000001){
            break;
        }
        num += pow(26,i);
        if(num == M){
            ans = "";
            for(int j=0; j<i; j++){
                ans += 'z';
            }
        }
    }*/
    
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a;
	cin>>a;
	int b=0;
	for(int i=0;i<a.size();i++)
	{
	if(a[i]=='+')b++;
	if(a[i]=='-')b--;
	}
	cout<<b;
	return 0;
}

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

using namespace std;

using ll = long long;

int main() {
  ll n, m, d;
  cin >> n >> m >> d;
  long double ans = (2 * (n - d) * (m - 1)) / (long double)(n * n);
  if (d == 0) ans /= 2.0;
  cout << fixed << setprecision(7) << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
MAX_N = 100000
dp = [MAX_N for _ in range(N + 1)]
# 1円は無視していい。9**a, 6**b だけでどこまでNに近づけるかが勝負
# N - nearest が1円の数
dp[0] = 0
for num in [6, 9]:
    for i in range(N):
        if dp[i] == MAX_N:
            continue
        for j in range(1, 7): #6**7 で10万(MAX_N)を突破する
            idx = i + pow(num, j)
            if idx > N:
                break
            dp[idx] = min(dp[idx], dp[i] + 1)

# dpを逆からあさり、初期値でない場所を見る
min_cost = MAX_N
min_idx = max(-1, N - 1000) #1000個もあされば十分。たぶん10でもいい
for i in range(N, min_idx, -1):
    if dp[i] < MAX_N:
        remain = N - i
        cost = remain + dp[i]
        if min_cost > cost:
            min_cost = cost
print(min_cost)

Measured memory_bytes: 3864
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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


int main(int argc, char const *argv[]) {
    int a,b;
    cin>>a>>b;
    cout << max(0, a-2*b) << endl;
    return 0;
}

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

int main(){
  
  int n; cin>>n;
  if(n==1){
    cout << "Hello World"<<endl;
  }
  else{
    int a,b; cin>>a>>b;
    cout <<a+b<<endl;
  }
  
  
}

Measured memory_bytes: 256
N = int(input())
D = list(map(int,input().split()))
M = max(D)
countlist=[0] * (M + 1)
ans=1

for i in D:
    countlist[i]+=1

if countlist[0]!=1 :
    ans = 0
else :
    if D[0]!=0 :
        ans = 0
    else:
        for i in range(2,M+1):
            ans *= countlist[i-1]**countlist[i]

print(ans%998244353) 

Measured memory_bytes: 14020
#include<stdio.h>
int main(){
  int a, b, k, i, c[100], j = 0;
  scanf("%d %d %d", &a, &b, &k);
  for(i = 1; i <= 100; ++i){
    if(a % i == 0 && b % i == 0){
      c[j] = i;
      ++j;
    }
  }
  printf("%d\n", c[j - k]);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main()
{
    int n;

    cin >> n;

    if (n == 25) {
        cout << "Christmas" << endl;
    }
    else if (n == 24) {
        cout << "Christmas Eve" << endl;
    }
    else if (n == 23) {
        cout << "Christmas Eve Eve" << endl;
    }
    else if (n == 22) {
        cout << "Christmas Eve Eve Eve" << endl;
    }
}


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int K, X;
    cin >> K >> X;

    for (int k = -(K - 1); k <= K - 1; k++) {
        cout << X + k << " ";
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 100005
int n,v[N],d[N],r;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>v[i];
    d[n-1]=abs(v[n]-v[n-1]);
    d[n]=0;
    for(int i=n-2;i>=1;i--)
    {
        d[i]=d[i+2]+abs(v[i+2]-v[i]);
        if(d[i+1]+abs(v[i+1]-v[i])<d[i])
            d[i]=d[i+1]+abs(v[i+1]-v[i]);
    }
    cout<<d[1];
}


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

public class Main {
    static ContestScanner in;
    static Writer out;
    public static void main(String[] args) {
        Main main = new Main();
        try {
            in = new ContestScanner();
            out = new Writer();
            main.solve();
            out.close();
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    void solve() throws IOException {
        int h = in.nextInt();
        int w = in.nextInt();
        char[][] map = new char[h + 2][w + 2];
        for (int i = 0; i < h + 2; i++) {
            Arrays.fill(map[i], '#');
        }
        for (int i = 0; i < h; i++) {
            char[] s = in.nextToken().toCharArray();
            for (int j = 0; j < w; j++) {
                map[i + 1][j + 1] = s[j];
            }
        }
        for (int i = 0; i < h + 2; i++) {
            for (int j = 0; j < w + 2; j++) {
                System.out.print(map[i][j]);
            }
            System.out.println();
        }
    }
}

@SuppressWarnings("serial")
class MultiSet<T> extends HashMap<T, Long>{
    @Override public Long get(Object key){return containsKey(key)?super.get(key):0L;}
    public void add(T key,long v){put(key,get(key)+v);}
    public void add(T key){put(key,get(key)+1);}
    public void sub(T key){final long v=get(key);if(v==1)remove(key);else put(key,v-1);}
    public MultiSet<T> merge(MultiSet<T> set)
    {MultiSet<T>s,l;if(this.size()<set.size()){s=this;l=set;}else{s=set;l=this;}
        for(Entry<T,Long>e:s.entrySet())l.add(e.getKey(),e.getValue());return l;}
}

class Writer extends PrintWriter{
    public Writer(String filename)throws IOException
    {super(new BufferedWriter(new FileWriter(filename)));}
    public Writer()throws IOException{super(System.out);}
}
class ContestScanner implements Closeable{
    private BufferedReader in;private int c=-2;
    public ContestScanner()throws IOException
    {in=new BufferedReader(new InputStreamReader(System.in));}
    public ContestScanner(String filename)throws IOException
    {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
    public String nextToken()throws IOException {
        StringBuilder sb=new StringBuilder();
        while((c=in.read())!=-1&&Character.isWhitespace(c));
        while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public String readLine()throws IOException{
        StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
        while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public long nextLong()throws IOException,NumberFormatException
    {return Long.parseLong(nextToken());}
    public int nextInt()throws NumberFormatException,IOException
    {return(int)nextLong();}
    public double nextDouble()throws NumberFormatException,IOException
    {return Double.parseDouble(nextToken());}
    public void close() throws IOException {in.close();}
}


Measured memory_bytes: 21972
card = [list(map(int, input().split())) for i in range(3)]
opened = [[False, False, False] for i in range(3)]
n = int(input())
for i in range(n):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if card[j][k] == b:
                opened[j][k] = True

dirs = [(0, 0, 1, 1), (2, 0, -1, 1)]
for i in range(3):
    dirs.append((i, 0, 0, 1))
    dirs.append((0, i, 1, 0))

ok = False
for x, y, dx, dy in dirs:
    o = True
    for i in range(3):
        o = o and opened[x + i * dx][y + i * dy]
    ok = ok or o

print('Yes' if ok else 'No')


Measured memory_bytes: 3064
import numpy as np

N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
F = sorted(list(map(int, input().split())), reverse=True)

A = np.array(A, np.int64)
F = np.array(F, np.int64)

Asum = sum(A)

def test(X):
    return (Asum - np.minimum(A, X//F).sum() <= K)

l = -1
r = 10**12

while (l + 1 < r):
    mid = (l + r) // 2
    if test(mid):
        r = mid
    else:
        l = mid

ans = r
print(ans)


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

typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<vector<int>> F(N, vector<int>(10)), P(N, vector<int>(11));
    rep(i, N) rep(j, 10) cin >> F[i][j];
    rep(i, N) rep(j, 11) cin >> P[i][j];
    ll ans = -1e18;
    rep(i, 1023) {
        //cout << "i=" << i;
        ll s = 0;
        rep(j, N) {
            //cout << " j=" << j;
            int c = 0;
            rep(k, 10) {
                if (((i >> k) & 1) == 0 && F[j][k] == 1) c++;
            }
            s += P[j][c];
            //cout << " c=" << c << " s=" << s;
        }
        if (s > ans) {
            ans = s;
        }
        //cout << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
from sys import stdin
import heapq

s=stdin.readline().rstrip().split()
N=int(s[0])
M=int(s[1])

a=stdin.readline().rstrip().split()
for i in range(N):
  a[i]=int(a[i])*(-1)
  
heapq.heapify(a)
for i in range(M):
  t=-(-heapq.heappop(a)//2)
  heapq.heappush(a,t)
print(sum(a)*(-1))

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const ll INF = 1e9+7;


int main(){
	ios_base::sync_with_stdio(false);
	ll A, B, C, D, ans=0;

	cin >> A >> B >> C >> D;
	A--;

	ll g = __gcd(C, D);
	ll G = C * D / g;

	ans = (B / C - A / C) + (B / D - A / D) - (B / G - A / G);

	cout << B-A-ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define ll long long int
#define ld long double
#define el '\n'
#define PI (ld)3.14159265358979323846
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < int(n); i++)
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) a.size()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

/*vector<int> parent, rak;

int find_set(int v) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}

void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (rak[a] < rak[b])
            swap(a, b);
        parent[b] = a;
        rank[a]+=rank[b];
    }
}*/

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}
ll extend_gcd(ll a,ll b,ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1,y1;
    ll ans =extend_gcd(b,a%b,x1,y1);
    x=y1;
    y=x1-(a/b)*y1;

    return ans;
}
ll inverse(ll a,ll m){
    ll x,y;
    extend_gcd(m,a,x,y);
    y%=m;
    y+=m;
    y%=m;
    return y;
}

/*const int N = 1000001;
int lp[N+1];
vector<int> pr;
void s(){
for (int i=2; i<=N; ++i) {
        if (lp[i] == 0) {
            lp[i] = i;
            pr.push_back (i);
        }
        for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)
            lp[i * pr[j]] = pr[j];
    }
}*/


ll kv;
ll t,n,x,y,h,k,z,p,q,w;

//vector<vector<ll>>v;
//vector<ll>vis,d;

int main() {
    IOS;
    string s,s1,s2;cin>>s;
    n=s.size();
    fo(i,n)s1+=(i%2?'1':'0');
    fo(i,n)s2+=(i%2?'0':'1');
    fo(i,n){
        x+=(s[i]!=s1[i]);
        y+=(s[i]!=s2[i]);
    }
    cout<<min(x,y);
    return 0;
}

Measured memory_bytes: 720
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();

        var a = sc.nextInt();
        var b = sc.nextInt();
        var c = sc.nextInt();

        Console.WriteLine(Math.Max(0, c - (a - b)));
    }
}

// chokudai's Scanner
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


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

typedef long long int ll;
typedef pair <ll, ll> pll;

const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const ll Inf = 1LL << 62;

struct Node {
	string s;
	int p, id;

	bool operator<(Node &a) const {
		if(s == a.s) {
			return p > a.p;
		}
		return s < a.s;
	}
} ar[Max];

int main() {
#ifdef Mr_Emrul
	freopen("inputf.in", "r", stdin);
#endif /// Mr_Emrul

	int n;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> ar[i].s >> ar[i].p;
		ar[i].id = i;
	}
	sort(ar + 1, ar + n + 1);
	for(int i = 1; i <= n; i++) {
		cout << ar[i].id << endl;
	}
	return 0;
}

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

class UnionFind {
	vector<int> data;
	vector<int> rank;
	int root(int a) {
		return data[a] < 0 ? a : data[a] = root(data[a]);
	}
public:
	UnionFind(int n) : data(n, -1), rank(n, 1) {}
	bool Find(int a, int b) {
		return root(a) == root(b);
	}
	void Union(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b) return;
		if (rank[a] < rank[b]) {
			data[a] += data[b];
			data[b] = a;
		}
		else {
			data[b] += data[a];
			data[a] = b;
			if (rank[a] == rank[b]) rank[b]++;
		}
	}
	int Size(int a) {
		return -data[root(a)];
	}
	int Rank(int a) {
		return rank[root(a)];
	}
};

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	ll N, M;
	cin >> N >> M;
	UnionFind uf(N * 2);
	bool two = true;
	for (int i = 0, a, b; i < M; i++) {
		cin >> a >> b; a--; b--;
		uf.Union(N + a, b);
		uf.Union(a, N + b);
		if (uf.Find(a, N + a) || uf.Find(b, N + b)) {
			two = false;
		}
	}
	ll cnt = 0;
	for (int i = 0; i < N; i++) {
		if (uf.Find(0, i)) {
			cnt++;
		}
	}
	cout << (two ? cnt * (N - cnt) - M : N * (N - 1) / 2 - M) << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

const int MOD = 1000000007;
const int MAX = 2100000;

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

void comInit() {
	fac[0] = fac[1] = inv[1] = finv[0] = finv[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 nCr(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

int main() {
	comInit();
	int r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2;
	long long ans = 0;
	for (int i = r1; i <= r2; ++i) {
		ans += (nCr(i + c2 + 1, c2) - nCr(i + c1, c1 - 1)) % MOD;
		ans = (ans % MOD + MOD) % MOD;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 49408
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=1000000007;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };


int main() {
	double t,x,ans;
	cin>>t>>x;
	ans=t/x;
	cout<<ans<<endl;

}

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

signed main () {
	string s;
    cin >> s;
    map < char, int > took;
    int points = 0, n = s.size();
    for (int i = 0; i < n; ++i) {
        if (s[i] == 'g') {
            if (took['p'] < took['g']) {
                ++took['p'];
                ++points;
            }
            else 
                ++took['g'];
        }
        else if (s[i] == 'p') {
            if (took['p'] < took['g'])
                ++took['p'];
            else {
                ++took['g'];
                --points;
            }
        }
    }
    cout << points << '\n';
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using static Assistant.Input;
using System.Linq;
using Assistant;

namespace ABC150E
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt;
            var C = ReadInts;
            C = C.OrderBy(x => -x).ToArray();
            int mod = 1000000007;

            long ans = 0;
            //高速
            for (int i = 0; i < N; i++)
            {
                long cand = C[i] * ModPow(2, N - i - 1, mod) % mod;
                cand *= (ModPow(2, i, mod) + i * ModPow(2, i - 1, mod) % mod) % mod;
                cand %= mod;
                ans = (ans + cand) % mod;
            }
            ans = (ans * ModPow(2, N, mod)) % mod;

            //O(n^2)で確認
            //long anstest = 0;
            //for (int i = 0; i < N; i++)
            //{
            //    for (int k = 0; k <= i; k++)
            //    {
            //        long cand = (C[i] * ModPow(2, N - i - 1, mod)) % mod;
            //        cand = (cand * (k + 1) % mod) * nCk(i, k, mod) % mod;
            //        anstest = (anstest + cand) % mod;
            //    }
            //}
            //anstest = (anstest * ModPow(2, N, mod)) % mod;

            Console.WriteLine(ans);
            //Console.WriteLine(anstest);
        }

        /// <summary>
        /// a^n (mod p)
        /// nが非常に大きい時に有効
        /// </summary>
        /// <param name="a"></param>
        /// <param name="n"></param>
        /// <param name="mod"></param>
        /// <returns></returns>
        public static long ModPow(long a, long n, long p)
        {
            if (n == 0) return 1;
            if (n == 1) return a % p;
            if (n % 2 == 1) return (a * ModPow(a, n - 1, p)) % p;

            long t = ModPow(a, n / 2, p);
            return (t * t) % p;
        }

        /// <summary>
        /// 組み合わせ個数
        /// </summary>
        /// <param name="n"></param>
        /// <param name="k"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public static long nCk(long n, long k, long p)
        {
            long ans = 1;
            k = Math.Min(k, n - k);
            for (long i = n; i > n - k; i--)
            {
                ans = (ans * i) % p;
            }

            for (long i = 1; i <= k; i++)
            {
                ans = (ans * ModPow(i, p - 2, p)) % p;
            }

            return ans;
        }
    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String ReadNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int ReadInt => int.Parse(ReadNext());
        public static long ReadLong => long.Parse(ReadNext());
        public static int[] ReadInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] NextLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    static class Debug
    {
        //drawmap
        //drawarray
    }
}


Measured memory_bytes: 36736
data class PC(val p: Int, val c: Int) {
    constructor(pc: List<Int>): this(pc[0], pc[1])
}
fun main(args: Array<String>) {
    var (D, G) = listOfInt()
    val pc = Array(D) { PC(listOfInt()) }
    var ans = Int.MAX_VALUE
    var mask = 0
    while(mask < (1 shl D)) {
        var s = 0
        var num = 0
        var rest_max = -1
        for (i in 0 until D) {
            if ((mask ushr i) and 1 != 0) {
                s += 100 * (i + 1) * pc[i].p + pc[i].c
                num += pc[i].p
            } else rest_max = i
        }
        if (s < G) {
            val s1 = 100 * (rest_max + 1)
            val need = (G - s + s1 - 1) / s1
            if (need >= pc[rest_max].p) {
                mask += 1
                continue
            }
            num += need
        }
        ans = Math.min(ans, num)
        mask += 1
    }
    println(ans)
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun nextInt(offset: Int = 0) = nextInt() + offset
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }


Measured memory_bytes: 37864
#![allow(unused)]

use std::cmp;
use std::io::{self, BufRead};
use std::iter;

macro_rules! destruct_ {
  ($e: expr, ()) => (
    //assert!($e.next().is_none())
  );
  ($e: expr, ($arg: ident, $( $args: ident )*)) => (
    $arg = $e.next().unwrap();
    destruct_!($e, ($($args)*))
  );
  ($e: expr, ($arg: ident $( $args: ident )*)) => (
    $arg = $e.next().unwrap();
    destruct_!($e, ($($args)*))
  );
}

macro_rules! split {
  ($e: expr, ($($name: ident)*)) => {
    let mut iter = $e.into_iter();
    destruct_!(iter, ($($name)*));
  }
}

macro_rules! gets {
  ($id: ident) => (
    let stdin = io::stdin();
    $id = Vec::new();
    for line in stdin.lock().lines() {
      $id.push(
        line
          .unwrap()
          .split_whitespace()
          .map(|a| a.parse().unwrap())
          .collect()
      );
    }
  )
}

macro_rules! get {
  ($id: ident) => (
    let stdin = io::stdin();
    $id = Vec::new();
    for line in stdin.lock().lines() {
      $id.push(
        line
          .unwrap()
          .parse().unwrap()
      );
    }
  )
}

macro_rules! p {
  ($a: expr) => (
    println!("{}", $a);
  )
}

macro_rules! pp {
  ($a: expr) => (
    println!("{:?}", $a);
  )
}

fn main() {
  let mut args: Vec<String>;
  let mut s;
  get!(args);
  split!(args, (s));

  for i in (1 .. s.len() - 1).rev() {
    let (s1, _) = s.split_at(i);
    let l = s1.len() / 2;
    let (ss1, ss2) = s1.split_at(l);
    if ss1 == ss2 {
      p!(i);
      return;
    }
  }
}


Measured memory_bytes: 4352
#include <cstring>
#include <algorithm>
#include <cstdio>

using std::sort;
using std::min;
using std::max;
typedef long long ll;
const int N = 100010;
int _w;

int n, m, a[N], b[N];

namespace G {
	int head[N], nxt[N*2], to[N*2], eid;
	void init() {
		eid = 0;
		memset(head, -1, sizeof head);
	}
	void link( int u, int v ) {
		to[eid] = v, nxt[eid] = head[u], head[u] = eid++;
		to[eid] = u, nxt[eid] = head[v], head[v] = eid++;
	}
}

namespace Tree {
	int head[N], nxt[N], to[N], eid;
	void init() {
		eid = 0;
		memset(head, -1, sizeof head);
	}
	void link( int u, int v ) {
		to[eid] = v, nxt[eid] = head[u], head[u] = eid++;
	}
}

namespace DSU {
	int pa[N];
	void init() {
		for( int i = 1; i <= n; ++i )
			pa[i] = i;
	}
	int find( int u ) {
		return u == pa[u] ? u : pa[u] = find( pa[u] );
	}
	void link( int u, int v ) {
		u = find(u), v = find(v);
		pa[u] = v;
	}
}

bool cmp( int u, int v ) {
	return a[u] < a[v];
}

int prelude() {
	static int rk[N], vis[N];
	memset(vis, 0, sizeof vis);
	for( int i = 1; i <= n; ++i ) rk[i] = i;
	sort(rk+1, rk+n+1, cmp);
	DSU::init();
	Tree::init();
	for( int i = 1; i <= n; ++i ) {
		using namespace G;
		int u = rk[i];
		vis[u] = 1;
		for( int e = head[u]; ~e; e = nxt[e] ) {
			int v = to[e];
			if( !vis[v] ) continue;
			v = DSU::find(v);
			if( u != v ) {
				Tree::link(u, v);
				DSU::link(v, u);
			}
		}
	}
	return rk[n];
}

ll f[N], s[N];

void dfs( int u ) {
	using namespace Tree;
	s[u] = b[u];
	for( int i = head[u]; ~i; i = nxt[i] ) {
		int v = to[i];
		dfs(v);
		s[u] += s[v];
	}
	f[u] = s[u] + a[u];
	for( int i = head[u]; ~i; i = nxt[i] ) {
		int v = to[i];
		f[u] = min( f[u], s[u] - s[v] + max<ll>(f[v], a[u]) );
	}
}

void solve( int rt ) {
	dfs(rt);
	printf( "%lld\n", f[rt] );
}

int main() {
	_w = scanf( "%d%d", &n, &m );
	for( int i = 1; i <= n; ++i ) {
		_w = scanf( "%d%d", a+i, b+i );
		a[i] = max( a[i] - b[i], 0 );
	}
	G::init();
	for( int i = 0; i < m; ++i ) {
		int u, v;
		_w = scanf( "%d%d", &u, &v );
		G::link(u, v);
	}
	solve( prelude() );
	return 0;
}


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

int main(){
	string s;
	cin >> s;
	
	int n = (s.size()-1)/2;
	string back;
	for(int i=s.size()-1; i>n; i--){
		back += s[i];
	}
	int cnt=0;
	for(int i=0; i<back.size(); i++){
		if(s[i]!=back[i]) cnt++;
	}
	cout << cnt << endl;
}


Measured memory_bytes: 256