akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.sql.Array;
import java.util.*;

public class Main {

    static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}
    static long lcm (long a, long b) {return a*b/gcd(a,b);}
    static int n = 0;
    static int s = 0;
    static int currentans =0;

    public static void main(String[] args){
	// write your code here
        Scanner sc=new Scanner(System.in);
       System.out.println((int)Math.pow(sc.nextInt(),3));
    }
}



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

int	main()
{
	string	s, p;
	cin >> s >> p;
	string	twice_s(s + s);
	if (twice_s.find(p) == string::npos)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
}


Measured memory_bytes: 3216
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

int ans;

int main(void) {
    int l, r, d;
    cin >> l >> r >> d;
    rep(i, l, r+1) if (i%d==0) ans++;



  
    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 3628
/*
 * Author: Anmol Choudhary
 */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nextl cout<<"\n"
#define deb(x) cout<<#x<<"="<<x<<"\n"
#define deb2(x,y) cout<<"["<<#x<<"="<<x<<"] , ["<<#y<<"="<<y<<"]"<<"\n"
const ll mod = 1000000007;
const ll maxn = 100005;
const ll mm = 1e+18;
ll power(ll x, ll y)
{
    ll res = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res;
}
void solve()
{
    ll h,w,n;
    cin>>h>>w>>n;
    ll an=n/max(h,w);
    if(n%(max(h,w))) an++;
    pr(an);
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
        //nextl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N = Integer.parseInt(s.next());
        int K = Integer.parseInt(s.next());

        double per = 0.0;

        for (int i = 1; i <= N; i++) {
            int num = i;
            double tmpPer = 1.0 / N;
            while (num < K) {
                num *= 2;
                tmpPer = tmpPer / 2;
            }
            per += tmpPer;
        }
        System.out.println(per);
    }
}


Measured memory_bytes: 21972
import java.util.Scanner;

public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        int n = nextInt();
        String tmp;
        int[] arr = new int[4];
        for(int i=0;i<4;i++){
            arr[i]=0;
        }
        for(int i=0;i<n;i++){
            tmp = next();
            if(tmp.equals("AC")){
                arr[0] += 1;
            }
            if(tmp.equals("WA")){
                arr[1] += 1;
            }
            if(tmp.equals("TLE")){
                arr[2] += 1;
            }
            if(tmp.equals("RE")){
                arr[3] += 1;
            }
        }
        print("AC x " + arr[0]);
        print("WA x " + arr[1]);
        print("TLE x " + arr[2]);
        print("RE x " + arr[3]);
    }

    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }

    //print
    public static void print(Object a){
        System.out.println(a);
    }


    //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    }


    //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    }
}

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

int main() {
    string s;
    cin >> s;
    string w[] = {"Sunny", "Cloudy", "Rainy"};
    int i = 0;
    while (w[i] != s) i++;
    cout << w[(i+1)%3] << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	long[] nums=new long[4];
    long f=0;
    for(int i=0;i<4;i++){
      nums[i]=sc.nextLong();
    }
    if(nums[3]>nums[0]){
      f=nums[0];
      if(nums[3]-nums[0]>nums[1]){
        f=f-(nums[3]-nums[0]-nums[1]);
      }else{}
    }else{
      f=nums[3];
    }
    System.out.print(f);
  }
}


Measured memory_bytes: 35932
import java.util.*;
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
    public static void main(String[] args) {
       
        FastScanner sc = new FastScanner();
	    String msg=sc.next();
		
		if(msg.charAt(0)==msg.charAt(1) && msg.charAt(2)==msg.charAt(3) && msg.charAt(0)!=msg.charAt(2) ){
		    System.out.println("Yes");
		}else if(msg.charAt(0)==msg.charAt(2) && msg.charAt(1)==msg.charAt(3) && msg.charAt(0)!=msg.charAt(1)){
		    System.out.println("Yes");
		}else if(msg.charAt(0)==msg.charAt(3) && msg.charAt(2)==msg.charAt(1) && msg.charAt(0)!=msg.charAt(1)){
		    System.out.println("Yes");
		}else{
		    System.out.println("No");
		}
       
    }
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
	
	public char[][] nextCharsHW(int H,int W){
		char[][] chars=new char[H][W];
		for(int i=0;i<H;i++) {
			String str=next();
			for(int j=0;j<W;j++) {
				chars[i][j]=str.charAt(j);
			}
		}
		return chars;
	}
	
	public int[][] nextIntsNM(int N,int M){
		int[][] ints=new int[N][M];
		for(int i=0;i<N;i++) {
			for(int j=0;j<M;j++) {
				ints[i][j]=nextInt();
			}
		}
		return ints;
	}
}

Measured memory_bytes: 20564
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int counter = 0;
        for(int i = 1;i < N + 1;i++){
            int a = sc.nextInt();
            if(a % 2 != 0 && i % 2 != 0){
                counter++;
            }
        }
        System.out.println(counter);
    }
}

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


void solve(long long K, long long A, long long B){
  long long acc = K;

  for(long long i = A; i <= B; i++){
    if(i%K==0) {
      cout << "OK" << endl;
      return;
    }
  }

  cout << "NG" << endl;
  return;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long K;
  scanf("%lld",&K);
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
    solve(K, A, B);
    return 0;
}


Measured memory_bytes: 3684
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
    double N; cin >> N;
  	int n = (int)N;
    double ans = (n%2==0?(n/2)/N:(n/2+1)/N);
  	std::cout << std::fixed;
    cout << setprecision(10) << ans << endl;
	return 0;
}

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

int main(){
  long int n;
  cin >> n;
  
  long int ans = n;
  for (int i = 1; i <= sqrt(n); i++){
    if (n % i == 0){
      long int j = n / i;
      if (ans > i + j - 2) ans = i + j - 2;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#define pb push_back
using namespace std;
const int P=139;
const int mod=998244353;
const int maxn=1e8+10;
typedef long long ll;
const int inf=0x3f3f3f3f;
const int minn=0xc0c0c0c0;
ll k,m,n,x,ans,f[maxn],pre[maxn];
int main()
{
    scanf("%lld%lld%lld",&n,&x,&m);
    for(int i=0;i<m;i++)
    	f[i]=-1;
    int a=0;
    ans=0;
    while(n--)
    {
    	f[x]=a++;
    	pre[x]=ans;
    	ans+=x;
    	x=x*x%m;
    	if(f[x]>=0)
    	{
    		int b=a-f[x];
    		ans+=(ans-pre[x])*(n/b);
    		n%=b;
		}
	}
	printf("%lld\n",ans);
    return 0;
}

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

int main(){
  int n, x, tmp, ans=200;
    cin >> n;
    for(int i=0; i<n; i++){
      cin >> x;
      tmp=0;
      while(1){
        if(x%2==1) break;
        x /= 2;
        tmp += 1;
      }
      ans = min(ans, tmp);
    }

    cout << ans << endl;
}

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

int main() {
  string N;
  bool ans = false;
  cin >> N;
  for (int i = 0; i < 2; i++) {
    if (N.at(i) == N.at(i + 1) && N.at (i + 1) == N.at(i + 2)) {
      ans = true;
    }
  }
  if (ans)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
cards = list()
suit = ['S', 'H', 'C', 'D']
n = int(input())
for i in range(n):
    s,r = input().split()
    r = int(r)
    if s == "S": cards.append(0 + r)
    elif s == "H": cards.append(13 + r)
    elif s == "C": cards.append(26 + r)
    elif s == "D": cards.append(39 + r)
for i in range(1,53):
    if not (i in cards):
        print(suit[(i-1)//13], (i-1)%13+1)




Measured memory_bytes: 5612
def main():
  import itertools
  from sys import stdin
  N, M, X = map(int, input().split())
  s_list = [list(map(int, stdin.readline().split())) for _ in range(N)]
  nums = [0, 1]
  min_cos = 10 ** 10
  for balls in itertools.product(nums, repeat=N):
    cos = 0
    score = [0] * M
    v = list(balls)
    for i in range(N):
      if v[i] == 1:
        cos += s_list[i][0]
        score = [x + y for (x, y) in zip(score, s_list[i][1:])]
    if min(score) >= X and cos < min_cos:
      min_cos = cos
  if min_cos == 10 ** 10:
    print(-1)
  else:
    print(min_cos)
    
  
main()
        
        
    

Measured memory_bytes: 74140
function main(input) {
  var checks = input[1].split(" ");
  var evenNumbers = checks.filter(ele => ele%2 === 0);
  var checked = evenNumbers.filter(num => num%3 === 0 || num%5 === 0);

  if (evenNumbers.length === checked.length){
    console.log("APPROVED");
  } else {
    console.log("DENIED");
  }
  	
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));

Measured memory_bytes: 9420
#include<stdio.h>
int main()
{
    int n,i,j,count1,count2=0,d;
    scanf("%d",&n);
    for(i=1; i<=n; i++)
    {
        d=i;
        count1=0;
        while(d>0)
        {
            d/=10;
            count1++;
        }

        if(count1%2!=0) count2++;
    }
    printf("%d",count2);
}


Measured memory_bytes: 1704
#include <iostream>
#include <string>
#include <cstdint>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <climits>
#include <numeric>
#include <algorithm>
#include <cassert>

using namespace std;


int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> as(n);
    for(int& a : as) cin >> a;
    const double limit = accumulate(begin(as), end(as), 0) * 1.0 / (4 * m);
    if(m <= count_if(begin(as), end(as), [=](int a){ return a >= limit; })){
        cout << "Yes\n";
    }
    else{
        cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (ll)(v).size()
#define inf 1e18
#define md 1e9+7
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(o,0,n)cout<<v[o]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif


#define M 110


int main(){
    IOS;
 
 	
 	ll n,k;cin>>n>>k;
 	ll a[n+1]={0},b[n+2]={0};
 	rep(i,1,n+1)cin>>a[i];
 	while(k--){
 		rep(i,1,n+1)b[max(1ll,i-a[i])]++,b[min(n+1,i+a[i]+1)]--;
 		rep(i,1,n+1)b[i]+=b[i-1];
 		bool ok=0;
 		rep(i,1,n+1){
 			if(a[i]!=b[i])ok=1;
 			a[i]=b[i],b[i]=0;
 		}
 		if(!ok)break;
 	}
 	rep(i,1,n+1)cout<<a[i]<<" ";
 	return 0;
}

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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    string s; cin >> s;
    int a = -1;
    int ans = 0 ;
    REP(i, (int)s.length())
    {
        if(a == -1 && s[i] == 'A') a = i;
        if(a != -1 && s[i] == 'Z') chmax(ans, i-a+1);
    }

    cout << ans << endl;
}


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

int H, W, K;

void fall(vector<vector<ll>> &c) {
    rep(i,W) rep(j,H) {
        if (c[i][j] == 0) {
            for (int k = 1; k + j < H; ++k) {
                if (c[i][k+j] != 0) {
                    for (int l = j; l < H; ++l) {
                        if (l + k < H) c[i][l] = c[i][l+k];
                        else c[i][l] = 0;
                    }
                    break;
                }
            }
        }
    }
}

void sum(ll &ans, ll delete_cnt, vector<vector<ll>> &c) {
    rep(i,H) {
        ll left = 0;
        rep(j,W) {
            if (c[j+1][i] != 0 && c[j+1][i] == c[j][i]) continue;
            if (c[j+1][i] != c[j][i]) {
                if (j - left + 1 >= K) {
                    ans += (1LL<<delete_cnt) * (j - left + 1) * c[j][i];
                    for (int k = left; k <= j; ++k) c[k][i] = 0;
                }
            }
            left = j + 1;
        }
    }
}



ll calc_ans(int x, int y, vector<vector<ll>> c) {
    ll res = 0;
    ll pre_ans = -1;
    ll delete_cnt = 0;

    c[x][y] = 0;
    fall(c);
    while (res != pre_ans) {
        pre_ans = res;
        sum(res, delete_cnt, c);
        fall(c);
        ++delete_cnt;
    }
    return res;
}


int main() {
    cin >> H >> W >> K;
    vector<vector<ll>> c(W+1, vector<ll>(H));
    rep(i,H) {
        string S;
        cin >> S;
        rep(j,W) c[j][H-1-i] = S[j] - '0';
    }

    ll ans = 0;

    rep(i,W) rep(j,H) {
        if (i == 0) continue;
        ans = max(ans, calc_ans(i, j, c));
    }
    
    cout << ans << endl;
}



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

int main(){
  long long N, A, B;
  cin >> N >> A >> B;
  
  long long ans=N+1;
  if(A%2 == B%2){
    ans = abs(A-B)/2;
    cout << ans << endl;
    
    return 0;
  }
  
  
  if((A-1)<=(N-B)){
    ans = A;
  	ans += abs(B-A-1)/2;
  
  	cout << ans << endl;
    return 0;
  }
  else{
    ans = N-B+1;
    ans += abs(B-A-1)/2;
    
    cout << ans << endl;
    return 0;
  }
  
  return 0;
}

Measured memory_bytes: 3216
#include <cstdio>
const int MOD = 1000000007;
int N, M, e[15][15], emask[15][32768];
long long f[8192];
long long A(int u, int v)
{
	long long W = 1;
	int zero = u - v, nonzero = v | 3 << N - 2;
	for (int i = 0; i < N; i++)
	{
		if (zero >> i & 1)
			W = (W << emask[i][nonzero]) % MOD;
		if (nonzero >> i & 1)
			W = W * ((1 << emask[i][zero]) - 1) % MOD;
	}
	return W;
}
long long B(int u, int v)
{
	long long W = 1;
	int zero = u - v | 3 << N - 2, nonzero = v;
	for (int i = 0; i < N; i++)
	{
		if (zero >> i & 1)
			W = (W << emask[i][nonzero]) % MOD;
		if (nonzero >> i & 1)
			W = (W << emask[i][nonzero]) % MOD * ((1 << emask[i][zero]) - 1) % MOD;
	}
	return W;
}
int main()
{
	scanf("%d%d", &N, &M);
	long long BA = 1;
	for (int i = 1, u, v; i <= M; i++)
	{
		scanf("%d%d", &u, &v);
		e[N - u][N - v] = 1;
		BA = (BA << 1) % MOD;
	}
	for (int i = 0; i < N; i++)
		for (int j = 0; j < 1 << N; j++)
			for (int k = 0; k < N; k++)
				if ((j >> k & 1) && e[i][k])
					emask[i][j]++;
	for (int i = 0; i < 1 << N - 2; i++)
	{
		f[i] = B(i, i);
		for (int j = 0; j < i; j = ((j | ~i) + 1) & i)
			f[i] = (f[i] + f[j] * A(i, j) + B(i, j)) % MOD;
	}
	printf("%lld\n", (BA - f[(1 << N - 2) - 1] + MOD) % MOD);
	return 0;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};

//-----------------------------------------------------------------------------

unsigned long long k;
ll a[50];

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

	cin>>k;
	REP(i,50) a[i]=i+k/50;
	REP(i,k%50) {
		a[i]+=50;
		REP(j,50) if(i!=j) a[j]--;
	}
	cout<<50<<endl;
	REP(i,50) cout<<a[i]<<' ';
	cout<<endl;

	return 0;
}


Measured memory_bytes: 256
#pragma region
#pragma GCC target("avx2")
#pragma GCC optimize("03")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define endl "\n"
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORR(x,arr) for(auto& x:arr)
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define VPII vector<PII>
#define VPLL vector<PLL>
#define FI first 
#define SE second
#define ALL(x) (x).begin(), (x).end()
constexpr int INF=1<<30; constexpr ll LINF=1LL<<60; constexpr ll mod=1e9+7; constexpr int NIL = -1;
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
#pragma endregion
//-------------------
int n,m;


int main(){
    cin.tie(0); ios::sync_with_stdio(false); //cout << fixed << setprecision(15);
    cin >> n >> m;

    unordered_map<int, int> mp;
    int left = 1;
    int cnt = 0;
    for(int i=n; i>left; i--) {
        if(mp[i-left]==0 and mp[n-i+left]==0 and i-left != n-i+left) {
            cout << left << " " << i << endl;
            mp[i-left]++;
            mp[n-i+left]++;
            left += 1;
            cnt++;
            if(cnt == m) break;
        }
    }
    return 0;
}


Measured memory_bytes: 10900
import java.util.*;
import java.util.stream.Collectors;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        int n = sc.nextInt();
        int otoshidama = sc.nextInt();

        int x = -1;
        int y = -1;
        int z = -1;

        boolean isFinish = false;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                for (int k = 0; k <= n; k++) {
                    if (i + j + k == n) {
                        if (i * 10000 + j * 5000 + k * 1000 == otoshidama) {
                            x = i;
                            y = j;
                            z = k;
                            isFinish = true;
                            break;
                        } else if (i + j + k == n) {
                            break;

                        }
                    }
                }
                if (isFinish || i + j > n) {
                    break;

                }
            }
            if (isFinish || i == n) {
                break;

            }
        }
        System.out.println(x + " " + y + " " + z);
    }
}

Measured memory_bytes: 24020
#include<iostream>
#include <bits/stdc++.h> 
#include<vector>
#include<map>
#include<unordered_map>
#include<algorithm>
#include<set>
#include<cmath>
using namespace std;



int main(){
  long long  h;
  cin >> h;
  long long b = 1;
  long long x = 0;
  while (b<=h)
  {
    x = x + b;
    b = b*2;
  }
  cout << x << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <set>
#include <functional>
#include <cmath>
#include <set>
#include <map>


//マクロ
/*動かない・・・
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _roverload3(_1,_2,_3,name,...) name
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(...) _roverload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
//*/
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
//*/
#define All(a) (a).begin(),(a).end()
#define dump(x)  cerr << #x << " = " << (x) << endl;

//定数
#define INF 1e9
#define INFL 1e18
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
//*/
using namespace std;
using Graph = vector<vector<int>>;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数
int n, m;
int s, c;

//使用する関数
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;
}

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

	cin >> n >> m;
	vector<int> a(n+1, -1);
	REP(i, m) {
		cin >> s >> c;
		if (a[s] == -1) {
			a[s] = c;
			continue;
		}
		if (a[s] != c) {
			cout << "-1" << endl;
			return 0;
		}
	}
	if (a[1] == 0 && n!=1) {
		cout << "-1" << endl;
		return 0;
	}

	REPS(i, n) {
		if (a[i] == -1) {
			if (i == 1 &&n!=1) {
				cout << "1";
			}
			else {
				cout << "0";
			}
			continue;
		}
		cout << a[i];
	}
	cout << endl;
}

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

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int max = 0;
        int sum = 0;
        for (int i = 0; i < N; i++)
        {
            int p = cin.nextInt();
            max = Math.Max(p, max);
            sum += p;
        }

        Console.WriteLine(sum - max / 2);
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

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

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

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


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

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

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}


Measured memory_bytes: 13140
n, x, m = [int(_) for _ in input().split()]
d = {}
d_rev = {}
d[x] = 0
d_rev[0] = x
c = 0
while True:
    c += 1
    x = (x ** 2) % m
    if x in d:
        roop_idx = d[x]
        break
    else:
        d[x] = c
        d_rev[c] = x
# print(d)
# print(d_rev)

ans = 0
if roop_idx >= n:
    for i in range(n):
        ans += d_rev[i]
    print(ans)
else:
    for i in range(roop_idx):
        ans += d_rev[i]
    roop_num = len(d) - roop_idx
    roop_sum = 0
    for i in range(roop_idx, len(d)):
        roop_sum += d_rev[i]
    ans += ((n-roop_idx)//roop_num) * roop_sum
    roop_last = (n-roop_idx)%roop_num
    for i in range(roop_last):
        ans += d_rev[roop_idx + i]
    print(ans)

Measured memory_bytes: 18040
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;
queue<ll> q;
vector<vector<ll> > G(MAX_N);


int main(){
    ll n,m;
    cin>>n>>m;
    for(ll i=0;i<m;i++){
        ll a,b;
        cin>>a>>b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<ll> ans(n,0);
    q.push(0);
    ans[0]=1;
    while(!q.empty()){
        ll u=q.front();
        q.pop();
        for(ll v:G[u]){
            if(ans[v]>0){
                continue;
            }else{
                ans[v]=u+1;
                q.push(v);
            }
        }
    }
    cout<<"Yes"<<endl;
    for(int i=1;i<n;i++){
        cout<<ans[i]<<endl;
    }
}

Measured memory_bytes: 22272
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

type section struct {
	start, end, maxspeed int
}

func main() {
	sc.Split(bufio.ScanWords)

	N := scanInt()
	L := make([]section, N+2)

	for i := 1; i <= N; i++ {
		L[i].start = L[i-1].end
		L[i].end = L[i-1].end + scanInt()*2
	}
	T := L[N].end
	L[N+1].start, L[N+1].end = T, T

	for i := 1; i <= N; i++ {
		L[i].maxspeed = scanInt()
	}

	v := make([]float64, T+1)
	for t := 0; t <= T; t++ {
		nowSpeed := 10000.0
		for _, l := range L {
			if t < l.start {
				tmpSpeed := float64(l.maxspeed) + float64(l.start-t)/2
				nowSpeed = math.Min(nowSpeed, tmpSpeed)
			} else if l.end < t {
				tmpSpeed := float64(l.maxspeed) + float64(t-l.end)/2
				nowSpeed = math.Min(nowSpeed, tmpSpeed)
			} else {
				nowSpeed = math.Min(nowSpeed, float64(l.maxspeed))
			}
		}
		v[t] = nowSpeed
	}

	ans := 0.0
	for t := 1; t <= T; t++ {
		ans += (v[t] + v[t-1]) / 4
	}

	fmt.Println(ans)
}


Measured memory_bytes: 2116
#include <bits/stdc++.h>
using namespace std;
const int dir[4][2] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};
const int INF = 1e9;

int h, w, k;
vector<vector<char>> MP;
vector<vector<int>> dis;

bool outside(int x, int y) {
	return x < 0 or x >= h or y < 0 or y >= w;
}

bool bad(int x, int y, int nd) {
	return MP[x][y] == '@' or dis[x][y] < nd;
}

void bfs(int x1, int y1) {
	queue<pair<int, int>> que;
	que.push({x1, y1});
	dis[x1][y1] = 0;
	while (!que.empty()) {
		int x = que.front().first;
		int y = que.front().second;
		que.pop();
		for (int i = 0; i < 4; i++) {
			int nx = x, ny = y;
			int nd = dis[x][y] + 1;
			for (int j = 1; j <= k; j++) {
				nx += dir[i][0];
				ny += dir[i][1];
				if (outside(nx, ny) or bad(nx, ny, nd))
					break;
				if (dis[nx][ny] > nd) {
					que.push({nx, ny});
					dis[nx][ny] = nd;
				}
			}
		}
	}
}

int main() {
	int x1, y1, x2, y2;
	cin >> h >> w >> k >> x1 >> y1 >> x2 >> y2;
	--x1, --y1, --x2, --y2;
	MP.resize(h, vector<char>(w));
	dis.resize(h, vector<int>(w));
	for (int i = 0; i < h; i++) 
		for (int j = 0; j < w; j++)
			cin >> MP[i][j], dis[i][j] = INF;
	bfs(x1, y1);
	cout << (dis[x2][y2] == INF ? -1 : dis[x2][y2]);
}


Measured memory_bytes: 12020
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    println!("{}", 180 * n - 360);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: i32,
        m: i32,
        a: [i32; m],
    }
    let ans = n - a.iter().sum::<i32>();
    if ans < 0 {
        println!("-1");
    } else {
        println!("{}", ans);
    }
}

Measured memory_bytes: 2276
#!/usr/bin/perl

my ($n,$m,$q) = map { $_ - 0 } split(/\s+/,<STDIN>);

my @d = ();
for(my $i=0;$i<$q;$i++){
  my @du = map { $_ - 0 } split(/\s+/,<STDIN>);
  push(@d,\@du);
}

my $mx = 0;

my @st = ();
for(my $i=0;$i<$n;$i++){
  $st[$i] = 0;
}

while(1){
  #print ( join(":",@st) . "\n");
  my $sc = 0;
  for(my $k=0;$k<$q;$k++){
    if( $st[$d[$k]->[1]-1] - $st[$d[$k]->[0]-1] == $d[$k]->[2] ){
      $sc += $d[$k]->[3];
    }
  }
  
  if( $sc > $mx ){ $mx = $sc; }
  last unless &cup;
  
}
print "$mx\n";
exit(0);


for(my $i=1;$i<1024;$i++){
  my $sc = 0;
  my @aa = ();
  
  my $j = 1;
  for(my $k=0;$k<10;$k++){
    if( $j & $i ){
      push(@aa,$k);
    }
    $j += $j;
  }
  next unless $#aa == $n - 1;
  print (join(':',@aa) . "\n");
  
  for(my $k=0;$k<$q;$k++){
    if( $aa[$d[$k]->[1]-1] - $aa[$d[$k]->[0]-1] == $d[$k]->[2] ){
      $sc += $d[$k]->[3];
    }
  }
  
  if( $sc > $mx ){ $mx = $sc; }
}
print "$mx\n";

sub cup {
  my $i = $n - 1;
  my $c = 1;
  while( $i>=0 and $c > 0 ){
    $st[$i] += $c;
    $c = 0;
    if( $st[$i]>$m - 1 ){
      $c = 1;
      $st[$i] = $st[$i-1];
      $i--;
    }
  }
  return 0 if( $c>0 );
  #print ( "i=$i  " . join(',',@st) .  "\n");
  for(my $j=$i+1;$j<$n;$j++){
    $st[$j] = $st[$i];
  }
  #print ( "i=$i  " . join(',',@st) .  "\n");
  return 1;
}



Measured memory_bytes: 4908
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <queue>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <numeric>
// #include <fstream>
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const long long mod = 1e9 + 7;

int main()
{
    long long int n; std::cin >> n;
    std::string s; std::cin >> s;

    // 個数だけ引く
    long long int cntr = std::count(s.begin(), s.end(), 'R');   
    long long int cntg = std::count(s.begin(), s.end(), 'G');
    long long int cntb = std::count(s.begin(), s.end(), 'B');
    long long int ans = cntr * cntg * cntb, sub = 0;
    for(long long int i=0; i<n; i++)
    {
        for(long long int j=i+1; j<n; j++)
        {
            if(s[i]==s[j]) continue;
            long long int k = 2 * j - i;
            if(k>=n || s[j]==s[k] || s[i]==s[k]) continue;
            sub++;
        }
    }
    
    std::cout << ans - sub << std::endl;
    return 0;
}


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

	static int n, m, ans;
	static int a[100000];
void input() {
	cin >> n;
	cin >> m;
	for (int i = 1; i < n + 1; i++) {
		cin >> a[i];
	}
}
void pre() {
	ans = 0;
}
void operate() {
	for (int i=1;i<n+1;i++) 
		for (int j = i + 1; j < n + 1; j++) {
			if ((a[i] + a[j] <= m)&(a[i] + a[j] > ans)) ans = a[i] + a[j];
		}
}
void output() {
	if (ans == 0) cout << "NONE";
	else cout << ans;
	cout << endl;
}
int main() {
	while (true) {
		input();
		if (n == 0)return 0;
		pre();
		operate();
		output();
	}
	return(0);
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define ok cout << "ok" << endl;
#define sp << " " <<
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


class Math {
    ll mod = 1e9+7;
  public:
    template<typename T> 
    T gcd(T a, T b){
        if(b==0) return a; 
        return gcd(b, a%b);
    }

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

    template<typename T>
    T keta(T num){
        T k=0; 
        while(num>0){ 
            num/=10;
            k++;
        }
        return k;
    }

    template<typename T>
    T powpow(T num1, T num2){
        T res = 1;
        while(num2 > 0){
            res *= num1;
            res %= mod;
            num2--;
        }
        return res%mod;
    }

    template<typename T1, typename T2>
    ll powl(T1 a, T2 b){
        ll res = 1;
        while(b > 0){
            res *= a;
            b--;
        }
        return res;
    }

    template<typename T1, typename T2>
    ll ceil(T1 a, T2 b){
        return (a+b-1)/b;
    }
};


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

    ll n, m;
    string s, t;
    Math ma;
    cin >> n >> m >> s >> t;

    ll g = ma.lcm(n, m);

    ll g_n = g/n;
    ll g_m = g/m;

    bool res = true;
    int s_itr = 0;
    int t_itr = 0;
    while(true){
        if(s[s_itr] != t[t_itr]){
            res = false;
            break;
        }
        s_itr += g_m;
        t_itr += g_n;
        if(s_itr >= n || t_itr >= m) break;
    }

    if(!res) cout << -1 << endl;
    else cout << g << endl;

    return 0;
}


Measured memory_bytes: 640
#include <iostream>

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

	int ** table = new int*[n+1];

	for (int i = 0; i < n+1; i++)
		table[i] = new int[x+1];

	int val;
	for (int i = 0; i < n+1; i++) {
		int sum_row = 0;
		for (int k = 0; k < x + 1; k++) {

			// bottom row
			if (i == n) {
				int sum_col = 0;
				for (int j = 0; j < n; j++) {
					sum_col += table[j][k];
				}
				table[i][k] = sum_col;
			}

			// right column
			else if (k == x){
				table[i][k] = sum_row;
			}
			// table data
			else {
				std::cin >> val;
				sum_row += val;
				table[i][k] = val;
			}
		}
	}
		
	// display table
	for (int i = 0; i < n+1; i++) {
		for (int k = 0; k < x+1; k++) {
			if(k==x)
				std::cout << table[i][k];
			else
				std::cout << table[i][k] << " ";
		}
		std::cout  << std::endl;
	}


	for (int i = 0; i < n; i++)
		delete[] table[i];

	delete[] table;

	return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define M 500005;
using namespace std;
const int MAXN = 2*M;
int st[MAXN];
int n;

void build() {
	for(int i = n-1; i > 0; --i) 
		st[i] = st[i<<1] | st[i<<1|1];
}

void modify(int p, int v) {
	//if(st[p+n] == v) return;
	for(st[p+=n] = v; p > 1; p>>=1)
		st[p>>1] = st[p] | st[p^1];
	//for(st[p+=n] = v; p>>=1;)
		//st[p] = st[p<<1] | st[p<<1|1];
}

int query(int l, int r) {
	int res = 0;
	for(l +=n, r+=n; l<r; l>>=1, r>>=1) {
		if(l&1) res = res | st[l++];
		if(r&1) res = res | st[--r];
	}
	return res;
}

int main() {
	string s;
	int type, q, pos, l, r;
	char c;
	cin >> n >> s >> q;
	for(int i = 0; i < n; ++i ) {
		int idx = int(s[i] - 'a');
		st[i+n] = (1<<idx);
	}
	build();
	while(q--) {
		cin >> type;
		if(type == 1) {
			cin >> pos >> c;
			int idx = int(c - 'a');
			modify(pos-1, (1<<idx));
		} else {
			cin >> l >> r;
			cout << __builtin_popcount(query(l-1, r)) << endl;
		}
	}
	
	return 0;
}


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

int main(){
  double N,i,sum=0,h=0;
  cin >> N;
  vector<double> X(N);
  for(i=0;i<N;i++)
  cin >> X.at(i);

  for(i=0;i<N;i++)
  sum += X.at(i);

  sum = round(sum/N);

  for(i=0;i<N;i++){
    h += pow(X.at(i)-sum,2);
  }
  cout << h;
}


Measured memory_bytes: 256
#include <cstdio>
#include <regex>
#include <list>
#include <iomanip>
#include <iterator>
#include <iostream>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <climits>
#include <string>
#include <set>
#include <numeric>
#include <bitset>
#include <cmath>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <numeric>
#include <vector>
#include <cassert>
#include <ctime>

using namespace std;

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define FORi(i,a,b) for(int i=int(a);i<=int(b);i++)
#define FOR(i,n) FORi(i,1,n)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mt make_tuple
#define pb push_back
#define sz size()
#define SET(__set, val) memset(__set, val, sizeof(__set))

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;
using pii=pair<int, int>;
using pdd=pair<double, double>;
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto& p: c) os << p << " ";
	return os<<']';
}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}


template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

constexpr int INF=1e9;
constexpr int MOD=1000000007;
constexpr double EPS=1e-9;
constexpr int maxw=31;
constexpr int maxn=1000000000;

vi dx = {-1, -1, -1, 0, 0, 1, 1, 1};
vi dy = {1, 0, -1, 1, -1, 1, 0, -1};

int main() {
	vs mat;
	int n, m;
	while(cin>>n>>m) {
		mat.clear();
		copy_n(istream_iterator<string>(cin), n, back_inserter(mat));
		rep(i, n) rep(j, m) if(mat[i][j] != '#') {
			mat[i][j] = '0';
			rep(k, 8) {
				int ni = i+dx[k];
				int nj = j+dy[k];
				if(ni >= 0 && ni < n && nj >= 0 && nj < m && mat[ni][nj] == '#') mat[i][j]++;
			}
		}
		rep(i, n) cout << mat[i]<<endl;
	}
	return 0;
}


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

int main(){
	long long n,a,b;
	cin>>n>>a>>b;
	if(a>b||n==1&&a!=b){
		cout<<'0'<<endl;
		return 0;
	}
	long long Min=a*(n-1)+b;
	long long Max=b*(n-1)+a;
	cout<<Max-Min+1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const int INF = 1000000000; // 10^9
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    double R;
    cin >> R;
    R = 2 * R * 3.14;
    cout << R << endl;
}


Measured memory_bytes: 3752
a = gets.chomp
card_ary = gets.chomp.split
card_ary.map!(&:to_i)
card_ary.sort!
card_ary.reverse!
alice = 0
bob = 0
card_ary.each_with_index{|c, i|
  if i.even?
    alice += c
  else
    bob += c
  end
}
puts alice - bob

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

using namespace std;

const int N = 1e2+7;

long long n;

int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> n;
    if (n&1) {
        cout << 0 << endl;
        return 0;
    }
    if (n == 0) {
        cout << 0 << endl;
        return 0;
    }
    long long cnt2 = -1, cnt5 = 0;
    for (long long i = 2; i <= n; i *= 2) cnt2 += n/i;
    n /= 2;
    for (long long i = 5; i <= n; i *= 5) cnt5 += n/i;
    cout << min(cnt2, cnt5) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
void xin(){
	#ifndef ONLINE_JUDGE 
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
}
int f[100005] = {0};
int main()
{
  	xin();
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);

    string s,t;
    cin>>s>>t;
    int ans=0;
    if(s==t)
    	cout<<ans<<endl;
    else
    {
    	for(int i=0;i<s.length();i++)
    	{
    		if(s[i] != t[i])
    			ans++;
    	}
    	cout<<ans<<endl;
    }
    
 }

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> llVEC;
typedef vector<P> PVEC;
typedef priority_queue<P,PVEC,greater<P> > PPQ;
typedef priority_queue<ll, llVEC, greater<ll> > llPQ;

#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n-1; i >= a;i--)
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

template<typename T>
ll sz(vector<T> &vec){ return (ll)vec.size(); }
template<typename T>
ll sz(priority_queue<T, vector<T>> &pq) {return (ll)pq.size(); }
template<typename T>
ll sz(priority_queue<T, vector<T>, greater<T>> &pq) {return (ll)pq.size(); }
ll sz(string &s) {return (ll)s.size(); } 
ll gcd(ll a,ll b){ return ((!b) ?a :gcd(b, a%b)); }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b; }
bool checkindex(ll i,ll n){ return (i < n && i >= 0); }

int main(){
    ll n;
    cin >> n;
    ll d[n][2];
    rep(i,0,n){
        cin >> d[i][0] >> d[i][1];
        if(i > 1){
            if(d[i][0] == d[i][1] && d[i-1][0] == d[i-1][1] && d[i-2][0] == d[i-2][1]){
                cout << "Yes" << endl;
                return 0;
            }
        }    
    }
    cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 3636