akhauriyash/Code-Regression huggingface dataset:
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}

ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 1000000000;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};

int main(){
  int N; cin >> N;
  vector<string> S(N); rep(i, N) cin >> S[i];
  string ans = "";
  rep(i, S[0].size()){
    bool l = 1;
    rep(j, N){
      if(j == 0) continue;
      bool l_ = 0;
      rep(k, S[j].size()){
        if(S[j][k] == S[0][i]) l_ = 1;
      }
      if(l_ == 0) l = 0;
    }
    if(l == 1){
      ans += S[0][i];
      rep(j, N){
        if(j == 0) continue;
        rep(k, S[j].size()){
          if(S[j][k] == S[0][i]){
            S[j][k] = '$';
            break;
          }
        }
      }
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back 
#define ff first
#define ss second
#define mod 1000000007
#define ll long long int
using namespace std;


int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   
  
	char a;
	cin>>a;
	cout<<char(a+1);
   return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
ll n,k[40],f[40],ans;
char s[40];
ll pw(ll x,ll y){
    ll res=1;
    while(y){
        if(y&1)res=res*x%M;
        x=x*x%M;
        y>>=1;
    }
    return res;
}
ll cm(ll x,ll y){
    return k[x]*f[y]%M*f[x-y]%M;
}
int main(void){
    cin>>n>>s;
    k[0]=1;
    f[0]=1;
    for(ll i=1;i<=n;i++){
        k[i]=k[i-1]*i%M;
        f[i]=pw(k[i],M-2);
    }
    for(int i=0;i<1<<n;i++){
        vector<char>a,b;
        for(int j=0;j<n;j++){
            if((i>>j)&1)a.push_back(s[j]);
            else b.push_back(s[j]);
        }
        if(i!=0){
            reverse(a.begin(),a.end());
        }
        if(i!=(1<<n)-1){
            reverse(b.begin(),b.end());
        }
        ll dp[19][19][19]={};
        dp[0][0][0]=1;
        for(int j=0;j<n;j++){
            for(int o=0;o<=j&&o<=a.size();o++){
                for(int l=0;l+o<=j&&l<=b.size();l++){
                    dp[j+1][o][l]+=dp[j][o][l];
                    if(o<a.size()&&s[j+n]==a[o])dp[j+1][o+1][l]+=dp[j][o][l];
                    if(l<b.size()&&s[j+n]==b[l])dp[j+1][o][l+1]+=dp[j][o][l];
                }
            }
        }
        ans+=dp[n][a.size()][b.size()];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")    
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 9999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(50) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 998244353
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,H,W,M,K,L,R,N,num=0,sum=0,flag=0;string S,T;
  cin >> T;
  N=T.size();
  rep(i,0,N){
    if(T[i]=='?')T[i]='D';
  }
  Out(T);
}

Measured memory_bytes: 3744
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, char** argv)
{
    int A, B, K;
    cin >> A >> B >> K;

    vector<int> results;
    for (int i = 1; i <= min(A, B); i++) {
        if (A % i == 0 && B % i == 0) results.push_back(i);
    }
    sort(results.begin(), results.end(), greater<int>());
    cout << results[K - 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++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);

int main() {
  string s; cin >> s;
  set<string> x;

  int ans = 0;
  string now = "";
  string prev = "";
  rep(i, s.length()) {
    now += s[i];
    if (now != prev) {
      ans++;
      prev = now;
      now = "";
    }
  }

  reverse(all(s));
  int ans2 = 0;
  now = "";
  prev = "";
  rep(i, s.length()) {
    now += s[i];
    if (now != prev) {
      ans2++;
      prev = now;
      now = "";
    }
  }

  cout << max(ans, ans2) << endl;

  return 0;
}

Measured memory_bytes: 640
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4") // wonderful

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

#define forn(i, a, n) for (int i = (a); i < (int)n; i++)
#define trav(x, arr) for (auto &x : arr)
#define sz(x) (int)x.size()
#define Matrix(m, h, w) = std::vector<vector<int>> m(h, vector<int> (w)); 
using ll = long long;

#define vi vector<int>
#define vl vector<long>
#define vll vector<ll>

// benq
const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 100001;


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

    float n; cin >> n;
    n = ceil(n/2);
    cout << n;
    return 0;
}

Measured memory_bytes: 384
using System;
using System.IO;
using System.Text;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;

namespace SubmitCS
{
    class Program
    {
        // Change standard input(when run on local machine)
        [Conditional("ON_LOCAL_ENV")]
        static void SetStandardInput()
        {
            var input_stream = new StreamReader("StandardInput.txt", Encoding.UTF8);
            Console.SetIn(input_stream);
        }

        // Read all lines from standard input
        static List<string> ReadLines()
        {
            return ReadLines(10000);
        }
        static List<string> ReadLines(int max_lines)
        {
            var lines = new List<string>();

            for(int i = 0 ; i < max_lines ; i++)
            {
                string line = Console.ReadLine();
                if (line == null)
                    break;
                else
                    lines.Add(line);
            }

            return lines;
        }

        static void Main(string[] args)
        {
            SetStandardInput();
            Algorithm();
        }

        static void Algorithm()
        {
            
            List<string> lines = ReadLines();
            int k = int.Parse(lines[0]);
            
            string[] ab = lines[1].Split(' ');
            int a = int.Parse(ab[0]);
            int b = int.Parse(ab[1]);


            IEnumerable<int> nums = Enumerable.Range(a, b - a + 1);
            var count = nums.Count(n => n % k == 0);

            if(0 < count)
                Console.WriteLine("OK");
            else
                Console.WriteLine("NG");
        }
    }
}


Measured memory_bytes: 28336
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline()[:-1]

def check(d, x):
    c = 0
    while x % 100 == 0:
        x //= 100
        c += 1
    return c == d

def solve():
    d, n = [int(x) for x in input().split()]
    cnt = 0
    val = 0
    while cnt < n:
        val += 1
        if check(d, val): cnt += 1
    print(val)


t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()

"""

"""



Measured memory_bytes: 9464
#include <bits/stdc++.h>
#include <cstdio>
 
using namespace std;
using ll = long long;
 
#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define RS resize
#define CINV(v, N) do {\
	v.RS(N);\
	rep(i, N) cin >> v[i];\
} while (0);
#define RCINV(v, N) do {\
	v.RS(N);\
	rrep(i, N) cin >> v[i];\
} while (0);
template<typename T>
inline T GET() {
	T val;
	cin >> val;
	return val;
}

void init();
void solve();

signed main()
{
    init();
    solve();
}

vector<int> a, dp;
int N, K;

void init()
{
	cin >> N >> K;
	CINV(a, N);
}

void solve()
{
	dp.RS(N, INT_MAX);
	dp[0] = 0;
	reps(i, 1, N) {
		reps(j, 1, K+1) {
			if (i-j < 0) break;
			dp[i] = min(dp[i], dp[i-j] + abs(a[i] - a[i-j]));
		}
	}
	cout << dp[N-1] << endl;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(a) cout<<#a<<":"<<a<<endl;
const int INF=0x3f3f3f3f;
const int N=3e3+7;
const int mod=1e9+7;
int maxn,minn;
int T,n,m;
string s;
int dp[N][N];
int sum[N];

int main(){
	int ans=0;
	cin>>n>>s;
	dp[1][1]=1;
	for(int i=2;i<=n;i++){
		if(s[i-2]=='<'){
			for(int j=1;j<=i;j++){
				dp[i][j]=(dp[i-1][j-1]+dp[i][j-1])%mod;
			}
		}
		else{
			dp[i][i]=0;
			for(int j=i-1;j>=1;j--){
				dp[i][j]=(dp[i-1][j]+dp[i][j+1])%mod;
			}
		}
	}
//	for(int i=1;i<=n;i++){
//		for(int j=1;j<=n;j++){
//			cout<<dp[i][j]<<" ";
//		}
//		cout<<endl;
//	}
	for(int i=1;i<=n;i++){
		ans=(ans+dp[n][i])%mod;
	}
	cout<<ans<<endl;

	return 0;
}





Measured memory_bytes: 34304
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  int cnt[N+1]; CLR(cnt);
  int ans = 0;
  FOR(i,0,N) {
    int in; cin >> in;
    if(in > N) ans++;
    else cnt[in]++;
  }
  FOR(i,1,N+1) {
    if(cnt[i] > i) ans += cnt[i] - i;
    else if(cnt[i] < i) ans += cnt[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int people = sc.nextInt();
        int need_longer = sc.nextInt();
        int sum = 0;
        int longer[] = new int[people];
        for (int i = 0; i < people; i++) {
            longer[i] = sc.nextInt();
            if(longer[i]>=need_longer){
                sum++;
            }
        }
        System.out.println(sum);
    }

}

Measured memory_bytes: 48728
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < 3; ++i) {
        if(s[i] == s[i+1]){
            puts("Bad");
            return 0;
        }
    }
    puts("Good");
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include<string>
#include<algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
string s;
int a[20];
int main()
{
	cin >> s;
	int iwa = 1000;
	int t = s.size();
	rep(i, t) { a[i] = stoi(s.substr(i, 3)); }
	rep(i, t) {
		if (abs(753 - a[i]) < iwa) { iwa = abs(753 - a[i]); }
	}
	cout << iwa << endl;
}


Measured memory_bytes: 256
import math
N,X =list(map(int,input().split()))
x =list(map(int,input().split()))
lis_x = []
for i in range(N):
    lis_x.append(abs(x[i]-X))
ans = lis_x[0]
for i in range(1,N):
    ans = math.gcd(ans,lis_x[i])
print(ans)


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  string s, t;
  cin >> n >> s >> t;
  
  for(int i = 0; i < n; i++) cout << s.at(i) << t.at(i);
  
  cout << "\n";
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

int n,k;
int x[125252];

int main(){
  scanf("%d%d",&n,&k);
  REP(i,n)scanf("%d",x+i);
  int ans = 1e9;
  REP(i,n-k+1){
    int a = x[i];
    int b = x[i+k-1];
    if(b<=0){
      CHMIN(ans, 0-a);
    }else if(a>=0){
      CHMIN(ans, b-0);
    }else{
      CHMIN(ans, (b-a)+(0-a));
      CHMIN(ans, (b-a)+(b-0));
    }
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 768
<?php

fscanf(STDIN, "%d %d", $X, $Y);

$max = 1000000000;
$limit = $max * $max;


for($i = 1; ; $i++) {
    $s = $X * $i;

    if($s % $Y != 0) {
        echo $s;
        break;
    }
    else {
        if($s <= $limit) {
            echo -1;
            break;
        }
    }
}


?>

Measured memory_bytes: 4604
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    a = list(input())
    K = int(input())
    for i in range(len(a)):
        if a[i]=='a':
            val=0
        else:
            val = 123 - ord(a[i])

        if val <= K:
            a[i] = 'a'
            K -= val
        if i == len(a) - 1 and K > 0:
            a[-1] = chr(ord(a[-1]) + K % 26)
    print(''.join(a))


resolve()

Measured memory_bytes: 49520
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <iomanip>
#include<set>
#include <numeric>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define DIVCEIL(a,b) ((a+b-1)/b)
//int CHMAX

int FACT(int a) {
	if (a == 0)
		return 1;
	else
		return a * FACT(a - 1);
}
int MODFACT(int a, int mod) {
	if (a == 0)
		return 1;
	else
		return (a * FACT(a - 1))%mod;
}
int nPr(int n, int r) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++)
		sum *= i;
	return sum;
}
int MODnPr(int n, int r, int mod) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++) {
		sum *= i;
		sum = sum % MOD;
	}
	return sum;
}
//int nCr(int n, int r)
int nCr2(int n, int r) {
	return FACT(n) / (FACT(r) * FACT(n - r));
}
int GCD(int a, int b)
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b)
{
	return  a * b / GCD(a, b);
}
int NUMOFDIV(int n) {
	//約数の数（だっけ？）
	int ans = 0;
	REP(i, n) {
		if (n % i == 0)
			ans++;
	}
	return ans;
}
int CEIL1(int n) {
	//1桁目切り上げ
	return (n + 9) / 10 * 10;
}
int DIGIT(int n,int k) {
	//nのk桁目
	rep(i, k-1)
		n /= 10;
	return n % 10;
}
int DIGITSUM(int n) {
	int sum = 0, dig;
	while (n) {
		dig = n % 10;
		sum += dig;
		n /= 10;
	}
	return sum;
}
int DIVTIME(int n, int k) {
	//nをkで何回割れるか的な
	int div = 0;
	while (n % k == 0) {
		div++;
		n /= k;
	}
	return div;
}
int MODPOW(int a, int n, int mod) {
	// a^n mod
	int ans = 1;
	while (n > 0) {
		if (n & 1)
			ans = ans * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return ans;
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
inline bool between(int x, int min, int max) {
	if (min < x && x < max)
		return true;
	else
		return false;
}
inline bool PRIMEOR(int x) {
	if (x == 1)
		return false;
	if (x == 2)
		return true;
	if (x % 2 == 0)
		return false;
	double sqrtx = sqrt(x);
	for (int i = 3; i <= sqrtx; i += 2) {
		if (x % i == 0)
			return false;
	}
	return true;
}
bool SQRTOR(int n) {
	if (sqrt(n) == (int)sqrt(n))
		return true;
	else
		return false;
}
// 順位付け
using namespace std;
#pragma endregion
signed main() {
	int N,a=0;
	cin >> N;
	vector<int>d(N);
	rep(i, N)
		cin >> d[i];
	sort(ALL(d));
	cout << max(a, d[N / 2] - d[(N / 2) - 1])<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#ifdef DEBUG
#include "_debug.cpp"
#include "callable.hpp/callable.hpp"
#endif
#define endl '\n'
using namespace std;
using ll = long long;
// NOTE: one-indexed
template <typename T = long long>
class bit {
private:
    vector<T> t;
public:
    bit(int n) {
        t.resize(n+1);
    }
    int size() {
        return t.size() - 1;
    }
    void add(int i, T value) {
        for(int j = i; j < t.size(); j += j & -j) {
            t[j] += value;
        }
    }
    T sum(int i) {
        T res = 0;
        for(int j = i; j > 0; j -= j & -j) {
            res += t[j];
        }
        return res;
    }
    T sum(int L, int R) {
        return sum(R) - sum(L - 1);
    }
};
// NOTE: one-indexed
template <typename T = long long>
class range_bit {
private:
    bit<T> t;
public:
    range_bit(int n) : t(n) {}
    int size() {
        return t.size();
    }
    void add(int L, int R, T value) {
        t.add(L, value);
        t.add(R + 1, -value);
    }
    T get(int i) {
        return t.sum(i);
    }
    T operator[](int i) {
        return get(i);
    }
};
#define N 200'000
ll a[N+1];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, q;
    ll S, T;
    cin >> n >> q >> S >> T;
    range_bit<> t(n+1);
    ll tot_down = 0;
    ll tot_up = 0;
    for(int i = 0; i <= n; i++) {
        cin >> a[i];
        t.add(i+1, i+1, a[i]);
        if(i > 0) {
            (a[i] > a[i-1] ? tot_up : tot_down) += abs(a[i] - a[i-1]);
        }
    }
    while(q--) {
        int L, R, x;
        cin >> L >> R >> x;
        if(R == n) {
            ll preL = t[L+1] - t[L];
            t.add(L+1, R+1, x);
            ll postL = t[L+1] - t[L];
            (preL > 0 ? tot_up : tot_down) -= abs(preL);
            (postL > 0 ? tot_up : tot_down) += abs(postL);
        } else {
            ll preL = t[L+1] - t[L], preR = t[R+2] - t[R+1];
            t.add(L+1, R+1, x);
            ll postL = t[L+1] - t[L], postR = t[R+2] - t[R+1];
            (preL > 0 ? tot_up : tot_down) -= abs(preL);
            (postL > 0 ? tot_up : tot_down) += abs(postL);
            (preR > 0 ? tot_up : tot_down) -= abs(preR);
            (postR > 0 ? tot_up : tot_down) += abs(postR);
        }
        cout << tot_down * T - tot_up * S << endl << flush;
    }
    return 0;
}




Measured memory_bytes: 6012
N, M = map(int,input().split())
A = []
B = []
for _ in range(M):
    a, b = map(int,input().split())
    a -= 1
    b -= 1
    A.append(a)
    B.append(b)

G = [[] for _ in range(N)]
for a, b in zip(A, B):
    G[a].append(b)
    G[b].append(a)

def dfs(F):
    E = []
    while F:
        v = F.pop()
        if v not in E:
            E.append(v)
        if len(E) == N:
            return True
        for e in G[v]:
            if e in E:
                continue
            F.append(e)

    return False

ans = 0
for a, b in zip(A, B):
    G[a].remove(b)
    G[b].remove(a)
    if not dfs([0]):
        ans += 1
    G[a].append(b)
    G[b].append(a)

print(ans)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int h, w, a, b;
int c[1005][1005];
char ans[1005][1005];

int main(void)
{
	cin >> h >> w >> a >> b;
	
	int cnt = 0;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(j < w/2*2) c[i][j] = 1;
			else if(i < h/2*2) c[i][j] = 2, cnt++;
		}
	}
	int rem = b - cnt/2;
	if(h % 2 && w % 2){
		c[h-1][w-1] = 1, c[h-1][0] = 0;
		if(rem > 0 && h >= 2){
			c[h-2][0] = c[h-2][1] = 0;
			c[h-2][0] = c[h-1][0] = 2;
			rem--;
		}
	}
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(rem <= 0) break;
			if(c[i][j] == 1 && i+1 < h){
				if(h % 2 && w % 2 && i == 0 && j/2 == 0) continue;
				c[i][j] = c[i+1][j] = c[i][j+1] = c[i+1][j+1] = 2;
				rem -= 2;
			}
		}
	}
	if(rem > 0 && h%2 && w%2 && w >= 2 && h >= 2){
		c[h-1][1] = c[h-1][2] = 0;
		c[h-2][1] = c[h-1][1] = 2;
		rem--;
	}
	
	/*for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			cout << c[i][j];
		}
		cout << endl;
	}*/
	
	if(rem > 0){
		cout << "NO" << endl;
		return 0;
	}
	
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			ans[i][j] = '.';
		}
	}
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(c[i][j] == 1){
				if(a > 0) ans[i][j] = '<', ans[i][j+1] = '>', a--;
				c[i][j] = c[i][j+1] = 0;
			}
			else if(c[i][j] == 2){
				if(b > 0) ans[i][j] = '^', ans[i+1][j] = 'v', b--;
				c[i][j] = c[i+1][j] = 0;
			}
		}
	}
	if(h%2 && w%2 && a > 0){
		if(h >= 2 && w >= 2 && ans[h-2][0] == '.'){
			a--, ans[h-2][0] = '<', ans[h-2][1] = '>';
		}
	}
	if(a > 0 || b > 0){
		cout << "NO" << endl;
		return 0;
	}
	
	cout << "YES" << endl;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			cout << ans[i][j];
		}
		cout << endl;
	}
	
	return 0;
}

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

int main(void) {
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int l, r;
    cin >> l >> r;
    ans += (r - l + 1);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1e3 + 10;

void solve() {
   int h, w;
   string s;
   while(cin >> h) {
        cin >> w;
        map<char, int> ma;
        for(int i = 0; i < h; i++) {
            cin >> s;
            for (char t : s) ma[t]++;
        }
        int a4, a2, a1, a;
        a = a1 = a2 = a4 = 0;
        for (auto c : ma) {
            int x = c.second;
            a4 += x / 4;
            x -= x / 4 * 4;
            a2 += x / 2;
            x -= x/ 2 * 2;
            if(x > 0) a1++;
        }
        //cout << a1 << " " << a2 << " " << a4 << endl;
        bool f = 1;
        if(h % 2 == 0 && w % 2 == 0) {
            if(a2 > 0 || a1 > 0) f = 0;
        } else if(h % 2 == 1 && w % 2 == 1) {
            if(a1 > 1 || a2 > (h / 2 + w / 2)) f = 0;
        } else {
            int t = 0;
            if(h % 2 == 1) {
                t = w / 2;
            } else {
                t = h / 2;
            }
            if(a1 > 0 || a2 > t) f = 0;
        }
        puts(f ? "Yes" : "No");
   }
}

int main() {
   // freopen("test.in", "r", stdin);
    //freopen("test.out", "w", stdout);
    solve();
    return 0;
}


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

//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize ("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

template<typename T> // order_of_key(), *find_by_order()
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(nullptr));

ll const mod = 1e9 + 7;

namespace {
    ll mul(ll a, ll b) {
        ll val = a * b - (ll) ((ld) a * b / mod) * mod;
        if (val < 0)
            val += mod;
        if (val >= mod)
            val -= mod;
        return val;
    }

    ll poww(ll a, ll b) {
        ll val = 1;
        a %= mod;
        while (b > 0) {
            if (b % 2)
                val = mul(a, val);
            a = mul(a, a);
            b >>= 1;
        }
        return val % mod;
    }

    ll inv(ll a) {
        return poww(a, mod - 2);
    }
}

ll const maxn = 55;

vector<int> g[maxn];

map<pair<int, int>, int> mapa;

bitset<51> kek[maxn];
int p[maxn];
bool used[maxn];

void dfs(ll u) {
    used[u] = 1;
    for (ll v : g[u]) {
        if (used[v])
            continue;
        p[v] = u;
        dfs(v);
    }
}

int const maxk = 1 << 21;
int rofl[maxk];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    int id = 0;
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
        if (a > b)
            swap(a, b);
        mapa[{a, b}] = id++;
    }
    int m;
    cin >> m;

    for (int j = 0; j < m; j++) {
        memset(p, 0, sizeof(p));
        memset(used, 0, sizeof(used));
        int a, b;
        cin >> a >> b;
        dfs(a);
        vector<int> path;
        while (b != a) {
            path.push_back(b);
            b = p[b];
        }
        path.push_back(a);
        for (int i = 0; i < path.size() - 1; i++) {
            int x = path[i], y = path[i + 1];
            if (x > y)
                swap(x, y);
            kek[j][mapa[{x, y}]] = 1;
        }
    }
    for (int mask = 0; mask < (1 << m); mask++) {
        bitset<51> roflan;
        for (int j = 0; j < m; j++) {
            if ((1 << j) & mask) {
                roflan |= kek[j];
            }
        }
        rofl[mask] = roflan.count();
    }
    ll ans = 0;

    for (int mask = 0; mask < (1 << m); mask++) {
        int cnt = rofl[mask];
        int sz = __builtin_popcount(mask);
        if (sz % 2) {
            ans -= (1LL << (n - 1 - cnt));
        } else {
            ans += (1LL << (n - 1 - cnt));
        }
    }

    cout << ans << endl;

    return 0;
}

/*
4
1 5 10 50
3
2
8
50


*/

Measured memory_bytes: 6400
import java.util.*;

public class Main {

    static long s(long k) {
        char[] kk = String.valueOf(k).toCharArray();
        long ret = 0;
        for (int i = 0; i < kk.length; i++) {
            ret += kk[i] - '0';
        }
        return ret;
    }

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        ArrayList<Long> l = new ArrayList<>();
        for (int i = 1; i < 10; i++)
            l.add((long) i);
        long add = 1;
        int num = 0;
        while (true) {

            for (int i = 0; i < 1001; i++) {
                long ttk = add * i - 1;
                if (ttk < 1)
                    continue;
                l.add(ttk);
            }
            Collections.sort(l);
            for (int i = 0; i < l.size(); i++) {
                for (int j = i + 1; j < l.size(); j++) {
                    if (l.get(i).longValue() == l.get(j).longValue()) {
                        l.remove(j);
                        j--;
                        continue;
                    }
                }
            }

            IN: for (int i = 0; i < l.size(); i++) {
                double hoge = (double) l.get(i) / s(l.get(i));
                for (int j = i + 1; j < l.size(); j++) {
                    double kkk = (double) l.get(j) / s(l.get(j));
                    if (kkk < hoge) {
                        l.remove(i);
                        i--;
                        continue IN;
                    }
                }
            }

            if (num == 2)
                break;
            if (l.size() >= k) {
                num++;
            }

            add *= 10L;

        }

        for (int i = 0; i < k; i++) {
            System.out.println(l.get(i));
        }

    }

}


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

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        a1: i64,
        a2: i64,
        a3: i64,
    }

    let ans = if a1 + a2 + a3 >= 22 { "bust" } else { "win" };

    println!("{}", ans);
}


Measured memory_bytes: 4352
using System;

namespace ARC071_D______
{
    class Program
    {
        static void Main(string[] args)
        {
            var nm = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var n = nm[0]; var m = nm[1];
            var x = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            var y = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            long MOD = 1000000007;

            long Xsum = 0;
            for (int i = 0; i < n; i++)
            {
                Xsum += x[i] * i;
                Xsum -= x[i] * (n - i - 1);
                Xsum %= MOD;
            }

            long Ysum = 0;
            for (int i = 0; i < m; i++)
            {
                Ysum += y[i] * i;
                Ysum -= y[i] * (m - i - 1);
                Ysum %= MOD;
            }
            Console.WriteLine(Xsum * Ysum % MOD);
        }
    }
}


Measured memory_bytes: 35876
#include<bits/stdc++.h>
using namespace std;
long long x[10001];
int main()
{
	int a,i=0;
	long long b,c;
	cin>>a>>b>>c;
	for(int z=1;z<=a;z++)
	{cin>>x[z];
	if(x[z]<b||x[z]>=c)
	i++;
	}
		cout<<i<<endl;
	return 0;
}

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

int main(){
	int N; cin>>N;
	set<string> s{"a"};
	while(--N){
		set<string>t; swap(s,t);
		for(auto pre:t){
			set<char> types{'a'}; for(auto c:pre) types.insert(c+1);
			for(auto c:types) s.insert(pre + string(1, c));
		}
	}
	for(auto x:s) cout<< x <<endl;
}

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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

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

int main() {
  ll n, a, b, c;
  cin >> n >> a >> b >> c;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  vector<ll> abc = {a, b, c};

  bool ok = true;
  vector<char> res(n);
  if (a + b + c == 0) {
    ok = false;
  } else if (a + b + c == 1) {
    rep(i, n) {
      int s1 = s[i][0] - 'A';
      int s2 = s[i][1] - 'A';
      if (abc[s1] == 0 && abc[s2] == 0) {
        ok = false;
        break;
      }
      if (abc[s1] > 0) {
        abc[s2]++;
        res[i] = 'A' + s2;
        abc[s1]--;
      } else {
        abc[s1]++;
        res[i] = 'A' + s1;
        abc[s2]--;
      }
    }
  } else {
    rep(i, n) {
      int s1 = s[i][0] - 'A';
      int s2 = s[i][1] - 'A';
      if (abc[s1] == 0 && abc[s2] == 0) {
        ok = false;
        break;
      } else if (abc[s1] == 0) {
        abc[s1]++;
        res[i] = 'A' + s1;
        abc[s2]--;
      } else if (abc[s2] == 0) {
        abc[s2]++;
        res[i] = 'A' + s2;
        abc[s1]--;
      } else if (a + b + c == 2 && abc[s1] == 1 && abc[s2] == 1
                 && i != n - 1 && s[i + 1] != s[i]) {
        int ns1 = s[i + 1][0] - 'A';
        int ns2 = s[i + 1][1] - 'A';
        if (s1 == ns1 || s1 == ns2) {
          abc[s1]++;
          res[i] = 'A' + s1;
          abc[s2]--;
        } else {
          abc[s2]++;
          res[i] = 'A' + s2;
          abc[s1]--;
        }
        continue;
      } else {
        // 適当に増減
        if (abc[s1] > abc[s2]) {
          abc[s2]++;
          res[i] = 'A' + s2;
          abc[s1]--;
        } else {
          abc[s1]++;
          res[i] = 'A' + s1;
          abc[s2]--;
        }
      }
    }
  }
  if (ok) {
    cout << "Yes" << endl;
    rep(i, n) {
      cout << res[i] << endl;
    }
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 6420
# ===================================
# (c) MidAndFeed aka ASilentVoice
# ===================================
# import math 
# import collections
# import string
# ===================================
n = int(input())
q = [int(x) for x in input().split()]
ans = [None for _ in range(n)]
ans[0] = 0

# # Top down
# def dp(current):
# 	if ans[current] != None: return ans[current]

# 	if current < 0: return 0
# 	else:
# 		t1 = t2 = int(1e9)
# 		if current-1 >= 0: t1 = abs(q[current] - q[current-1]) + dp(current-1)
# 		if current-2 >= 0: t2 = abs(q[current] - q[current-2]) + dp(current-2)

# 		ans[current] = min(t1, t2)
# 		return ans[current]

# dp(n-1)

for i in range(1, n):
	t1 = t2 = int(1e9)
	if i-1 >= 0: t1 = ans[i-1] + abs(q[i-1] - q[i])
	if i-2 >= 0: t2 = ans[i-2] + abs(q[i-2] - q[i])
	ans[i] = min(t1, t2)
# print(ans)
print(ans[n-1])


Measured memory_bytes: 13976
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>

using namespace std;
typedef long long ll;

int main(){
  ll H;
  cin >> H;
  ll ans=0;
  ll nmon=1;
  while(H>0){
    ans+=nmon;
    H/=2;nmon*=2;
  }

  cout << ans << endl;


  return 0;
}

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

const int maxn = 200010;
int T, n;
vector<int> G[maxn], H[maxn];

int main() {
    scanf("%d", &T);
    while (T--) {
        scanf("%d", &n);
        for (int i = 1; i <= n; i++) {
            G[i].clear(), H[i].clear();
        }
        long long ans = 0;
        for (int i = 1, K, L, R; i <= n; i++) {
            scanf("%d %d %d", &K, &L, &R);
            if (L > R) ans += R, G[K].push_back(L - R);
            else ans += L, H[K].push_back(R - L);
        }
        multiset<int> S;
        for (int i = 1; i <= n; i++) {
            for (int j : G[i]) {
                S.insert(j), ans += j;
            }
            while (S.size() > i) {
                auto it = S.begin();
                ans -= *it, S.erase(it);
            }
        }
        S.clear();
        for (int i = n; i; i--) {
            for (int j : H[i]) {
                S.insert(j), ans += j;
            }
            while (S.size() > n - i) {
                auto it = S.begin();
                ans -= *it, S.erase(it);
            }
        }
        printf("%lld\n", ans);
    }
    return 0;
}

Measured memory_bytes: 22400
#include<bits/stdc++.h>
#define ll long long
#define N 100005
#define M 10000007
#define O 1000000009
#define vl vector<long>
#define vll vector<long long>
#define disp(n) cout<<n<<endl
#define fo(i,N) for(int i=0; i<N; ++i)
#define fos(i,b,N) for(int i=b; i<N; ++i)
#define forr(i,N) for(i=N; i>=0; --i)

using namespace std;
 
int main()
{
    long n, i;
    cin >> n;
    vector<int> a(n);
    for(i = 0; i < n; ++i)
        cin >> a[i];
    
    vl dp(n + 1, 0);
    if(n == 2){
        cout << abs(a[0] - a[1]);
        exit(0);
    }

    dp[2] = abs(a[1] - a[0]);
    dp[3] = abs(a[2] - a[0]);

    for(i = 2; i <= n - 2; ++i) {
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(a[i] - a[i - 1]));
        dp[i + 2] = dp[i] + abs(a[i + 1] - a[i - 1]);
    }

    dp[n] = min(dp[n], dp[n - 1] + abs(a[n - 1] - a[n - 2]));
    cout << dp[n] ;
    return 0;
}

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

int main() {
  long long N,K;
  cin >> N>>K;
  vector<long long>k(100,K);
  long long Kk=1;
  int C=0;
  for(int i=0;i<100;i++){
    Kk*=k[i];
    if(N>=Kk&&N<Kk*K){
      C+=i;
      C+=2;
      break;
    }
  }
  if(N<=K){
    cout<<1<<endl;
  }
  else{
    cout<<C<<endl;
  }
}

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

using namespace std;
//using namespace __gnu_pbds;

#define ss second
#define ff first
#define int long long
//#define double long double
#define pb push_back


const int N = 2e6 + 51 + 51, MOD = 1e9 + 7, mod = 998244353, INF = 3e18;

mt19937 Flash_new_51(51515);

using vi = vector <int>;
using vp = vector <pair <int, int>>;

//gp_hash_table<int, int> table;

int a[30][30], dp[2][2097155], sum[2097155];

signed main() {
    #ifdef Flash
     freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, msk, tek = 1, tekk = 0;
    cin >> n;
    msk = (1 << n);
    for (int i = 0; i < n; ++i) for (int j = 0; j < n; j++) cin >> a[i][j];
    for (int j = 0; j < n; ++j) {
        if (a[0][j]) {
            int mask = (1 << j);
            dp[0][mask] = 1;
        }
    }
    for (int i = 0; i < msk; i++) {
        int kol = 0;
        for (int j = 0; j < n; j++) {
            if ((i >> j) & 1) ++kol;
        }
        sum[i] = kol;
    }
    for (int i = 1; i < n; i++) {
        for (int mask = 0; mask < msk; mask++) {
           // cout << sum[mask] << endl;
            if (sum[mask] != i) continue;
            for (int j = n - 1; j >= 0; j--) {
                int bit = (mask >> j) & 1;
                if (!bit && a[i][j]) {
                    int nw = mask | (1 << j);
                    dp[tek][nw]+= dp[tekk][mask];
                    dp[tek][nw]%= MOD;
                }
            }
            dp[tekk][mask] = 0;
        }
      //  return 0;
        tek^= 1, tekk^= 1;
    }
    cout << dp[tekk][msk - 1];
}


Measured memory_bytes: 49408
def main():
    H, W = map(int, input().split())

    maze = []
    for _ in range(H):
        maze.append(input())

    dp = [[0] * W for _ in range(H)]
    dp[0][0] = 1

    for i in range(H):
        for j in range(W):
            if maze[i][j] == '#':
                continue
            if i > 0:
                dp[i][j] += dp[i - 1][j]
            if j > 0:
                dp[i][j] += dp[i][j - 1]

    print(dp[H - 1][W - 1] % 1000000007)


main()


Measured memory_bytes: 157428
#include <stdio.h>
#define MIN(x,y) x<y?x:y

int sum(int a,int b,int c,int d){
    int sum = MIN(a,b);
    sum += MIN(c,d);
    return sum;
}
int main(void){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    printf("%d\n",sum(a,b,c,d));
    return 0;

}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)


int main() {
	int n;
	string s;
	cin >> n >> s;
	if (n & 1) {
		cout << "No" << endl;
		return 0;
	}
	for (int i = 0; i < n / 2; i++) {
		if (s[i] != s[i + n / 2]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, m;
	cin >>n >>m;
	vector<VL> x(n, VL(3));
	rep(i, n) cin >>x[i][0] >>x[i][1] >>x[i][2];
	
	ll ans = -1LL<<60;
	rep(i, 1<<3){
		VL smz(n);
		rep(k, n){
			ll sm = 0;
			rep(j, 3) sm += (i>>j &1)? x[k][j]: -x[k][j];
			smz[k] = sm;
		}
		sort(smz.rbegin(), smz.rend());
		ll w = accumulate(smz.begin(), smz.begin()+m, 0LL);
		ans = max(ans, w);
	}
	
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>

using namespace std;
const int maxn=1e5+5;
typedef long long ll;
int main(){
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if((a[0]==a[1]&&a[2]!=a[0])||(a[1]==a[2]&&a[0]!=a[1])){
        puts("Yes");
    }
    else{
        puts("No");
    }
    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
 
struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
static const int MOD = 1000000007;
static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define MAX(a,b,c) max((a),max((b),(c)))
#define MIN(a,b,c) min((a),min((b),(c)))
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
//#define int ll

char pic[54][54];
char temp[54][54];
int m,n;

bool hantei(int a,int b){
    FOR(i,a,a+m){
        FOR(j,b,b+m){
            if(pic[i][j]!=temp[i-a][j-b]) return false;
        }
    }
    return true;
}

signed main(){
    scanf("%d%d",&n,&m);
    REP(i,n){
        scanf("%s",&pic[i]);
    }
    REP(i,m){
        scanf("%s",&temp[i]);
    }
    REP(i,n-m+1){
        REP(j,n-m+1){
            if(hantei(i,j)){
                puts("Yes");
                return 0;
            }
        }
    }
    puts("No");
    return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e5+3;
//string s,p;
//vector<int>v;
//map<int,int>mp;
set<int>s;
int main()
{
    ft
    ll t,i,j,n,m,l,r;
    for(i=0;i<3;i++)
    {
        cin>>m;
        s.insert(m);
    }
    cout<<(int)s.size()<<"\n";
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 200000000000000
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

//////////////

#define S second
#define F first
#define int long long  

//////////

signed main()
{
    fastio;
    int n,a,b;
    cin>>n>>a>>b;
    int ma=0,mi=n;
    for(int i=n;i>=0;--i)
    {
        if(i<=a&&i<=b&&a+b-i<=n)
        {
            ma=max(ma,i);
            mi=min(mi,i);
        }
    }
    cout<<ma<<" "<<mi;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Integer[] hills = new Integer[10];
		for(int i=0;i<10;i++)
			hills[i]=in.nextInt();
		Arrays.sort(hills, Collections.reverseOrder());
		for(int i=0;i<3;i++)
			System.out.println(hills[i]);
	}
}

Measured memory_bytes: 17364