akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;


void main() {
    int n;
    scan(n);

    if (n == 0) {
        writeln(0);
        return;
    }

    long[] ps;
    long[] ng;

    foreach (i ; 0 .. 32) {
        if (i % 2 == 0) {
            ps ~= 2L^^i;
        }
        else {
            ng ~= 2L^^i;
        }
    }

    int[long] ngc;

    void dfs_ng(long val, int mask, long dep) {
        if (dep == ng.length) {
            ngc[val] = mask;
            return;
        }
        dfs_ng(val + ng[dep], mask | (1<<dep), dep + 1);
        dfs_ng(val, mask, dep + 1);
    }

    dfs_ng(0, 0, 0);

    debug {
        //ngc.writeln;
    }

    foreach (s ; 0 .. (1<<16)) {
        long val;

        foreach (i ; 0 .. 16) {
            if (s & (1<<i)) {
                val += ps[i];
            }
        }

        if (val - n in ngc) {
            int t = ngc[val - n];
            string ans;

            foreach (j ; 0 .. 32) {
                int k = j / 2;

                if (j % 2 == 0) {
                    if (s & (1<<k)) {
                        ans ~= "1";
                    }
                    else {
                        ans ~= "0";
                    }
                }
                else {
                    if (t & (1<<k)) {
                        ans ~= "1";
                    }
                    else {
                        ans ~= "0";
                    }
                }
            }

            writeln(ans.retro.to!string.stripLeft('0'));
        }
    }
}

























void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 5628
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main implements Runnable {
    public static void Sieve(int n)throws Exception {
        boolean[] prime = new boolean[n / 2];
        Arrays.fill(prime, false);

        for (int i = 3; i * i < n; i += 2) {
            if (!prime[i / 2]) {
                for (int j = i * i; j < n; j += i * 2) {
                    prime[j / 2] = true;
                }
            }
        }


        //System.out.println("2");

        int p = 1;
        for (int i = 3; i < n; i += 2) {
            if (!prime[i / 2]) {

            }
        }
    }

    public void solve() throws Exception {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
            int n = sc.nextInt();
            int m = sc.nextInt();
        out.println(n*(n-1)/2+m*(m-1)/2);


    }


    //main function//
    public static PrintWriter out;

    public static void main(String[] args) throws Exception {
        new Thread(null, new Main(), "", 1 << 26).start();
    }

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

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


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

        boolean hasNextInt() {
            return true;
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }

    public void run() {
        try {
            solve();
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        } finally {
            out.close();
        }
    }
}

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

using namespace std;

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

    int k, a, b;
    cin >> k >> a >> b;

    for(int i = a; i <= b; i++)
    {
        if(i % k == 0)
        {
            cout << "OK";
            return 0;
        }
    }
    cout << "NG";

    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
const int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
const int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    vector<pint> sh;
    rep(i,n) {
        sh.emplace_back(h[i], i);
    }
    int ans = 0;
    ssort(sh);
    rep(i,n) {
        int id = sh[i].second;
        if (h[id] > 0) {
            int tmp = h[id];
            h[id] -= tmp;
            int idl = id - 1;
            while (idl >= 0 && h[idl] > 0) {
                h[idl] -= tmp;
                idl --;
            }
            int idr = id + 1;
            while (idr < n && h[idr] > 0) {
                h[idr] -= tmp;
                idr++;
            }
            ans += tmp;
        }
    }
    cout << ans << "\n";
    return 0;
}


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

int main(){
  int A, B; cin >> A >> B;
  if (A <= 9 && B <= 9) cout << A * B << endl;
  else cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#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
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =1e9+7;
const int maxn = 300005;
#define endl '\n'
#define ld long double
#define int ll
#define all(x) (x).begin(),(x).end()
struct DSU{
  vector<int>par,sz;
  DSU(int n)
  {
    par.resize(n);
    sz = vector<int>(n,1);
    iota(par.begin(),par.end(),0);
  }
  int find(int x){
      if(x==par[x])
        return x;
      return par[x] = find(par[x]);
  }
  void unite(int a, int b){
      a = find(a);
      b = find(b);
      if(a==b)
        return ;
      if(sz[a]<sz[b])
        swap(a,b);
      par[b] = a;
      sz[a]+=sz[b];
      return ;
  }
};
int32_t main()
{ 
  IOS


  int n, m;
  cin >> n >> m;
  DSU dsu(n);
  for(int i = 0;i<m;i++){
    int u, v;
    cin >> u >> v;
    dsu.unite(u-1,v-1);
  }
  int ans = 0;
  for(int i = 0;i<n;i++){
    ans  = max(ans,dsu.sz[i]);
  }

  cout << ans << endl;







  
    
} 



Measured memory_bytes: 6364
N = int(input())
ARR = list(map(int, input().split()))

sum_of_Humidai = 0
for i in range(1, len(ARR)):
    diff = (ARR[i - 1] - ARR[i])
    if diff > 0:
        ARR[i] += diff
        sum_of_Humidai += diff
else:
    print(sum_of_Humidai)

Measured memory_bytes: 32060
#include <stdio.h>

int main(void)
{
	int x1,x2;
	scanf("%d %d",&x1,&x2);
	if(x1<x2){
		printf("%d\n",x2-x1);
	}
	else if(x2<x1){
		printf("%d\n",x1-x2);
	}
	else{
		printf("%d\n",x1-x2);
	}
	return 0;
}


Measured memory_bytes: 2084
#include<stdio.h>

int main() {
	int n, i, num,count = 0,j;
	scanf("%d", &n);
	for (i = 0; i < n; ++i) {
		scanf("%d", &num);
		for (j = 2; j * j <= num; ++j) {
			if (num % j == 0) break;
		}
		if (num < j * j) ++count;
	}
	printf("%d\n", count);
}



Measured memory_bytes: 1972
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF 1LL<<60
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) (a)<=(i) && (i)<(b)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;

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

  int n;
  cin >> n;

  vector<int> a(n);
  REP(i,n) cin >> a[i];
  
  vector<int> dp(n,0);
  dp[1] = abs(a[1]-a[0]);
  FOR(i,1,n){
    dp[i+1] = min(dp[i]+abs(a[i+1]-a[i]),dp[i-1]+abs(a[i+1]-a[i-1]));
  }

  cout << dp[n-1] << endl;

  return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#define GYOU_MAX 256
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define s_pri(str) printf("%s\n",str);
#define PRINT(str) printf(#str "\n")
#define v_pri(val) printf("%d\n",val);
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
typedef long long int ll;


int main(void) {

	char S[101], T[101];
	scanf("%s%s", S, T);
	char X[200] = "";
	char S1[101];
	strcpy(S1, S);
	for (;;) {
		X[1] = '\0';
		//s_pri(X);
		X[0] = S[strlen(S) - 1];
		//s_pri(X);
		S[strlen(S) - 1] = '\0';
		strcat(X, S);
		strcpy(S, X);
		if (strcmp(S, T) == 0) {
			s_pri("Yes");
			break;
		}

		if (strcmp(S, S1) == 0) {
			s_pri("No");
			break;
		}

	}

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll a[5];
    rep(0,i,5)cin>>a[i];
    sort(a,a+5);
    ll k;
    cin>>k;
    if(a[4]-a[0]>k){
        cout<<":("<<endl;
        return 0;
    }
    cout<<"Yay!"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n;
  while(cin>>n){
    if(n==0)break;
    int count=0;
    for(int i=1;i<n;i++){
      int a=0;
      for(int j=i;a<=n;j++){
	a+=j;
	if(n==a)count++;
      }
    }
    cout<<count<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
import java.io.File;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.List;
import java.util.Scanner;

public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner in = new Scanner(file);
		
		Scanner in = new Scanner(System.in);
		
		int x = in.nextInt();
		int y = in.nextInt();
		boolean ans = false;
		int[][] list = {{1,3,5,7,8,10,12},{4,6,9,11}};
		
		boolean tf1 = false, tf2 = false;
		for(int i = 0; i < list[0].length; i++){
			if(list[0][i] == x) tf1 = true;
			if(list[0][i] == y) tf2 = true;
		}
		if(tf1 && tf2) ans = true;
		
		tf1 = false; tf2 = false;
		for(int i = 0; i < list[1].length; i++){
			if(list[1][i] == x) tf1 = true;
			if(list[1][i] == y) tf2 = true;
		}
		if(tf1 && tf2) ans = true;
		
		System.out.println(ans ? "Yes" : "No");
	}
}


Measured memory_bytes: 23252
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

// ================================================= //


/*
 1-index
 RangeAdd : [s,t] に xを加算
 RangeSum : [s,t] の総和を出力
 */
struct BIT {
    int N;
    vector<ll> bit1;
    vector<ll> bit2;
    BIT(int N):N(N) {
        /* BITは[1..N]で扱う */
        bit1.resize(N + 1, 0);
        bit2.resize(N + 1, 0);
    }
    
    void add1(int x, int val){
        while (x <= N) {
            bit1[x] += val;
            x += x & -x;
        }
    }
    void add2(int x, int val){
        while (x <= N) {
            bit2[x] += val;
            x += x & -x;
        }
    }
    
    // [l,r]
    void RangeAdd(int l,int r,int val){
        // Update BIT1
        add1(l,val);
        add1(r+1,-val);
        
        // Update BIT2
        add2(l,val*(l-1));
        add2(r+1,-val*r);
    }
    
    int sum1(int x){
        int ret = 0;
        while (x) {
            ret += bit1[x];
            x &= (x - 1);
        }
        return (ret);
    }
    
    int sum2(int x){
        int ret = 0;
        while (x) {
            ret += bit2[x];
            x &= (x - 1);
        }
        return (ret);
    }
    
    int sum(int x){
        return sum1(x)*x - sum2(x);
    }
    // [l,r]
    int RangeSum(int l,int r){
        return sum(r) - sum(l-1);
    }
};


int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    int n,q; cin >> n >> q;
    
//    SegTree ST(n);
    BIT bit(n);
    while(q--){
        int com,x,y; cin >> com >> x >> y;
        if(com == 0){
           // ST.update(x-1,y);
            bit.RangeAdd(x,x,y);
        }else{
            //cout << ST.rsq(x-1,y) << endl;
            cout << bit.RangeSum(x,y) << endl;
        }
    }
    
    return 0;
}



Measured memory_bytes: 4280
#D - Ki問題　maspyさん
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

# 遅延評価で加えてあげるだけ

N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

value = [0] * (N+1)
for p,x in PX:
    value[p] += x

def dfs(v,parent,add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,value[v])

dfs(1,0,0)

answer = ' '.join(map(str,value[1:]))
print(answer)

Measured memory_bytes: 285828
#include <cstdio>//为了快
long long n,a[100010],x,ans,yy;//我知道可以不定义数组，但为了用空间换时间（怕超时）
int main()
{
    register int i;//register定义循环变量据说能加速
    scanf("%lld%lld",&n,&x);//注意是%lld
    for (i=1;i<=n;i++)//从1~n很好地保证了第一个是a[0]和a[1],相当于单独考虑a[1]
    {
        scanf("%lld",&a[i]);//输入
        if (a[i]+a[i-1]>x)yy=a[i]+a[i-1]-x,a[i]-=yy,ans+=yy;//两数之和超过，优先吃后面的，贪心（为了使后面加起来更小）
    }
    printf("%lld",ans);//lld哦
    return 0;//记得返回0
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  
  vector<int> a(n);
  
  for (int i = 0; i < n; i++) cin >> a.at(i);
  
  for (int i = 0; i < k; i++) {
    vector<int> x(n);
    for (int j = 0; j < n; j++) {
      int l = max(0, j - a.at(j)), r = j + a.at(j) + 1;
      x.at(l)++;
      if (r < n) x.at(r)--;
    }
    for (int j = 1; j < n; j++) x.at(j) += x.at(j - 1);
    if (a == x) break;
    a = x;
  }
  
  for (int i = 0; i < n; i++) {
    if (i) cout << " ";
    cout << a.at(i);
  }
  cout << '\n';
}

Measured memory_bytes: 4976
import java.util.Scanner;

/**
 * Created by enpingkuang on 2020/9/19 7:53 下午
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        long dp[] = new long[1000006];
        for(int i = 1;i<1000006;i++){
            for(int j = 1;j*i<1000006;j++){
                dp[j*i]++;
            }
        }
        if(n== 1){
            System.out.println(1);
        }else{
            long ans = 1;
            for(int i = 2;i<n;i++){
                ans += dp[i];
            }
            System.out.println(ans);
        }

    }
}


Measured memory_bytes: 43672
L, R = gets.split.map(&:to_i)
M = 10**9 + 7

#  y % x == y ^ x  ==>  y.to_s(2).length == x.to_s(2).length && y - x == y ^ x
#  1-1 == 1^1 = 0, 1-0 == 1^0 = 1, 0-0 == 0^0 = 0, but 0-1 = -1 != 0^1 = 1
m = (10**18).to_s(2).length
#  dp[digit][L<=x?][y<=R?][msb?]
dp = Array.new(m + 1){Array.new(2){Array.new(2){Array.new(2, 0)}}}
dp[m][0][0][0] = 1  # x, y = 1, 1
c3 = [0, 1].repeated_permutation(3)
c2 = [[0, 0], [0, 1], [1, 1]]  # x, y != 1, 0
(m - 1).downto(0).each do |i|
  l, r = L >> i & 1, R >> i & 1
  c3.each do |j, k, s|
    d0 = dp[i + 1][j][k][s] % M
    c2.each do |x, y|
      next if s == 0 && x != y
      next if j == 0 && x == 0 && l == 1
      next if k == 0 && y == 1 && r == 0
      nj, nk, ns = j, k, s
      nj = 1 if x == 1 && l == 0
      nk = 1 if y == 0 && r == 1
      ns = 1 if x == 1 && y == 1
      dp[i][nj][nk][ns] += d0
    end
  end
end
puts dp[0].flatten.inject(:+) % M

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

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pi >
#define pi pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
#define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
#define FOR(var, to)          UPTO(var, 0, (to)-1)
#define DOWN(var, from)       DOWNTO(var, (from)-1, 0)

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF ((1 << 30)-1)
#define LINF ((1LL << 62)-1)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

struct Comb {
    vector<vector<s64> > data;
    Comb(int n) { // O(n^2)
        data = vector<vector<s64> >(n+1,vector<s64>(n+1,1));
        UPTO(i,1,n) {
            FOR(j,i+1) {
                if (!j || j == i) data[i][j] = 1;
                else data[i][j] = data[i-1][j-1] + data[i-1][j];
            }
        }
    }

    s64 ncr(int n, int r) {
        return data[n][r];
    }
};

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}


#define INPUT_SIZE 3000000
char input[INPUT_SIZE];
char *ptr = input;

void init() {
	size_t read_byte = fread_unlocked(input, 1, INPUT_SIZE-1, stdin);
	assert(read_byte);
	assert(read_byte < INPUT_SIZE-2);
}
int ri() {
	int r=0,s=0;
	for(;;){assert(*ptr);if(*ptr=='-'){s=1;break;}if(*ptr<='9'&&*ptr>='0'){r=*ptr-'0';break;}ptr++;}
	ptr++;
	for(;;){if(*ptr<'0'||*ptr>'9')break;r=r*10+*ptr-'0';ptr++;}
	ptr++;
	if(s)r=-r;
	return r;
}


int main() {
	init();
    int n = ri();
	int m = ri();
	s64 nn = 0;
	s64 mm = 0;
	int last = ri();
	FOR(i,n-1) {
		int a = ri();
		nn += ((s64)a-last)*(n-i-1)*(i+1)%1000000007;
		last = a;
	}
	last = ri();
	FOR(i,m-1) {
		int a = ri();
		mm += ((s64)a-last)*(m-i-1)*(i+1)%1000000007;
		last = a;
	}
	nn %= 1000000007;
	mm %= 1000000007;

	cout << (((s64)nn)*mm%1000000007) << endl;
    return 0;
}


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

using namespace std;

#define all(v)				((v).begin()), ((v).end())
#define allr(v)				((v).rbegin()), ((v).rend())
#define sz(v)				((int)((v).size()))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
#define ll long long
#define pb					push_back
#define fIO ios_base::sync_with_stdio(0);cin.tie(0);

const ll inf = 1e8;
const double pi = 3.1415926535897;


const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}


typedef vector<int>                vi;
typedef vector<pair<int,int>>      vii;
typedef vector<ll>                 vll;
typedef vector<double>             vd;
typedef vector< vi >               vvi;
typedef vector< vd >               vvd;
typedef vector<string>             vs;

/**
    * PLEASEEE READDD PROBLEEEM CARFULLY ****
    * Always check for OVERFLOW ll vs int
    * Always check for array bounds
    * Check for function return
    * READ OUTPUT SECTION AGAIN!!!
**/

const int N = 1e5 + 5;

vi grp[N];

int main(){
    fIO

    int n, m;
    cin >> n >> m;

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

        grp[a].pb(b);
    }

    priority_queue<int> pq;

    int ans = 0;
    for(int i = 1; i <= m; i++){
        for(auto it : grp[i]) pq.push(it);

        if(pq.empty()) continue;

        ans += pq.top(); pq.pop();
    }
    cout << ans;
}







Measured memory_bytes: 5632
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void){
  int w, h, n;
cin>>w>>h>>n;
int xl=0,xh=w,yl=0,yh=w;
REP(i,0,n){
int x,y,a;
cin>>x>>y>>a;
if(a==1)xl=max(xl,x);
if(a==2)xh=min(xh,x);
if(a==3)yl=max(yl,y);
if(a==4)yh=min(yh,y);

}
cout << max(xh - xl, 0) * max(yh -yl, 0) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <cinttypes>
#include <string.h>
#include <bits/stdc++.h>

#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define abs(a) (((a) < 0) ? -(a) : (a))

#define FOR(var, to)          for (register int var = 0; var < to; var++)
#define FROMTO(var, from, to) for (register int var = from; var <= to; var++)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

using namespace std;

static inline int ri() {
	int a;
	scanf("%d", &a);
	return a;
}

static inline s64 rs64() {
	s64 a;
	scanf("%" SCNd64, &a);
	return a;
}

static inline void wi(int a) {
	printf("%d", a);
}

static inline void wu64(u64 a) {
	printf("%" PRIu64, a);
}

typedef struct {
	int a;
	int b;
}Need;
int com_need(const void *a, const void *b) {
	return (((Need*)a)->b - ((Need*)b)->b);
}

int main() {
	int n = ri();
	int m = ri();
	Need a[m];
	FOR(i,m) a[i].a=ri()-1,a[i].b=ri()-1;
	
	qsort(a,m,sizeof(Need),com_need);
	
	int res = 0;
	
	int cur_r = -1;
	FOR(i,m) {
		// printf("%d\n", a[i].b);
		if (!(a[i].a < cur_r)) {
			res++;
			cur_r = a[i].b;
		}
	}
	
	printf("%d", res);
	
	return 0;
}


Measured memory_bytes: 1788
import java.util.*;

class Main{
	public static void main(String args[]){
		Solve s = new Solve();
		s.solve();
	}
}

class Solve{
	Scanner in = new Scanner(System.in);

	void solve(){
		while(in.hasNext()){
			int n = in.nextInt(), s = in.nextInt(), e = in.nextInt();
			if(n == 0 && s == 0&& e == 0) return;
			int a[] = new int[24 * 60 + 100];
			s = toM(s); e = toM(e);
			//a[s] = 1; a[e+1] = -1;
			for(int i = 0; i < n ; i++){
				int t = in.nextInt();
				for(int j = 0; j < t; j++){
					int ts = toM(in.nextInt()), te = toM(in.nextInt());
					a[ts] += 1; a[te] -= 1;
				}
			}
			for(int i = 1; i < 24 * 60 + 100; i++){
				a[i] += a[i-1];
			}
			int ans = 0;
			for(int i = s; i < e ; i++){
				if(a[i] == n) a[i] = 0;
				else a[i] = a[i>0?i-1:0] + 1;
				//System.out.println(toH(i)+" "+a[i]);
				ans = Math.max(ans, a[i]);
			}
			System.out.println(ans);
		}
	}
	int toM(int h){
		return (h/100)*60+h%100;
	}
	int toH(int m){
		return m/60*100+m%60;
	}
}

Measured memory_bytes: 26372
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << endl
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
int dx8[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

// 入力
int N;

//添え字ややこしいときはメモ化再帰でいいかも
// DP テーブル
double dp[310][310][310];
double rec(int i, int j, int k) {
    if (dp[i][j][k] >= 0) return dp[i][j][k];
    if (i == 0 && j == 0 && k == 0) return 0.0;

    double res = 0.0;
    if (i > 0) res += rec(i-1, j, k) * i;//iからとる遷移だからそもそも愛がなければ期待値は０
    if (j > 0) res += rec(i+1, j-1, k) * j;
    if (k > 0) res += rec(i, j+1, k-1) * k;
    res += N;
    res *= 1.0 / (i + j + k);

    return dp[i][j][k] = res;
}

int main() {
    cin >> N;
    int one = 0, two = 0, three = 0;
    for (int i = 0; i < N; ++i) {
        int a; cin >> a;
        if (a == 1) ++one;
        else if (a == 2) ++two;
        else ++three;
    }

    // 初期化
    Fill(dp,-1);

    // 答え
    cout << fixed << setprecision(10) << rec(one, two, three) << endl;
}

Measured memory_bytes: 233088
#include<iostream>
#include<string>
using namespace std;
struct Dice{
  int s[6];
  void roll(char c){
    int b;
    if(c=='E'){
      b=s[0];
      s[0]=s[3];
      s[3]=s[5];
      s[5]=s[2];
      s[2]=b;
    }
    if(c=='W'){
      b=s[0];
      s[0]=s[2];
      s[2]=s[5];
      s[5]=s[3];
      s[3]=b;
    }
    if(c=='N'){
      b=s[0];
      s[0]=s[1];
      s[1]=s[5];
      s[5]=s[4];
      s[4]=b;
    }
    if(c=='S'){
      b=s[0];
      s[0]=s[4];
      s[4]=s[5];
      s[5]=s[1];
      s[1]=b;
    }
    if(c=='R'){
      b=s[1];
      s[1]=s[2];
      s[2]=s[4];
      s[4]=s[3];
      s[3]=b;
    }    
  }
  int top() {
    return s[0];
  }
  int right(){
    return s[2];
  }
  int left(){
    return s[3];
  }
  int front(){
    return s[1];
  }
};
int main(){
  Dice d;
  for(int i=0;i<6;i++) cin >> d.s[i];
  int n;cin >> n;
  while(n--){
    int a,b;cin >> a >> b;
    if(d.left()==a) d.roll('E');
    if(d.right()==a) d.roll('W');
    while(d.top()!=a) d.roll('N');
    while(d.front()!=b) d.roll('R');
    cout << d.right() << endl;
  }
  return 0;
}



Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w,k;
  cin>>h>>w>>k;
  vector<string> c(h);
  for(int i=0;i<h;i++)
    cin>>c.at(i);
  int a=0;
  for(int bi=0;bi<(1<<h);bi++){
    for(int bj=0;bj<(1<<w);bj++){
      vector<bool> vi(h);
      vector<bool> vj(w);
      int xi=bi;
      int xj=bj;
      for(int i=0;i<h;i++){
        vi.at(i)=xi%2;
        xi/=2;
      }
      for(int j=0;j<w;j++){
        vj.at(j)=xj%2;
        xj/=2;
      }
      int x=0;
      for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
          if(vi.at(i)&&vj.at(j)&&c.at(i).at(j)=='#')
            x++;
      a+=(x==k?1:0);
    }
  }
  cout<<a<<endl;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <math.h>

int main(void){
	int n,i;
	int score[1000];
	int sum;
	double a,a2,m;
	
	while(1){
		scanf("%d",&n);
		if(n==0)
			break;
		sum=0;
		a=0;
		a2=0;
		m=0;
		for(i=0; i<n; i++){
			scanf("%d", &score[i]);
			sum += score[i];
		}
		m = (double)sum/n;
		for(i=0; i<n; i++){
			a2 += pow((score[i]-m),2);
		}
		a2 = a2/n;
		a = sqrt(a2);
		printf("%.8f\n",a);

	}

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/**
*   author: j o s e m a g o
*   user: m a m i s a k i
**/
using namespace std;

/***PLANTILLA***/

using namespace __gnu_pbds; //*st.find_by_order(1);  st.order_of_key(p);
#pragma GCC optimize ("Ofast")
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mset(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define sz(x) ((int)(x).size())
#define rsz resize
#define ln "\n"
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef double dbl;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
const ld PI = 2*acos(0.0);
const int MOD = 1000000007;

string tostring(auto a){
    stringstream ss;ss<<a;string s = ss.str();
    return s;
}

/**Mi Debug**/
#define var(x) cout<<#x<<" = ";
#define db(x) cout<<#x<<" = "<<x<<"\n";
void dbvector(vector<auto>&v){
    int c = -1;
    for(auto i: v){
        c++;cout<<"["<<c<<":"<<i<<"] ";
    }cout<<"\n";
}
void dbmapa(map<auto,auto>mp){
   for(auto x : mp) cout<<"{"<<x.first<<":"<<x.second<<"} ";cout<<"\n";
}
void dbstring(string v){
    int c = -1;
    for(auto i: v){
        c++;cout<<"["<<c<<":"<<i<<"] ";
    }cout<<"\n";
}

/***********Code***************/

const int JJJ = 100100;










int main(){

  //freopen("input.in","r",stdin);
  //freopen("input.out","w",stdout);

    ios_base::sync_with_stdio(0); cin.tie(0);


    ll n;
    cin >> n;
    ll suma = 0;
    for(int i = 1;i <= n;i++){
        if(i % 5 != 0 && i % 3 != 0){
            suma+=i;
        }
    }
    cout<<suma;





    return 0;
}


Measured memory_bytes: 3568
#include <iostream>
#include <string>

using namespace std;

void solve()
{
	int n;
	cin >> n;
	while(n--)
	{
		int point = 0;
		bool base[3] = {false};
		int remain = 3;
		while(remain)
		{
			string str;
			cin >> str;
			if(str == "HIT")
			{
				if(base[2])
				{
					++point;
					base[2] = false;
				}
				for(int i = 1; i >= 0; --i)
				{
					if(base[i])
					{
						base[i + 1] = true;
					}
				}
				base[0] = true;
			}
			else if(str == "HOMERUN")
			{
				for(int i = 0; i < 3; ++i)
				{
					if(base[i])
					{
						++point;
					}
					base[i] = false;
				}
				++point;
			}
			else if(str == "OUT")
			{
				--remain;
			}
		}
		cout << point << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1212
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x) {

  S[++top]=x;
}

int pop() {
  top--;

  return S[top+1];
}

int main() {
  int a, b;
  top=0;
  char s[100];
  while (scanf("%s", s) != EOF) {
    if (s[0]=='+') {
      a=pop();
      b=pop();
      push(a+b);
    } else if (s[0]=='-') {
      b=pop();
      a=pop();
      push(a-b);
    } else if (s[0]=='*') {
      a=pop();
      b=pop();
      push(a*b);
    } else {
      push(atoi(s));
    }
  }

  printf("%d\n", pop());

  return 0;
}



Measured memory_bytes: 2044
#include <cmath>
#include <cstdio>

#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(), x.end()

using namespace std;
typedef long long int ll;

int main() {
  ll h ,w;
  cin >> h >> w;
  vector<vector<ll>> vv(h,vector<ll>(w));
  rep(i, h){
    string tmp;
    cin >> tmp;
    rep(j, w) vv.at(i).at(j) = tmp.substr(j,1)=="#" ? 1:0;
  }
  bool flag=true;
  rep(i, h) rep(j, w){
    if(vv.at(i).at(j)==1 && flag){
      if(0<=i-1 && flag) flag = vv.at(i-1).at(j)==0;
      if(h>i+1 && flag) flag = vv.at(i+1).at(j)==0;
      if(0<=j-1 && flag) flag = vv.at(i).at(j-1)==0;
      if(w>j+1 && flag ) flag = vv.at(i).at(j+1)==0;
      flag = !flag;
    }
  }
  if (flag) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
using System;

namespace WA047A
{
    class Program
    {
        static void Main(string[] args)
        {
            var X = int.Parse(Console.ReadLine());
            var A = int.Parse(Console.ReadLine());
            var B = int.Parse(Console.ReadLine());

            Console.WriteLine($"{(X-A) % B}");
        }
    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<numeric>
#include<iomanip>
#include<utility>
#include<cstdlib>
#include<typeinfo>


using namespace std;
#define INF 1000000005
int main()
{
std::string str;
std::cin >> str;
int l = str.length();
int out = INF;
for(int i = 0; i < l - 1; i++){
    if(str[i] != str[i+1]){
        if(max(i + 1,l - i - 1) < out){
            out = max(i + 1,l - i - 1);
        }
    }
}
if(out == INF){
    std::cout << l << std::endl;
}else {
    std::cout << out << std::endl;
}
return 0;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m, k;
	cin >> n >> m >> k;
	vi isdark(n,-1);
	vi d(m);
	REP(i, m) {
		cin >> d[i];
		d[i]--;
		isdark[d[i]] = i;
	}
	vvi v(n, vi(k));
	REP(i, n)REP(j, k) {
		cin >> v[i][j]; v[i][j]--;
	}
	vvi g(1 << m);
	REP(i, 1 << m) {
		REP(j, k) {
			int next = 0;
			REP(l, m) {
				if (i&(1 << l)) {
					int tmp = v[d[l]][j];
					if (isdark[tmp] >= 0)next |= (1 << isdark[tmp]);
				}
			}
			g[i].push_back(next);
		}
	}
	queue<int> q;
	q.push((1 << m )- 1);
	vi dist(1 << m, INF);
	dist[(1 << m) - 1] = 0;
	while (!q.empty()) {
		int p = q.front(); q.pop();
		REP(i, k) {
			if (dist[g[p][i]] > dist[p] + 1) {
				dist[g[p][i]] = dist[p] + 1;
				q.push(g[p][i]);
			}
		}
	}
	cout << dist[0] << endl;
}



Measured memory_bytes: 38776
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <set>
#define N 3005
using namespace std;

typedef long long ll;
ll x, y, z, k, a[N], b[N], c[N];
set<ll> v;
struct st {
	ll t1, t2, t3, s;
};
priority_queue<st> qu;

bool operator < (st p, st q) {
	return p.s < q.s;
}

void f(ll p, ll q, ll w) {
	ll o = p * y * z + q * z + w;
	if (v.count(o) == 1) return;
	v.insert(o);
	qu.push({p, q, w, a[p] + b[q] + c[w]});
}
int main()
{
	ll i;
	st t;
	cin >> x >> y >> z >> k;
	for (i = 0; i < x; i++) scanf ("%lld", &a[i]);
	for (i = 0; i < y; i++) scanf ("%lld", &b[i]);
	for (i = 0; i < z; i++) scanf ("%lld", &c[i]);
	sort(a, a + x);
	sort(b, b + y);
	sort(c, c + z);
	f(x - 1, y - 1, z - 1);
	for (i = 0; i < k; i++) {
		t = qu.top(); qu.pop();
		printf("%lld\n", t.s);
		if (t.t1 > 0) f(t.t1 - 1, t.t2, t.t3);
		if (t.t2 > 0) f(t.t1, t.t2 - 1, t.t3);
		if (t.t3 > 0) f(t.t1, t.t2, t.t3 - 1);
	}
    return 0;
}


Measured memory_bytes: 768
# include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10 , mod = 1e9 + 7;
int deg[N] , n , k;
vector < int > edges[N];
long long res = 1;
long long dfs(int x , int p , int sum){
	res *= (k - sum);
	res %= mod;
	int count = 0;
	for(int i = 0; i < edges[x].size(); i ++){
		int u = edges[x][i];
		if(u != p)
			dfs(u , x , count + (p != 0) + 1),
			count ++;
	}
	return res;
}
int main(){
	cin >> n >> k;
	for(int i = 1; i < n; i ++){
		int a , b;
		scanf("%d%d" , &a , &b);
		edges[a].push_back(b); 
		edges[b].push_back(a);  
		deg[a] ++;
		deg[b] ++;
	}
	cout << dfs(1 , 0 , 0) << "\n"; 
}

Measured memory_bytes: 13184
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,k;
  cin >> n >> k;
  long long score[n];
  for(int i=0;i<n;i++){
    cin >> score[i];
  }
  
  for(int i=k;i<n;i++){
    if(score[i] > score[i-k]){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 5124
N, T = map(int, input().split())
path_list = [list(map(int, input().split())) for _ in range(N)]
min_cost = 1001
for path in path_list:
	if T >= path[1] and path[0] < min_cost:
		min_cost = path[0]
print(min_cost if min_cost < 1001 else 'TLE')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define pb push_back

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 
 // look at first test case
 //1:5
 //2:5
 //3:6
 //4:6
 //5:7
 

void solve(){
	ll n,a,b,c,d,e; cin >> n >> a >> b >> c >> d >> e;
	ll minn = min({a,b,c,d,e});
	ll ans = 5 + (n-1)/minn;
	cout << ans;
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


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

int main(){
    ll N,M;
    cin >> N >> M;
    vector<ll> jobs[M];
    ll result=0;
    rep(i,N){
        ll a,b;
        cin >> a >> b;
        if(a>M) continue;
        jobs[M-a].push_back(b);
    }
    priority_queue<ll> q;
    for(ll i=M-1;i>=0;i--){
        for(ll b : jobs[i]){
            q.push(b);
        }
        if(!q.empty()){
            result += q.top();
            //cout << i << " +" << q.top() << endl;
            q.pop();
        }
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 5632
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<set>

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N, K;
	
	int con = 0;
	bool flag = false;
	vector<int> P, X, Y;
	set<int> se;
	
	cin>>N>>K;
	
	P.resize(N);
	X.resize(N);
	
	
	for(int i = 0; i < N; i++){
		cin>>P[i];
		
		// if(i < K) Y.push_back(P[i]);
	}
	
	// sort(Y.begin(), Y.end());
	
	// bool flag = false;
	
	// for(int i = 0; i < K; i++){
		// if(P[i] != Y[i]){
			// flag = true;
			// break;
		// }
	// }
	
	// if(flag == false){
		// X[0] = true;
	// }
	
	for(int i = 1, c = 0; i < N; i++){
		if(P[i-1] < P[i]){
			c++;
		} else {
			c = 0;
		}
		if(i-K+1 >= 0 && c >= K-1){
			X[i-K+1] = true;
			flag = true;
		}
		
	}
	if(flag) con++;
	
	// for(int i = 0; i < N; i++){
		// cout<<i<<" "<<X[i]<<endl;
	// }
	
	for(int i = 0, j = 0, hoge = -1, fuga = -1; i < N - K + 1; i++){
		for(; j < N && j < i + K; j++){
			se.insert(P[j]);
		}
		auto b = se.begin(), e = se.end();
		int hoge2, fuga2;
		e--;
		e--;
		hoge2 = *b;
		fuga2 = *e;
		// cout<<"i = "<<i<<" j = "<<j<<" "<<hoge<<" "<<fuga<<endl;
		// cout<<"i = "<<i<<" j = "<<j<<" "<<hoge2<<" "<<fuga2<<endl;
		// for(auto z = se.begin(); z != se.end(); z++){
			// cout<<*z<<" ";
		// }
		// cout<<endl;
		if((hoge2 != hoge || fuga2 != fuga)&& X[i] == false) con++;
		
		
		b++;
		e++;
		// cout<<"b = "<<*b<<" e = "<<*e<<" X "<<X[i]<<endl;
		hoge = *b;
		fuga = *e;
		se.erase(P[i]);
	}
	
	cout<<con<<endl;
	
	return 0;
}

Measured memory_bytes: 12800
import fractions
a, b, c, d = map(int, input().split())
a -= 1
ans = b - a
lcm = (c * d) // fractions.gcd(c, d)
ele_fact_c = (b // c) - (a // c)
ele_fact_d = (b // d) - (a // d)
ele_fact_lcm = (b // lcm) - (a // lcm)
ele_remove = ele_fact_c + ele_fact_d - ele_fact_lcm
ans -= ele_remove
print(ans)

Measured memory_bytes: 5052