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

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

        int a = inp.nextInt();

        int b = inp.nextInt();

        int c = inp.nextInt();

        if (a < b && b < c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}



Measured memory_bytes: 26304
#include <iostream>

using namespace std;

main(){
  double a;
  while(cin >> a){
    double data[10];
    data[0]=a;
    for(int i=1;i<10;i++){
      if(i%2==1){
	data[i]=data[i-1]*2.0;
      }else{
	data[i]=data[i-1]/3.0;
      }
    }
    double ans=0.0;
    for(int i=0;i<10;i++) ans+=data[i];
    printf("%.8f\n", ans);
  }
  return 0;
}
    

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

using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)

#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pi pair<ll,ll>
#define md (ll)(1e9+7)

const int M=1e6+6;

ll pwr(ll a,ll n,ll m)
{
	ll p=1;
	while(n>0)
	{
		if(n%2==1)
			p=(p*a)%m;
		a=(a*a)%m;
		n=n/2;
	}
	return p;
}
ll n,w,ans,i,dp[M],tdp[M],w1,v1,j;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	cin >> n >> w;
	ans = 0;

	for(i=1;i<=n;++i)
	{
		cin >> w1 >> v1;
		for(j=w1;j<=w;++j)
		{
			tdp[j] = max(tdp[j],dp[j-w1]+v1);
		}
		for(j=w1;j<=w;++j)
		{
			dp[j] = max(dp[j],tdp[j]);
			ans = max(ans,dp[j]);
			tdp[j] = 0;
		}
	}	

	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 5120
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
	static BufferedReader br;
	static int cin() throws Exception
	{
		return Integer.valueOf(br.readLine());
	}
	static int[] split() throws Exception
	{
		String[] cmd=br.readLine().split(" ");
		int[] ans=new int[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Integer.valueOf(cmd[i]);
		}
		return ans;
	}
	static void kMarsh(String[] grid) {
        int n=grid.length;
        int m=grid[0].length();
        char[][] mat=new char[n][m];
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                mat[i][j]=grid[i].charAt(j);
            }
        }
        int[][] first=new int[m][n];
        for(int i=0;i<m;i++)
        {
            for(int j=0;j<n;j++)
            {
                int ind=n;
                for(int k=j;k<n;k++)
                {
                    if(mat[k][i]=='x')
                    {
                        ind=k;
                        break;
                    }
                }
                first[i][j]=ind;
            }
        }
        boolean[][][] there=new boolean[n][m][m];
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                for(int k=j;k<m;k++)
                {
                    boolean b1=(mat[i][k]=='x')?false:true;
                    boolean b2=true;
                    if(k!=j)
                    b2=there[i][j][k-1];
                    if(!b1 || !b2)
                    there[i][j][k]=false;
                    else
                    there[i][j][k]=true;
                }
            }
        }
        int ans=0;
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                if(mat[i][j]=='x')
                continue;
                int f1=first[j][i]-1;
                for(int k=j+1;k<m;k++)
                {
                    if(mat[i][k]=='x')
                    break;
                    int f2=first[k][i]-1;
                    int x=Math.min(f1,f2);
                    if(x==i)
                    continue;
                    if(!there[x][j][k])
                    continue;
                    int p=2*(x-i+k-j);
                    // System.out.println(i+" "+x+" "+k+" "+j+" "+p);
                    ans=Math.max(ans,p);
                }
            }
        }
        if(ans!=0)
        System.out.println(ans);
        else
        System.out.println("impossible");
    }
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		br=new BufferedReader(new InputStreamReader(System.in));
		double l=Double.valueOf(br.readLine());
		System.out.println(Math.pow(l/3, 3));
	}
}


Measured memory_bytes: 33220
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
int main(){
    int n;
    cin>>n;
    double x[n];
    double y[n];
    double z[n];
    double t1=0;
    double t2=0;
    double t3=0;
    double t4=0;
    for (int i=0;i<n;i++){
        cin>>x[i];
    }
    for (int i=0;i<n;i++){
        cin>>y[i];
    }
    for (int i=0;i<n;i++){
        z[i]=fabs(x[i]-y[i]);
    }
    for (int i=0;i<n;i++){
        t1+=z[i];
    }
    for (int i=0;i<n;i++){
        t2+=pow(z[i],2);
    }
    for (int i=0;i<n;i++){
        t3+=pow(z[i],3);
    }
    for (int i=0;i<n;i++){
        if(t4<=z[i]){
            t4=z[i];
        }
    }
    cout<<t1<<endl;
    cout<<fixed<<setprecision(15)<<sqrt(t2)<<endl;
    cout<<fixed<<setprecision(15)<<pow(t3,1.0/3.0)<<endl;
    cout<<t4<<endl;
    return 0;
}


Measured memory_bytes: 3464
/**
 * author: Dhakad_123
 * created: 26.04.2020
**/

#include<bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    
     int a , b , c , d; 
     
     cin >> a >> b >> c  >> d;
     
     bool Ok1 = false , Ok2 = false;
     while(a != 0 && c != 0){
        
        c -= b;
        if(c <= 0){
             Ok2 = true;
             break;
         }
        
        else{
          a -= d;
         if(a <= 0){
             Ok1  = true;
             break;
         }
        }
         
        
         
     }
    
    if(Ok1){
        cout << "No" << "\n";
    }
    
    else{
        cout << "Yes" << "\n";
    }
   
    return 0;
}

Measured memory_bytes: 3612
#!/usr/bin/env python3
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    mod=998244353
    n, k = map(int, input().split())
    lr = []
    for i in range(k):
        l, r = map(int, input().split())
        lr.append((l, r))
    ans=[1]
    acc_ans=[1]
    for i in range(1, n):
        wa = 0
        for l, r in lr:
            if i-r > 0:
                wa+=-acc_ans[i-r-1]+acc_ans[i-l]
            elif i-l>=0:
                wa+=acc_ans[i-l]
        wa%=mod
        ans.append(wa)
        acc_ans.append(wa+acc_ans[-1])
    print(ans[-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 27892
#%% D
from itertools import product, permutations
n, c = map(int, input().split())
D = [list(map(int, input().split())) for _ in range(c)]
C = [list(map(int, input().split())) for _ in range(n)]


X = [[0] * c for i in range(3)]

for i in range(n):
    for j in range(n):
        X[(i + j + 2) % 3][C[i][j] - 1] += 1

cost = [[0] * c for i in range(3)]

for i in range(c):
    for j in range(c):
        cost[0][j] += X[0][i] * D[i][j]
        cost[1][j] += X[1][i] * D[i][j]
        cost[2][j] += X[2][i] * D[i][j]

ans = []
for s, t, u in permutations(range(c), r=3):
    ans.append(cost[0][s] + cost[1][t] + cost[2][u])
print(min(ans))

Measured memory_bytes: 6636
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
int main(void){
    ll A,sum=0;
    
    rep(i,3){
        cin>>A;
        sum+=A;
    }
    if(sum>21){
        cout<<"bust"<<endl;
    }
    else{
        cout<<"win"<<endl;
    }

}




Measured memory_bytes: 3628
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
input = sys.stdin.buffer.readline
def inputS(): return input().rstrip().decode()
readlines = sys.stdin.buffer.readlines  

S = inputS()

cnt = 0
for i in range(len(S)//2):  
  if S[i] != S[-(i+1)]:
    cnt += 1
print(cnt)    

Measured memory_bytes: 3064
n,m=map(int,input().split())



r=list()
for i in range(n):
    a=list()
    r.append(a)
a=list()
for i in range(n):
    a.append(-1)
for i in range(m):
    x=0;y=0
    x,y=map(int,input().split())
    x-=1
    y-=1
    r[x].append(y)
    r[y].append(x)
    

a[0]=0
now=[0]
while len(now)!=0:
    nex=list()
    for i in now:
        for j in r[i]:
            if a[j]==-1:
                a[j]=i
                nex.append(j)
    now=nex


if -1 in a:
    print('No')
else:
    print('Yes')
    for item in a[1:]:
        print(item+1)


Measured memory_bytes: 34660
n, m = map(int, input().split(" "))
a = [list(map(int, input().split(" "))) for i in range(m)]

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

#print(a_connects)

a_connect_sums = [len(connect) for connect in a_connects]

#print(a_connect_sums)

bridge_count = 0
while 1 in a_connect_sums:
	x = a_connect_sums.index(1)
	y = a_connects[x][0]
 
	a_connects[x].remove(y)
	a_connects[y].remove(x)
 
	a_connect_sums[x] -= 1
	a_connect_sums[y] -= 1
 
	bridge_count += 1
	#print('')
	#print(a_connects)
	#print(a_connect_sums)
 
print(bridge_count)

Measured memory_bytes: 3064
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            Console.ReadLine();
        }

        public void Solve(ConsoleInput cin)
        {
            int size = cin.ReadInt;
            int min = cin.ReadInt;
            int max = cin.ReadInt;
            int cnt = 0;

            for (int i = 1; i <= size; i++)
            {
                string num = i.ToString();
                int sum = 0;
                do {
                    // 12345
                    sum += int.Parse(num.Substring(num.Length - 1));
                    num = num.Substring(0, num.Length - 1);
                } while (num.Length > 0) ;

                if (sum >= min && sum <= max)
                {
                    cnt += i;
                }
            }

            Console.WriteLine(cnt);
        }


    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long num) { var ret = new string[num]; for (long i = 0; i < num; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long num) { var ret = new int[num]; for (long i = 0; i < num; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long num) { var ret = new long[num]; for (long i = 0; i < num; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 11220
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			long[] x = in.nextLongArray(n);
			long[] tmp = x.clone();
			Arrays.sort(tmp);

			long left = tmp[n/2-1];
			long right = tmp[n/2];

			for (long l : x) {
				if (l <= left) {
					out.println(right);
				} else {
					out.println(left);
				}
			}

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


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

int main(){
    int n,a,b,c,d;
    cin >> n >> a >> b >> c >> d;
    string s;cin >> s;
    bool ans = true;
    bool ans1 = true;
    bool ans2 = true;
    bool ans3 = false;

    bool rock = false;
    for(int i=min(a-1,c-1);i <= max(c-1,a-1);i++){
        if(rock){
            if(s[i] == '#'){
                ans1 = false;
                rock = true;
            }
            else{
                rock = false;
            }
        }
        else{
            if(s[i] == '#'){
                rock = true;
            }
            else{
                rock = false;
            }
        }
    }


    rock = false;
    for(int i=min(b-1,d-1);i <= max(d-1,b-1);i++){
        if(rock){
            if(s[i] == '#'){
                ans2 = false;
                rock = true;
            }
            else{
                rock = false;
            }
        }
        else{
            if(s[i] == '#'){
                rock = true;
            }
            else{
                rock = false;
            }
        }
    }
    
    int count = 0;
    if(c < d){
        ans3 = true;
    }
    else{
        for(int i = b-2;i <= min(c-1,d-1)+1;i++){
            if(s[i] == '.'){
                count ++;
                if(count == 3){
                    ans3 = true;
                }
            }
            else{
                count = 0;
            }
        }
    }

    if(ans1 && ans2 && ans3){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner kbd = new Scanner(System.in);
        String s = kbd.next();
        String[] arr = s.split("");
        boolean flag = false;
        for (int i = 0; i < 3; i++) {
            if (arr[i].equals(arr[i + 1])) {
                flag = true;
                break;
            }
        }
        if (flag) {
            System.out.println("Bad");
        } else {
            System.out.println("Good");
        }
    }
}

Measured memory_bytes: 23252
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    int i,j,k,n,m;
    long long s,d;
    scanf("%d%d",&n,&m);
    s=0;
    d=n/m;
    s=d*d*d;
    if(m%2==0)
    {
        if(n%m>=m/2)
            d++;
        s=s+d*d*d;
    }
    printf("%lld\n",s);
    return 0;
}


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

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);

template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define dbg(x) true
#endif

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const {
    return mint(-x);
  }
  mint &operator+=(const mint a) {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a) {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    return mint(*this) += a;
  }
  mint operator-(const mint a) const {
    return mint(*this) -= a;
  }
  mint operator*(const mint a) const {
    return mint(*this) *= a;
  }
  mint pow(ll t) const {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a) {
    return *this *= a.inv();
  }
  mint operator/(const mint a) const {
    return mint(*this) /= a;
  }
};
istream &operator>>(istream &is, const mint &a) {
  return is >> a.x;
}
ostream &operator<<(ostream &os, const mint &a) {
  return os << a.x;
}

void solve(long long N, std::vector<long long> A) {
  mint sum = 0;
  REP(i, N) {
    sum += A[i];
  }
  mint ans = 0;
  REP(i, N - 1) {
    sum -= A[i];
    ans += mint(A[i]) * sum;
  }
  cout << ans << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  return 0;
}


Measured memory_bytes: 4844
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<iomanip>

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

const int MOD = 1e9 + 7;
const int MAX = 1e9;
const ll LLMAX = 1e18;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, a, n) for (int i = a; i <= (n); ++i)

int main() {
    int N, D; cin >> N >> D;

    // vector<int> X(N);
    // vector<int> Y(N);
    int cnt = 0;
    rep(i, N) {
        double x, y;
        cin >> x;
        cin >> y;
        double dis = sqrt(x * x + y * y);
        if (dis <= D) cnt++;
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}

using Graph=vector<vector<int>>;
Graph G;



int main(){
  string s,t;
  cin >> s >> t;
  t+=s;
  cout <<t <<endl;
}
    


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

using ll = long long;
using pii = pair<int, int>;

int main() {
    int l, k;
    cin >> l >> k;
    vector<vector<ll>> dp(102, vector<ll>(l + 1));
    dp[0][1] = 1;
    if(l >= k) {
        dp[0][k] = 1;
    }
    for(int i = 1; i <= 101; ++i) {
        for(int j = 0; j < l + 1; ++j) {
            if(i & 1) {
                if(j + 1 <= l) {
                    dp[i][j + 1] += dp[i - 1][j];
                }
            } else {
                if(j + k <= l) {
                    dp[i][j + k] += dp[i - 1][j];
                }
                if(j + 1 <= l) {
                    dp[i][j + 1] += dp[i - 1][j];
                }
            }
        }
    }
    ll ans = 0;
    for(int i = 0; i <= 100; i += 2) {
        for(int j = 0; j <= l; ++j) {
            ans += dp[i][j];
        }
    }
    cout << ans << endl;
}



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

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<PII> VP;


//REPEAT
//------------------------------------------
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i > n;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,m)  RFOR(i,m,0)

//container util
//------------------------------------------
#define pb(a) push_back(a)
#define fst first
#define snd second
#define SORT(V) sort((V).begin(),(V).end())
#define REV(V) reverse((V).begin(),(V).end())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//grobal variable
//------------------------------------------

//def function, class
//------------------------------------------
class MyClass         // 中身が空のクラス宣言
{
};
//main
//------------------------------------------
signed main(){
  string S;
  cin >> S;
  VI dp(S.size()+10);
  dp.at(0)=0;
  FOR(i, 1, S.size()){
    if(S.at(i)==S.at(i-1)){
      dp.at(i)=dp.at(i-1)+1;
      if(S.at(i)=='0'){
        S.at(i)='1';
      }else{
        S.at(i)='0';
      }
    }else{
      dp.at(i)=dp.at(i-1);
    }
  }
  cout << dp.at(S.size()-1) << endl;
  return 0;

}


Measured memory_bytes: 1280
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

	int a, b;
	cin >> a >> b;
	cout << (a-1)*(b-1) << endl;
	
	return 0;
}

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

vector<int> v[200001];

long long int vis[200001];
int a[200001];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	long long int k;
	cin>>n>>k;
	for(int i=0,x;i<n;i++){
		cin>>x;
		a[i]=x;
		v[x].emplace_back(i);
	}
	memset(vis,-1,sizeof vis);
	int cx=0,nx;
	long long int ck=0,nk;
	while(true){
		if(vis[cx]!=-1){
			ck = vis[cx] + (k-1-vis[cx])/(ck-vis[cx])*(ck-vis[cx]);
			break;
		}
		vis[cx] = ck;
		auto it = upper_bound(v[a[cx]].begin(),v[a[cx]].end(),cx);
		if(it == v[a[cx]].end()){
			nx = v[a[cx]][0];
			nk = ck+1;
		}
		else{
			nx = *it;
			nk = ck;
		}
		nx++;
		if(nx == n)
			nx=0,nk++;
		if(nk>=k)	break;
		cx = nx, ck = nk;
	}
	while(true){
		auto it = upper_bound(v[a[cx]].begin(),v[a[cx]].end(),cx);
		if(it == v[a[cx]].end()){
			nx = v[a[cx]][0];
			nk = ck+1;
		}
		else{
			nx = *it;
			nk = ck;
		}
		nx++;
		if(nx == n)
			nx=0,nk++;
		if(nk>=k)	break;
		cx = nx, ck = nk;
	}
	vector<int> res;
	set<int> st;
	while(ck<k){
		int x = a[cx];
		if(st.count(x)){
			while(res.back()!=x)	st.erase(res.back()),res.pop_back();
			res.pop_back();
			st.erase(x);
		}
		else{
			st.insert(x);
			res.emplace_back(x);
		}
		cx++;
		if(cx==n)
			cx=0,ck++;
	}
	for(int it:res)
		cout<<it<<' ';
	cout<<endl;
}


Measured memory_bytes: 24948
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n:usize,
        t:[usize;n],
        m:usize,
        drink:[(usize,usize);m],
    }
    let mut sum = 0;
    for i in 0..n {
        sum += t[i];
    }
    for i in 0..m {
        let index = drink[i].0 - 1;
        println!("{}", sum - t[index] + drink[i].1);
    }
}


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

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

  vector<vector<int>> G(n);
  map<pair<int, int>, int> v;

  for(int i=0;i<n-1;i++) {
    int node1, node2, w;
    cin >> node1 >> node2 >> w;
    node1--;
    node2--;

    G[node1].emplace_back(node2);
    G[node2].emplace_back(node1);
    v[make_pair(node1, node2)] = (w % 2);
    v[make_pair(node2, node1)] = (w % 2);
  }

  queue<pair<int, int>> que;

  que.push(make_pair(0, 0));

  map<int, int> used;
  vector<int> ans(n);

  while(!que.empty()) {
    pair<int, int> node = que.front();que.pop();
    ans[node.first] = (node.second % 2);
    for(int i=0;i<G[node.first].size();i++) {
      if(used[G[node.first][i]]) continue;
      que.push(make_pair(G[node.first][i], node.second + v[make_pair(node.first, G[node.first][i])]));
    }

    used[node.first] = 1;
  }

  for(int i=0;i<ans.size();i++) cout << ans[i] << endl;
}

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


int main()
{
	int ary[21] = {};
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		int a, b;
		cin >> a >> b;
		ary[a] = b;
	}
	int *p = max_element(ary + 1, ary + n + 1);
	cout << p - ary << ' ' << *p << endl;

	return 0;
}

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

const int maxn=5e5+10;

char s[maxn];

struct bignum{
	int len,bitcnt;
	int a[maxn];

	void init(char s[])
	{
		len=bitcnt=0;
		memset(a,0,sizeof(a));
		len=strlen(s);
		for (int i=0;i<len;i++)
			a[i]=s[len-i-1]-'0';
	}

	void multiple(int val)
	{
		int res=0;
		for (int i=0;i<len;i++)
		{
			a[i]=a[i]*val+res;
			res=a[i]/10;
			a[i]=a[i]%10;
		}
		while (res)
			a[len++]=res%10,res/=10;
	}

	void prework()
	{
		for (int i=0;i<len;i++)
			bitcnt+=a[i];
	}

	void add()
	{
		int pos=0;
		while (a[pos]==9)
			a[pos++]=0,bitcnt-=9;
		a[pos]++;
		bitcnt++;
		len+=len==pos;
	}
}n;

int main()
{
#ifdef h10
	freopen("E.in","r",stdin);
	freopen("E.out","w",stdout);
#endif
	int i,k;
	scanf("%s",s);
	n.init(s);
	n.multiple(9);
	n.prework();
	for (k=1;;k++)
	{
		for (i=1;i<=9;i++) n.add();
		if (n.bitcnt<=9*k) break;
	}
	printf("%d\n",k);
}


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

#define rep(i, a) for (int i = 0; i < (a); i++ )
#define FOR(i, m, n) for(int i = m; i < n; i++)
 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

int main(){
    int X,Y;
    cin >> X >> Y;
    string ans = "No";  
    rep(k,X+1) {
        int t = X-k;
        int s = 4*k+2*t;
        if (s==Y) {
            ans = "Yes";
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3628
/*!enjoy karo yaar!*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

#include<bits/stdc++.h>
using namespace std;

/*-----<Defines>-----*/
#define     int             long long int
#define     fast()          ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)          begin(x),end(x)
#define     rz(x)           resize(x)
#define     asn(x,y)        assign(x,y)
#define     mem(a,b)        memset(a,b,sizeof(a))
#define     sz(x)           ((int)size(x))
#define     eb              emplace_back
#define     pb              push_back
#define     pf              push_front
#define     pob             pop_back
#define     pof             pop_front
#define     ins             insert
#define     vi              vector<int>
#define     pii             pair<int,int>
#define     mii             map<int,int>
#define     F               first
#define     S               second
#define     remax(a,b)      a=max(a,b)
#define     remin(a,b)      a=min(a,b)
#define     bitcount(x)     __builtin_popcountll(x)
#define     iceil(n,x)      (((n)-1)/(x)+1)
#define     flush           fflush(stdout)

using ull=unsigned long long;
using ll=long long;
using ld=long double;
/*-----</Defines>-----*/

/*-----<Debugging Stuff>-----*/
string to_string(char s)
{   string res="'''";res[1]=s;return res; }

string to_string(string s)
{   return '"'+s+'"'; }

string to_string(const char* s)
{   return to_string((string)s); }

string to_string(bool b)
{   return (b?"true":"false"); }

template<typename A, typename B>
string to_string(pair<A, B> p)
{   return "("+to_string(p.F)+", "+to_string(p.S)+")"; }

template<typename A>
string to_string(A v)
{
    bool first=1; string res="{";
    for(const auto &x:v)
    {
        if(!first)  res+=", ";
        first=0;
        res+=to_string(x);
    }
    res+="}";
    return res;
}

void debug() { cout<<"\n"; }
template<typename Head, typename... Tail>
void debug(Head H, Tail... T)
{
    cout<<" "<<to_string(H);
    debug(T...);
}

#define show(...) cout << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
/*-----</Debugging Stuff>-----*/

/*-----<Mod Operations>-----*/
const int M=1e9+7;
inline int add(int a,int b,int p=M){ a=a+b; if(a>=p) a-=p; return a; }
inline int sub(int a,int b,int p=M){ a=a-b; if(a<0) a+=p; return a; }
inline int mul(int a,int b,int p=M){ a=(a*1ll*b)%p; return a; }
/*-----</Mod Operations>-----*/

/*-----<Constants>-----*/
const ld pi=acos(-1),eps=1e-9;
const ll inf=1e18;
const int N=1;
/*-----</Constants>-----*/

void solve()
{
    int n;
    cin>>n;

    vi arr(n+1);
    for(int i=1;i<=100;++i)
    {
        for(int j=1;j<=100;++j)
        {
            for(int k=1;k<=100;++k)
            {
                int tmp=i*i + j*j + k*k + i*j +i*k +j*k;
                if(tmp<=n)
                    ++arr[tmp];
            }
        }
    }

    for(int i=1;i<=n;++i)
        cout<<arr[i]<<"\n";
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    for(int z=1;z<=t;++z)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}




Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define ii pair <int, int>
#define f first
#define s second
#define INF 1e9
#define MOD 1000000007
#define MAXN 1000
#define debug(x) cerr << #x << " = " << x << endl
#define debug_arr(x, tam) cerr << #x << " = "; for (int i=0;i<tam;i++) cout << x[i] << " "; printf("\n")
using namespace std;


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

	if (a <= 8 && b <=8) printf("Yay!\n");
	else printf(":(\n");

	return 0;
}


Measured memory_bytes: 256
s=input()
t=input()
dp=[[0]*(len(t)+1) for i in range(len(s)+1)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i]==t[j]:
            dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+1)

        dp[i+1][j+1]=max(dp[i+1][j+1],dp[i+1][j],dp[i][j+1])
#print(*dp,sep='\n')
#復元していく
ans_str=''
i=len(s)
j=len(t)
while i>0 and j>0:
    #一致しているのは(i,j)→(i+1,j+1)の時だけ
    if dp[i][j]==dp[i-1][j]:
        i=i-1
    elif dp[i][j]==dp[i][j-1]:
        j=j-1
    else:
        ans_str=s[i-1]+ans_str
        i=i-1
        j=j-1
print(ans_str)

Measured memory_bytes: 112988
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
// template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }


int main() {
    int n;
    cin >> n;
    vector<ll> acc(n + 1);
    rep(i, n) {
        int a;
        cin >> a;
        acc[i + 1] = acc[i] + a;
    }
    
    ll ans = 1e18;
    rep3(i, 1, n) {
        chmin(ans, abs(acc[i] - (acc[n] - acc[i])));
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define N 100005
#define ll long long
struct node{int u, v, c;}E[N];
ll m, sum;
int bel[N], n, q;
int Getbel(int x)
{
	if (!bel[x])
		return x;
	return bel[x] = Getbel(bel[x]);
}
int main()
{
	scanf("%d%lld%d", &n, &m, &q);
	for (int i = 1; i <= q; i++)
	{
		scanf("%d%d%d", &E[i].u, &E[i].v, &E[i].c);
		++E[i].u, ++E[i].v;
		if (!E[i].c)
		{
			int u = Getbel(E[i].u);
			int v = Getbel(E[i].v);
			if (u != v)
				bel[u] = v;
		}
		if (E[i].c && m == n - 1)
		{
			puts("No");
			return 0;
		}
	}
	if (m == n - 1)
	{
		puts("Yes");
		return 0;
	}
	for (int i = 1; i <= q; i++)
	{
		if (E[i].c)
		{
			int u = Getbel(E[i].u);
			int v = Getbel(E[i].v);
			if (u == v)
			{
				puts("No");
				return 0;
			}
		}
	}
	for (int i = 1; i <= n; i++)
		sum += !bel[i];
	sum = n - sum + (1ll * sum * (sum - 1) / 2);
	if (m <= sum)
		puts("Yes");
	else
		puts("No");
}


Measured memory_bytes: 1792
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr = (input.trim()).split("\n");

const binarySearch = (key, arr, N) => {
  let mid;
  let left = 0;
  let right = N;
  if (key < arr[0] || arr[N-1] < key) return 0;
  while (left < right) {
    mid = Math.floor((left + right) / 2);
    if (key < arr[mid]) right = mid;
    else if (key > arr[mid]) left = mid + 1;
    else return 1;
  }
  return 0;
}


(function() {
  const N1 = Number(Arr[0]);
  const arr1 = Arr[1].split(" ").map(Number);
  // const N2 = Number(Arr[2]);
  const arr2 = Arr[3].split(" ").map(Number);
  console.log(arr2.map(e => binarySearch(e, arr1, N1)).reduce((a, b) => a + b, 0));
})();



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

using namespace std;

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

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)1e5 + 9;
vector<int> T[N];
int h[N];

int main(){
  fastIO;
  int n, m;
  cin >> n >> m;
  for(int i = 1; i <= n; i ++ )
    cin >> h[i];
  int u, v;
  for(int i = 0 ;i  < m ; i ++ ){
    cin >> u >> v;
    T[u].push_back(v);
    T[v].push_back(u);
  }
  int ans = 0;
  bool ok;
  for(int i = 1; i <= n; i ++ ){
    ok = true;
    for(auto x : T[i])
      if(h[x] >= h[i])
        ok = false;
    ans += ok;
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 9164
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;



LL MOD = 1000000007;

vector<LL> kaijo;

void init(int N) {
	kaijo.push_back(1);
	for(LL i=1; i<400000; i++) {
		kaijo.push_back(kaijo.back() * i % MOD );
	}
}
//高速べき乗
LL Power(LL N, LL t){	
	N%=MOD;
	LL ret = 1;
	while(t){
		if(t&1) ret*=N, ret%=MOD;
		N*=N;
		N%=MOD;
		t/=2;
	}
	return ret;	
}

//MODの中での割り算(MODは素数であること
//(a/b)mod(MOD=p) を求める
LL mod_frac(LL a,LL b){
	return (a* Power(b,MOD-2))%MOD;
}


LL calc(LL n, LL k) {
	return kaijo[n] * mod_frac(1, kaijo[k]) % MOD * mod_frac(1, kaijo[n-k]) % MOD;
	
}



int main() {
	init(1);
	
	LL H,W,A,B;
	cin >> H >> W >> A >> B;
	
	LL x = H-1-A, y = B;
	LL ans = 0;
	while(x>=0 && y<W) {
		
		ans += calc(x+y, x) * calc(H-1-x+W-1-y, W-1-y);
		ans %= MOD;
		x--;
		y++;
	}
	ans %= MOD;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4464
//In the name of Allah
#include <bits/stdc++.h>
using namespace std; 

int main() { 
    int n, k;
    cin >> n >> k; 
    int g; cin >> g; 
    int mx = g; 
    for( int i = 0 ; i + 1 < n ; i++ ) { 
        int v; cin >> v; 
        mx = max( mx , v ); 
        g = __gcd( g , v ); 
    }

    if( k % g == 0 && k <= mx ) 
        cout << "POSSIBLE" << endl;
    else
        cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 384
function Main(input) {
	input = input.split("\n");
	
	var s = input[0].split("");
	var t = input[1].split("");
	
	var result2 = 1001;
	
	for (var i = 0; i < s.length - t.length + 1; i++) {
	var result1 = 0;
		for (var j = 0; j < t.length; j++) {
		if  (s[i + j] !== t[j]) {
		result1 = ++result1;
	} else {
	}
	}
	
	if  (result2 > result1) {
		result2 = result1;
	} else {
	}
	}
	
	console.log(result2);
	}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
  int n, k;
  cin >> n >> k;
  
  int s = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x <= k / 2) {
      s += x;
    }
    else {
      s += k - x;
    }
  }
  cout << s * 2 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <set>

using namespace std;

typedef long long ll;

struct cell
{
    ll i, j;
    cell(ll _i, ll _j)
    {
        i = _i;
        j = _j;
    }
};


int main(void)
{
    ll H, W;
    ll A[1000][1000];
    cin >> H >> W;
    for (ll i = 0; i < H; i++) {
        for (ll j = 0; j < W; j++) {
            char c;
            cin >> c;
            if (c == '.') {
                A[i][j] = 0;
            } else if (c == '#') {
                A[i][j] = 1;
            } else break;
        }
    }

    ll d[H][W];
    queue<cell> que;
    for (ll i = 0; i < H; i++) {
        for (ll j = 0; j < W; j++) {
            d[i][j] = 2000;
            if (A[i][j] == 1) {
                d[i][j] = 0;
                if (i > 0) que.push(cell(i - 1, j));
                if (i < H - 1) que.push(cell(i + 1, j));
                if (j > 0) que.push(cell(i, j - 1));
                if (j < W - 1) que.push(cell(i, j + 1));
            }
        }
    }
    
    while(!que.empty()) {
        cell c = que.front();
        ll i = c.i, j = c.j;
        if (d[i][j] < 2000) {
            que.pop();
            continue;
        }
        if (i > 0) {
            if (d[i][j] > d[i - 1][j] + 1) {
                d[i][j] = d[i - 1][j] + 1;
            }
        }
        if (i < H - 1) {
            if (d[i][j] > d[i + 1][j] + 1) {
                d[i][j] = d[i + 1][j] + 1;
            }
        }
        if (j > 0) {
            if (d[i][j] > d[i][j - 1] + 1) {
                d[i][j] = d[i][j - 1] + 1;
            }
        }
        if (j < W - 1) {
            if (d[i][j] > d[i][j + 1] + 1) {
                d[i][j] = d[i][j + 1] + 1;
            }
        }
        if (i > 0) {
            if (d[i][j] + 1 < d[i - 1][j]) {
                que.push(cell(i - 1, j));
            }
        }
        if (i < H - 1) {
            if (d[i][j] + 1 < d[i + 1][j]) {
                que.push(cell(i + 1, j));
            }
        }
        if (j > 0) {
            if (d[i][j] + 1 < d[i][j - 1]) {
                que.push(cell(i, j - 1));
            }
        }
        if (j < W - 1) {
            if (d[i][j] + 1 < d[i][j + 1]) {
                que.push(cell(i, j + 1));
            }
        }
        que.pop();
    }

    ll ans = 0;
    for (ll i = 0; i < H; i++) {
        for (ll j = 0; j < W; j++) {
            ans = max(ans, d[i][j]);
        }
    }

    cout << ans << endl;

}


Measured memory_bytes: 81192
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
// clang-format on

template <int mod>
struct ModInt {
    int x;

    ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p) {
        if ((x += p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p) {
        if ((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p) {
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p) {
        *this *= p.inverse();
        return *this;
    }

    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const {
        int a = x, b = mod, u = 1, v = 0, t;
        while (b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }

    ModInt pow(int64_t n) const {
        ModInt ret(1), mul(x);
        while (n > 0) {
            if (n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }

    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt<mod>(t);
        return (is);
    }

    static int get_mod() { return mod; }
};

const int mod = 1e9 + 7;
using mint = ModInt<mod>;

const int N = 2000002;
mint f[N], invf[N];
mint C(int n, int r) { return f[n] * invf[r] * invf[n - r]; }

int main() {
    f[0] = 1;
    for (int i = 1; i < N; ++i) f[i] = f[i - 1] * i;
    invf[N - 1] = f[N - 1].inverse();
    for (int i = N - 2; i >= 0; --i) invf[i] = invf[i + 1] * (i + 1);

    int k;
    string s;
    cin >> k >> s;

    int n = s.size();

    vector<mint> p(k + 1), q(k + 1);
    p[0] = q[0] = 1;
    rep(i, k) {
        p[i + 1] = p[i] * 25;
        q[i + 1] = q[i] * 26;
    }

    mint ans = 0;
    rep(i, k + 1) ans += C(i + n - 1, i) * p[i] * q[k - i];
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 27640
#include <stdio.h>
int main(void) {
    int n, m, c, a[40][40], b[40];
    int i, j, k;

    scanf("%d %d %d", &n, &m, &c);
    for (i = 0; i < m; i++) {
        scanf("%d", &b[i]);
    }
    for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) {
            scanf("%d", &a[i][j]);
        }
    }
    int ans = 0;
    int sum;
    for (i = 0; i < n; i++) {
        sum = 0;
        for (j = 0; j < m; j++) {
            sum += a[i][j] * b[j];
        }
        sum += c;
        if (sum > 0) {
            ans++;
        }
    }

    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
n = int(input())
li = list(map(int,input().split()))

p = [abs(li[i]-li[i+1]) for i in range(n-1)]
q = [abs(li[i]-li[i+2]) for i in range(n-2)]

dp = [0,p[0]]

for i in range(2,n):
    dp.append(min(dp[i-1]+p[i-1], dp[i-2]+q[i-2]))

print(dp[-1])


Measured memory_bytes: 19172
s = input()

seq = 0
i = 0
sum_count = 0
while i < len(s):
    if s[i] == 'A':
        seq += 1
        i += 1
    elif s[i] == 'B' and i+1 < len(s) and s[i+1] == 'C':
        sum_count += seq
        i += 2
    else:
        seq = 0
        i += 1

print(sum_count)

Measured memory_bytes: 3500
S=input()

for i in range(2**3):
    sent=''+S[0]

    for j in range(3):
        if (i >> j) & 1:
            sent+='+' + S[j+1]
        else:
            sent+='-' + S[j+1]
    
    if eval(sent) == 7:
        print(sent+'=7')
        exit(0)

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

constexpr int mod = 1e5;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> v(n);
    for(int i=1; i<n; ++i) {
        cin >> v[i];
        v[i] += v[i-1];
    }
    int now = 0;
    int res = 0;
    for(int i=0; i<m; ++i) {
        int a;
        cin >> a;
        (res += abs(v[now] - v[now + a])) %= mod;
        now += a;
    }
    cout << res << endl;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
const int maxn=100000+10;
int n,a[maxn],ans;
bool cmp(int a,int b){return a>b;}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++){
		if(i+1>a[i+1]){
			for(int j=i+1;a[j]==i;j++)
				ans^=1;
			ans|=(a[i]-i)&1;
			if(ans&1) printf("First\n");
			else printf("Second\n");
			return 0;
		}
	}
}

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

using namespace std;
typedef long long ll;

constexpr ll MOD = 1e9 + 7;

int main() {
    string k;
    int d;
    cin >> k >> d;

    vector<vector<ll>> dp(d, vector<ll>(2));
    dp[0][true] = 1;
    for (int i = 0; i < k.size(); i++) {
        int here = k[i] - '0';

        vector<vector<ll>> after(d, vector<ll>(2));
        for (int prevmod = 0; prevmod < d; prevmod++) {
            for (int now = 0; now <= 9; now++) {
                int nowmod = (prevmod + now) % d;
                if (now < here) {
                    after[nowmod][false] += dp[prevmod][true], after[nowmod][false] %= MOD;
                } else if (now == here) {
                    after[nowmod][true] += dp[prevmod][true], after[nowmod][true] %= MOD;
                }
                after[nowmod][false] += dp[prevmod][false], after[nowmod][false] %= MOD;
            }
        }
        dp = after;
    }

    cout << (dp[0][true] + dp[0][false] - 1 + MOD) % MOD << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <math.h>
#include <vector>
#include <algorithm>

#define rep(i,n) for(int i=0; i < n; i++)
using namespace std;
#define PI 3.14159265358979

int main()
{
    double r;
    cin >> r;
    

    cout << 2* r * PI << endl;
    return 0;
}

Measured memory_bytes: 3776
while True:
    n = int(input())
    score = [0, 0]
    if n == 0:
        break
    for _ in range(n):
        A, B = map(int, input().split())
        if A == B:
            score[0], score[1] = score[0]+A, score[1]+B
        else:
            score[A<B] += A+B
    print(*score)

Measured memory_bytes: 7576