akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using llint = long long;
using vint = vector<int>;
using vvint = vector<vector <int>>;

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

Measured memory_bytes: 256
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll n, m;
  cin >> n >> m;
  vll a(n);
  for(ll i = 0; i < n; i++) {cin >> a[i]; a[i]/=2;}
  ll lcm = a[0];
  for(ll i = 1; i < n; i++) {
  	ll gp = __gcd(lcm, a[i]);
  	lcm = ((lcm*a[i]))/gp;
  }
  ll x = m/lcm;
  for(ll i = 0; i < n; i++) {
  	if((lcm/a[i])%2 == 0) {
  		cout << 0;
  		return 0;
  	}
  }
  cout << (x + 1)/2 << endl;
  return 0;
} //good night.

Measured memory_bytes: 1024
n,m = map(int,input().split())
if n-m == 1 or m-n == 1:
    ans = 1
elif n == m:
    ans = 2
else:
    ans = 0
for i in range(n):
    ans = ans * (i+1) %(10**9+7)
for i in range(m):
    ans = ans * (i+1) % (10**9+7)
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
	int n;
	string s;
	cin >> n >> s;
	vector<int> l_sum(n, 0), r_sum(n, 0);

	int w = 0, e = 0;
	for (int i = 0; i < n; ++i) {
		l_sum[i] = w;
		if (s[i] == 'W') ++w;
	}
	for (int i = n - 1; i >= 0; --i) {
		r_sum[i] = e;
		if (s[i] == 'E') ++e;
	}

	int min_sum = 1e9;
	for (int i = 0; i < n; ++i) {
		min_sum = min(min_sum, l_sum[i] + r_sum[i]);
	}
	cout << min_sum << endl;
	return 0;
}

Measured memory_bytes: 3076
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        List<Integer> bingo = new ArrayList<>();
        for (int i = 0; i < 9; i++) {
            bingo.add(sc.nextInt());
        }
        int n = sc.nextInt();
        boolean[] ans = new boolean[9];
        for (int i = 0; i < n; i++) {
            int num = sc.nextInt();
            int index = bingo.indexOf(num);
            if (index < 0) {
                continue;
            }
            ans[index] = true;
            if (isBingo(ans)) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }

    private static boolean isBingo(boolean[] ans) {
        return ans[0] && ans[1] && ans[2] ||
                ans[3] && ans[4] && ans[5] ||
                ans[6] && ans[7] && ans[8] ||
                ans[0] && ans[3] && ans[6] ||
                ans[1] && ans[4] && ans[7] ||
                ans[2] && ans[5] && ans[8] ||
                ans[0] && ans[4] && ans[8] ||
                ans[2] && ans[4] && ans[6];

    }

}


Measured memory_bytes: 21844
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1.0);

const int mod = (int) 1e9 + 7;

void add(int &x, int y) {
  if ((x += y) >= mod) {
    x -= mod;
  }
}

int mult(int x, int y) {
  return (long long) x * y % mod;
}

int myPower(int x, int pw) {
  int res = 1;
  for (; pw; pw >>= 1) {
    if (pw & 1) {
      res = mult(res, x);
    }
    x = mult(x, x);
  }
  return res;
}

void precalc() {
}


const int maxn = (int) 1e5 + 10;
int a[maxn];
int n, k;

int read() {
  if (scanf("%d%d", &n, &k) < 2) {
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  return 1;
}

void solve() {
  long long res = -1e18;
  for (int iter = 0; iter < 2; ++iter) {
    long long bal = 0;
    for (int i = 0; i < n; ++i) {
      bal += min(a[i], 0);
      if (i >= k - 1) {
        res = max(res, bal);
        bal -= min(a[i - k + 1], 0);
      }
    }

    for (int i = 0; i < n; ++i) {
      a[i] = -a[i];
    }
  }
  for (int i = 0; i < n; ++i) {
    if (a[i] > 0) {
      res += a[i];
    }
  }
  printf("%lld\n", res);
}

int main() {
  precalc();
#ifdef LOCAL
  freopen(TASK ".out", "w", stdout);
  assert(freopen(TASK ".in", "r", stdin));
#endif

  while (1) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 1000000007;
const ll MOD = 1000000007;

using namespace std;

struct edge {
  int to, cost;
};
typedef std::vector<std::vector<edge>> graph;

bool dfs(int v, int pos, graph &g, vi &data) {
  if (data[v] != INF) {
    if (data[v] != pos) {
      return false;
    } else {
      return true;
    }
  }
  data[v] = pos;
  for (const auto e : g[v]) {
    if (!dfs(e.to, data[v] + e.cost, g, data)) {
      return false;
    }
  }
  return true;
}

int main() {
  int n, m;
  cin >> n >> m;
  graph g(n);
  REP(i, m) {
    int l, r, d;
    cin >> l >> r >> d;
    l--;
    r--;
    g[l].push_back({r, d});
    g[r].push_back({l, -d});
  }

  vi data(n, INF);
  REP(i, n) {
    if (data[i] == INF) {
      if (!dfs(i, 0, g, data)) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;

  return 0;
}


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

int main()
{
    ll n;
    string str;
    cin>>str;
    n = str.length();

    ll a[n] = {0};

    ll ptr = -1;
    for(ll i=0;i<n;i++)
    {
        if(str[i] == 'R')   ptr = i;
        else                a[i] = ptr;
    }
    for(ll i=n-1;i>=0;i--)
    {
        if(str[i] == 'L')   ptr = i;
        else                a[i] = ptr-1;
    }

    ll ans[n] = {0};
    ll cnt[n] = {0};

    for(ll i=0;i<n;i++)
    {
        ll tmp = abs(a[i]-i);
        if(tmp%2)
        {
            ans[i] = a[i]+1;
        }
        else    ans[i] = a[i];
        cnt[ans[i]]++;
    }

    for(ll i=0;i<n;i++) cout<<cnt[i]<<" ";

    return 0;
}


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

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  rep(i, N){
    cin >> A[i];
  }
  map<int, int> B;
  rep(i, N){
    B[A[i]] += 1;
  }
  
  int count = 0;
  vector<int> C;
  for (auto p : B) count+= 1, C.push_back(p.second);
  sort(C.begin(), C.end());
  count = count - K;
  int ans=0;
  rep(i, count){
    ans += C[i];
  }
  
  cout << ans << endl;
  
}


Measured memory_bytes: 11516
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.rmi.server.UnicastRemoteObject;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n = sc.nextInt();
        int d[]=sc.nextIntArray(n);
        int ans=0;
        for (int i = 1; i < d.length-1; i++) {
			if(d[i]<d[i-1] && d[i]>d[i+1])ans++;
			if(d[i]>d[i-1] && d[i]<d[i+1])ans++;
		}

        out.println(ans);
        out.flush();
    }

    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

class P {
	int x, y;
	P(int  x, int y) {
	  this.x=x;
	  this.y=y;
	}
}


//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//    int a,b;
//    P(int a, int b) {
//    	this.b=b;
//    	this.a=a;
//    }
//
//    public int compareTo(P p){
//        return b-p.b;
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) throws IOException{
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 22868
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <map>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
int n, m, k;
map<int, int> mp;
void dfs(int cnt, int total)
{
    if(cnt == n)
    {
        total = max(total - k, 1);
        mp[total]++;
        return;
    }
    for(int i = 1; i <= m; i++) dfs(cnt + 1, total + i);
}
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(8);
    while(cin >> n >> m >> k, n or m or k)
    {
        mp.clear();
        dfs(0, 0);
        double ans = 0.0;
        for(auto x : mp) ans += x.first * x.second;
        cout << ans / pow(m, n) << endl;
    }
    return 0;
}




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

using namespace std;

const int MAXN = 16;

int matrix[MAXN + 7][MAXN + 7];
long long cost[(1 << MAXN) + 7];
long long dp[(1 << MAXN) + 7];

vector<int> masks_by_size[MAXN + 7];
int N;

bool checkbit (int mask, int i) {
	return (mask >> i) & 1;
}

void precalc () {
	for (int mask = 1; mask < (1 << N); mask++) {
		// cerr << mask << " " << __builtin_popcount(mask) << "\n";
		masks_by_size[__builtin_popcount(mask)].push_back(mask);

		for (int i = 1; i <= N; i++) {
			if (checkbit(mask, i - 1) == true) {
				for (int j = i + 1; j <= N; j++) {
					if (checkbit(mask, j - 1) == true) {
						cost[mask] += matrix[i][j];
					}
				}
			}
		}
	}
}

long long dpf (int mask) {
	// cerr << mask << "\n";
	long long &d = dp[mask];

	if (d != -1) {
		return d;
	}

	if (mask == (1 << N) - 1) {
		return d = 0;
	}

	d = 0;

	for (int bit_cnt = 1; bit_cnt <= N / 2; bit_cnt++) {
		for (int mask2 : masks_by_size[bit_cnt]) {
			if ((mask & mask2) == 0) {
				// cerr << mask << " + " << mask2 << " -> " << cost[mask2] << " " << (mask | mask2) << "\n";
				d = max(d, cost[mask2] + dpf(mask | mask2));
			}
		}
	}

	d = max(d, cost[((1 << N) - 1) ^ mask]);

	return d;
}

int main () {
	memset(dp, -1, sizeof dp);

	cin >> N;
	
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			cin >> matrix[i][j];
		}
	}
	
	precalc();

	cout << dpf(0) << "\n";

	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long
#define pb(x) push_back(x)
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()
#define lcm(a,b) (a*b)/gcd(a,b)
#define bits(x) __builtin_popcountll(x)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int32_t main()
{
   fast;
   #ifndef ONLINE_JUDGE
   freopen("goodluckin.txt","r",stdin);
   freopen("goodluckout.txt","w",stdout);
   #endif
   int n,x;
   cin >> x >> n;
   int a[n];
   unordered_map<int,int>cnt;
   for(int i = 0 ; i < n ; i++ ){
      cin >> a[i];
      cnt[a[i]]=1;
   }
   int ans = 1e5;
   int abso = 1e5;
   for(int i = -110 ; i<=110 ; i++){
      if(!cnt[i]){
        if(abso>(abs(i-x))){
          abso = abs(i-x);
          ans = i;
        }
        else if(abso==abs(i-x)){
          ans = min(ans,i);
        }
      }
   }
   cout << ans;
 }

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

int main() {
    string s, t;
    cin >> s >> t;

    int count = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != t[i]) {
            count ++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3920
#define MOD_TYPE 2

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}

#pragma endregion

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  int n;
  cin >> n;
  set<pii> st;
  for (int i = 1; i <= n; i++)
  {
    for (int j = i + 1; j <= n; j++)
    {
      st.insert(MP(i, j));
    }
  }

  auto itr = st.begin();
  while (itr != st.end())
  {
    if (n % 2 == 0)
    {
      if (itr->first + itr->second == n + 1)
        itr = st.erase(itr);
      else
        itr++;
    }
    else
    {
      if (itr->first + itr->second == n)
        itr = st.erase(itr);
      else
        itr++;
    }
  }

  cout << st.size() << endl;
  for (auto p : st)
  {
    cout << p.first << " " << p.second << endl;
  }
  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include <numeric>
#include<cstring>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))

using namespace std;



int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };


ll m = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}


int a[200020];
int b[200020];
int main() {
	int N; cin >> N;
	REP(i, N) {
		cin >> a[i];
	}
	REVERSE(a, N);
	REP(i, N) {
		if (i % 2 == 0) {
			b[i/2] = a[i];
		}
		else {
			b[N-1 - (i / 2)] = a[i];
		}
	}
	REP(i, N) {
		cout << b[i] << " ";
	}
}


Measured memory_bytes: 3712
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(void){

  ll h,w;
  cin>>h>>w;

  vector<string> s(h);

  rep(i,h) cin>>s[i];

  vector< vector<ll> > row( h,vector<ll>(w,0) );
  vector< vector<ll> > col( h,vector<ll>(w,0) );

  char prev='#';

  rep(i,h){
    ll cnt=0;
    ll start=-1;
    prev='#';
    rep(j,w){
      //cout << s[i][j] << endl;
      if(s[i][j]=='#'){
        if(start==-1){
          cnt=0;
          start=-1;
          prev='#';
          continue;
        }
        if(prev=='.'){
          for(ll k=start;k<j;k++){
          //cout << i << "," << k << endl;
          row[i][k]=cnt;
          }
        }
        cnt=0;
      }
      else{
        if(prev=='#'){
          start=j;
          //cout << i << "," << start << endl;
        }
        cnt++;
      }

      
      prev=s[i][j];
    }

    if(prev=='.'){
      for(ll k=start;k<w;k++){
          row[i][k]=cnt;
        }
      cnt=0;
    }

  }
  /*
  rep(i,h){
    rep(j,w){
      cout << row[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;
  /*/



  prev='#';

  rep(i,w){
    ll cnt=0;
    ll start=0;
    prev='#';
    rep(j,h){
      if(s[j][i]=='#'){
         if(start==-1){
          cnt=0;
          start=-1;
          prev='#';
          continue;
        }
        if(prev=='.'){
          for(ll k=start;k<j;k++){
          //cout << k << "," << i << endl;
          col[k][i]=cnt;
          }
        }
        
        cnt=0;
      }
      else{
        if(prev=='#'){
          start=j;
        }
        cnt++;
      }


      prev=s[j][i];
    }

    if(prev=='.'){
      for(ll k=start;k<h;k++){
          col[k][i]=cnt;
        }
      cnt=0;
    }
  }
  /*
  rep(i,h){
    rep(j,w){
      cout << col[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;
  */  

  ll ans=0;

  rep(i,h){
    rep(j,w){
      ans=max(ans,row[i][j]+col[i][j]-1);
    }
  }

  cout << ans << endl;

  return 0;

}


Measured memory_bytes: 67072
#include <iostream>
#include <vector>
#include <algorithm>
//#include <fstream>

using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.thanksgiving", "r", stdin );
	int n, m;

	while (cin >> n >> m && n && m){
		vector <int> bp(n + 1);
		int i;

		bp[0] = 10001;
		for (i = 1; i <= n; ++i){
			cin >> bp[i];
		} // end while

		sort (bp.begin(), bp.end(), greater<int>() );

		int res = 0;

		for (i = 1; i <= n; ++i){
			if (i % m == 0){
				continue;
			} // end if
			res += bp[i];
		} // end for
		cout << res << endl;	

	} // end loop
		
	return 0;
}

Measured memory_bytes: 0
def main(n, x, m):
    remain = x - sum(m)
    count = len(m)

    count += remain // min(m)

    print(count)


if __name__ == "__main__":
    n, x = map(int, input().split(' '))
    m = [int(input()) for _ in range(n)]

    main(n, x, m)



Measured memory_bytes: 2940
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        
        short s1 = s.nextShort();
        
        short s2 = s.nextShort();
        
        short s3 = s.nextShort();

        int link = s1*s2/2;
        System.out.println(link);
    }
}

Measured memory_bytes: 23124
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<cmath>
#include<sstream>
#include<iomanip>
#include <map>
#include <stack>
 
const int64_t cc = pow( 10, 9 );
 
bool sort_pair( std::pair< char, int64_t > origin, std::pair< char, int64_t > another )
{
    return origin.first < another.first;
}


int main()
{
    int64_t a,b,c,d,e;
    std::vector< int64_t > list;
    std::cin>> a;

    d = 0;

    for( int i = 0; i < a; i++ )
    {
        std::cin>> b;
        list.push_back( b );
    }

    std::sort( list.begin(), list.end() );

    c = -1;
    
    for( int i = 0; i < a; i++ )
    {
        if( c == list[i] )
        {
            d = 1;
            break;
        }
        else
        {
            c = list[i];
        }
    }

    if( d == 1 )
    {
        std::cout<< "NO";
    }
    else
    {
        std::cout<< "YES";
    }
}



Measured memory_bytes: 2420
#include<bits/stdc++.h>
#define ms(x,y) memset(x,y,sizeof(x))
#define ll long long 
#define pb push_back
using namespace std;

char s[2005];
ll f[2005][2005];
int g[2005][2005];
ll k;


int main(){

	scanf("%s",s+1);
	int len=strlen(s+1);
	cin>>k;
	for(int i=1;i<=len;i++){
		g[i][i]=0;
		g[i][i-1]=0;
		f[i][i]=1;
		f[i][i-1]=1;
	}
	for(int l=2;l<=len;l++)
		for(int u=1;u<=len;u++){
			int v=u+l-1;
			if(v>len)continue;
			if(s[u]==s[v]){
				g[u][v]=g[u+1][v-1];
				f[u][v]=f[u+1][v-1];
			}
			else{
				if(g[u+1][v]>g[u][v-1]){
					f[u][v]=f[u][v-1];
					g[u][v]=g[u][v-1]+1;
				}
				else if(g[u+1][v]<g[u][v-1]){
					f[u][v]=f[u+1][v];
					g[u][v]=g[u+1][v]+1;
				}
				else{
					g[u][v]=g[u+1][v]+1;
					f[u][v]=min(k,f[u+1][v]+f[u][v-1]);
				}
			}
		}

	if(k>f[1][len]){
		cout<<"NONE"<<endl;
		return 0;
	}
	vector<char>ans;
	ans.clear();
	int l=1,r=len;
	while(l<r){
		if(s[l]==s[r]){
			ans.pb(s[l]);
			l++;r--;
			continue;
		}
		if(g[l+1][r] < g[l][r-1]){
			ans.pb(s[l]);
			l++;			
		}
		else if(g[l+1][r] == g[l][r-1]){
			if(s[l]<s[r]){
				if(f[l+1][r]>=k){
					ans.pb(s[l]);
					l++;
				}
				else{
					k-=f[l+1][r];
					ans.pb(s[r]);
					r--;
				}
			}
			else{
				if(f[l][r-1]>=k){
					ans.pb(s[r]);
					r--;
				}
				else{
					k-=f[l][r-1];
					ans.pb(s[l]);
					l++;
				}
			}
		}else{
			ans.pb(s[r]);
			r--;
		}
	}



	/*		
		if(g[l+1][r] == g[l][r-1]){
			ll tmp=min(f[l+1][r],f[l][r-1]);
			if((s[l]>s[r]) ^ (k<=tmp)){
				ans.pb(s[l]);
				l++; 
			}
			else{
				ans.pb(s[r]);
				r--;
			}
			if(k>tmp)k-=tmp;
		}
		else{
			if(g[l+1][r]<g[l][r-1]){
				ans.pb(s[l]);
				l++;
			}
			else{
				ans.pb(s[r]);
				r--;
			}
		}*/
	int siz=ans.size();
	for(int i=0;i<siz;i++)
		printf("%c",ans[i]);
	if(l==r)
		printf("%c",s[l]);
	for(int i=siz-1;i>=0;i--)
		printf("%c",ans[i]);
	printf("\n");
	return 0;
}

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

int main(void){
    string s,t;
    cin>>s>>t;
    int change=0;
    rep(i,s.size()) if(s[i]!=t[i]) change++;
    cout<<change<<endl;
    return 0;
}

Measured memory_bytes: 3832
import sys
from collections import Counter

H, W, M = map(int, sys.stdin.readline().rstrip().split())#行数H、列数W、爆弾数M
hcnt = [0] * H#何行目に何個あるか
wcnt = [0] * W#何列目に何個あるか
bomb = []

for i in range(M):
    bh,bw=map(int,sys.stdin.readline().rstrip().split())
    hcnt[bh - 1] += 1#行方向
    wcnt[bw - 1] += 1#列方向
    bomb.append((bh - 1,bw - 1))
#hcnt [2,1]
#wcnt[1,1,1]
#bomb[[1,1],[0,0],[0,2]]
hmax = max(hcnt)#2
wmax = max(wcnt)#1

crs = 0#hmax and wmax crosspoint
for (i, j) in bomb:
    if hcnt[i] == hmax and wcnt[j] == wmax:
        crs += 1
#all crosspoint has bomb
if crs == Counter(hcnt)[hmax] * Counter(wcnt)[wmax]:
    print(hmax + wmax - 1)
#more than one crosspoint has no bomb
else:
    print(hmax + wmax)

Measured memory_bytes: 54336
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <numeric>
#include <climits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <utility>
#include <cctype>
#include <iterator>
////////////////////////////////////////////////
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  int n;
  ll k;
  cin >> n >> k;
  vecll a(n);
  REPe(e, a) cin >> e;
  sort(all(a));
  ll r = a.back();
  ll l = 1;
  // cout << a.back() << endl;
  auto check = [&](ll x) {
    ll num = 0;
    REPe(e, a) {
      if(e != x){
	      num += e / x;
      }
    }
    if (num > k) {
      return false;
    } else {
      return true;
    }
  };

  if (check(l)) {
    cout << l << endl;
    return 0;
  }
  while (r - l > 1) {
    ll c = (r + l) / 2;
    if (check(c)) {
      r = c;
    } else {
      l = c;
    }
  }
  cout << r << endl;
}


Measured memory_bytes: 4672
#include<iostream>
#include<cstdio>
#include<stack>
#include<algorithm>
#include<cstring>
#include<queue>
#include<vector>
#include<time.h>
#include<random>
#include<string>
#include<cmath>
#include <ctime>
#include<bitset>
#include <cctype>
#define low_bit(x) ((x)&(-(x)))
#define debug cout<<"*********degug**********";
#define index index_
#define int long long
#define RE register
#define yn yn_
using namespace std;
mt19937 rnd(233);
const long long max_ = 3e5 + 7;
const double alpha = 0.75;
const int mod = 1e9 + 7;
const int inf = 1e9;
const long long INF = 1e18;
int read() {
	int s = 0, f = 1;
	char ch = getchar();
	while (ch<'0' || ch>'9') {
		if (ch == '-')
			f = -1;
		ch = getchar();
	}
	while (ch >= '0'&&ch <= '9') {
		s = s * 10 + ch - '0';
		ch = getchar();
	}
	return s * f;
}
inline int min(int a, int b) {
	return a < b ? a : b;
}
inline int max(int a, int b) {
	return a > b ? a : b;
}
int node[max_],n,k;
signed main() {
	n = read(), k = read();
	for (int i = 1; i <= n; i++) {
		node[i] = read();
	}
	sort(node + 1, node + 1 + n);
	int ans = 0;
	for (int i = 1; i <= n - k; i++) {
		ans += node[i];
	}
	
		cout<<ans;
	
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <fstream>
using namespace std;

const int INF=1<<30;
class Treap{
public:
  struct node_t{
    int val;// 値
    node_t *lch,*rch;// l,r
    int pri;// 優先度
    int cnt;// 部分木のサイズ
    int sum;// 部分木の値の和
    int minv;// 部分木の最小値
    node_t(int v,int p):val(v),pri(p),cnt(1),sum(v),minv(v){
      lch=rch=NULL;
    }
  };
  node_t* make_node(int val){
    return new node_t(val,rand());
  }
  int count(node_t *t){
    return !t?0:t->cnt;
  }
  int sum(node_t *t){
    return !t?0:t->sum;
  }
  int minimum(node_t *t){
    return !t?INF:t->minv;
  }
  node_t *update(node_t *t){
    t->cnt=count(t->lch)+count(t->rch)+1;
    t->sum=sum(t->lch)+sum(t->rch)+t->val;
    t->minv=min(t->val,min(minimum(t->lch),minimum(t->rch)));
    return t;
  }
  node_t *merge(node_t *l,node_t *r){
    if(!l||!r)return !l?r:l;
    // 優先順位が高い方を上に
    if(l->pri>r->pri){
      l->rch=merge(l->rch,r);
      return update(l);
    }
    else{
      r->lch=merge(l,r->lch);
      return update(r);
    }
  }
  // [0,k),[k,n)
  pair<node_t*,node_t*> split(node_t *t,int k){
    if(!t)return pair<node_t*,node_t*>(NULL,NULL);
    if(k<=count(t->lch)){
      pair<node_t*,node_t*> s=split(t->lch,k);
      t->lch=s.second;
      return make_pair(s.first,update(t));
    }
    else{
      pair<node_t*,node_t*> s=split(t->rch,k-count(t->lch)-1);
      t->rch=s.first;
      return make_pair(update(t),s.second);
    }
  }
  node_t *insert(node_t *root,int pos,int val){
    pair<Treap::node_t*,Treap::node_t*> p1=split(root,pos);
    pair<Treap::node_t*,Treap::node_t*> p2=split(p1.second,1);
    delete p2.first;
    root=merge(p1.first,make_node(val));
    root=merge(root,p2.second);
    return root;
  }
  // [from,to]をcircular_shift
  node_t *circular_shift(node_t *root,int from,int to){
    pair<node_t*,node_t*> p1=split(root,from);
    pair<node_t*,node_t*> p2=split(p1.second,to-from+1);
    node_t* a=p1.first;
    node_t* b=p2.first;
    node_t* c=p2.second;
    pair<node_t*,node_t*> p3=split(b,to-from);
    b=merge(p3.second,p3.first);
    return merge(merge(a,b),c);
  }
  
  // [l,r)の最小値を計算
  int range_min_value(node_t *t,int l,int r){
    if(r<=l)return INF;
    // 範囲と個数が一致
    if(r-l==count(t))
      return minimum(t);
    // 左の子に完全に含まれる
    else if(count(t->lch)>=r)
      return range_min_value(t->lch,l,r);
    // 右の子に完全に含まれる
    else if(count(t->lch)<l)
      return range_min_value(t->rch,l-(count(t->lch)+1),r-(count(t->lch)+1));
    // 左と右に場合分けする
    return min(t->val,min(range_min_value(t->lch,l,count(t->lch))
                          ,range_min_value(t->rch,0,r-(count(t->lch)+1))));
  }
};

Treap tp;
int main(){
  //ifstream cin("in.txt");
  Treap::node_t *root=NULL;
  int N,Q;
  cin>>N>>Q;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    root=tp.merge(root,tp.make_node(a));
  }
  for(int i=0;i<Q;i++){
    int x,y,z;
    cin>>x>>y>>z;
    if(x==0){
      root=tp.circular_shift(root,y,z);
    }
    else if(x==1){
      cout<<tp.range_min_value(root,y,z+1)<<endl;
    }
    else if(x==2){
      root=tp.insert(root,y,z);
    }
  }
  
  
  return 0;
}

Measured memory_bytes: 10580
def f(h, w):
    t = []
    for _ in range(h):
        t += [[0 if c == "#" else 3000 for c in input()]]
    for ti in t:
        for j in range(1, w):
            if ti[j - 1] + 1 < ti[j]:
                ti[j] = ti[j - 1] + 1
        for j in range(w - 2, -1, -1):
            if ti[j + 1] + 1 < ti[j]:
                ti[j] = ti[j + 1] + 1
    for j in range(w):
        for i in range(1, h):
            if t[i - 1][j] + 1 < t[i][j]:
                t[i][j] = t[i - 1][j] + 1
        for i in range(h - 2, -1, -1):
            if t[i + 1][j] + 1 < t[i][j]:
                t[i][j] = t[i + 1][j] + 1

    print(max(max(ti) for ti in t))


h, w = map(int, input().split())
f(h, w)


Measured memory_bytes: 42476
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

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

    int a[N], b[N], c;
    for (int i = 0; i < N; i++)
    {
        cin >> c;
        a[i] = c-1;
        b[i] = false;
    }

    int current = 0;
    int cnt = 1;
    while(true){
        //探索zみかどうか
        if(b[current] == true){
            cout << -1 << endl;
            break;
        }else{
            b[current] = true;
            current = a[current];
            if(current == 1){
                cout << cnt << endl;
                break;
            }
            cnt++;
        }
    }
    
}

Measured memory_bytes: 1024
#include <iostream>

int main() 
{
  std::string str;
  std::cin >> str;
  std::cout << (str[0] == '1' ? '9' : '1');
  std::cout << (str[1] == '1' ? '9' : '1');
  std::cout << (str[2] == '1' ? '9' : '1');
  std::cout << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;
const ll mo = 1000000007;
auto mod = [](ll modx) {modx%=mo;modx+=mo;modx%=mo;return modx; };
ll mypow(ll a, ll b)
{
  ll res = 1;
  a %= mo;
  while (b)
  {
    if (b & 1)
      res = res * a % mo;
    a = a * a % mo;
    b >>= 1;
  }
  return res;
}
int main()
{
ll n , k ;
cin >> n >> k ;
vector<ll> v(k+1,0);
for (ll i = 1; i < k+1; i++)
{
  for (ll j = i+i; j < k+1; j+=i)
  {
    v[j]+=i;
  }
  ans=mod(ans+i*mypow(k/i,n));
  ans=mod(ans-(v[i]*mypow(k/i,n)));
  for (ll j = i+i; j < k+1; j+=i)
  {
    v[j]-=v[i];
  }
}

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

Measured memory_bytes: 3964
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define ld double
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define len length()
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect

const int N = 2e5 + 7;

int a[N];

void solve() {
    int k, n, sum = 0;
    cin >> n >> k;
    loop(i, n) cin >> a[i];
    sort(a, a + n, greater <int> ());
    for (int i = k; i < n; ++i)
        sum += a[i];
    cout << sum;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 1792
n=int(input())
ab=[[int(i) for i in input().split()] for j in range(n)]
cd=[[int(i) for i in input().split()] for j in range(n)]
ab.sort()
cd.sort()

ans=0
for c,d in cd:
    bmax=-1
    acheck=-1
    for a,b in ab:
        if a<c and b<d:
            if b>=bmax:
                bmax=b
                acheck=a
    if acheck!=-1:
        ab.remove([acheck,bmax])
        ans+=1
print(ans)            
            

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  deque<int> dq;
  rep(i, n) {
    int p = lower_bound(dq.begin(), dq.end(), a[i]) - dq.begin();
    if (p == 0) {
      dq.push_front(a[i]);
    } else {
      dq[p - 1] = a[i];
    }
  }
  int ans = dq.size();
  cout << ans << endl;
  
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define eb          emplace_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define mp(x,y)     make_pair(x,y) 
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,a,n)   for(ll i=a;i<n;i++)
#define frr(i,a,n)  for(ll i=n-1;i>=a;i--)


const ll N   =  500005;
const ll mod = 1e9 + 7;

using namespace std;

bool vis[N];
void solve()
{
 string s;
  ll n,m,k,x=0,y=0,c=0,q,ans=0;
  cin>>s;
  n = s.length();
  for (ll i = 0; i < n; ++i)
  {
      if(s[i]=='A' and vis[i]==0)
      {
        x++;
        vis[i] = 1;
       // c(i);
      }
      if(i+2<n and s[i] =='A' and s[i+1]=='B' and s[i+2]=='C')
      {
          s[i+2] = 'A';
          s[i+1] = 'B';
          s[i]   = 'C';
          vis[i+2] = 1;
          i++;
          ans +=x;
      }
      if(s[i]=='A' and ((s[i+1]=='B' and (s[i+2]=='A' or s[i+2]=='B')) or s[i+1]=='C'))
            x = 0;
       //   c(x);
  }
  
  cout<<ans<<" ";
}

signed main(){
     
      ios_base::sync_with_stdio(false);   
      cin.tie(NULL);
      ll T=1;
      //cin>>T;
      while(T--)
      {
      solve();
      }
      return 0;
    }


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

char tolower(char ch){
  if( 'A' <= ch && ch <= 'Z' ){
    return ch-'A'+'a';
  }else{
    return ch;
  }
}

int main(){
  int count=0;
  string W;
  cin>>W;
  string str;
  while(1){
    cin>>str;
    if(str=="END_OF_TEXT")break;
    for(int i=0;i<(int)str.size();i++){
      str[i]=tolower(str[i]);
    }
    if(str==W){
      count++;
    }
  }
  cout<<count<<endl;
  return 0;
}



Measured memory_bytes: 3216
text = list(input())
pattern = list(input())
for i in range(len(text)):
    
    flg = True
    for j in range(len(pattern)):
        if text[(i + j) % len(text)] != pattern[j]:
            flg = False
            break
    
    if flg:
        break

if flg:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 5560
#include "stdio.h"
#include "string.h"

int main()
{
  int a, b;
  char d[101] = {};
  scanf("%s", d);
  a = strlen(d);
  for(b = 0; b < a; b++)
  {
    if((b % 2) == 0)
    {
      if(d[b] != 'R' && d[b] != 'U' && d[b] != 'D')
      {
      printf("No");
      return 0;
      }
    }
    else
    {
      if(d[b] != 'L' && d[b] != 'U' && d[b] != 'D')
      {
        printf("No");
        return 0;
      }
    }
  }
  printf("Yes");
  return 0;
}


Measured memory_bytes: 256
//Hey u r too far away to know this
//CHIRAGA196
#include <bits/stdc++.h>
using namespace std;
#define     ff                  first
#define     pb                  push_back
#define     ss                  second
#define     IOS                 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define     all(v)              v.begin(), v.end()
#define     allr(v)             v.rbegin(), v.rend()
#define       int               long long
#define       endl             '\n'
const   int N = 1e6+5, Mod = 1e9 + 7;
int32_t main(){
        IOS;
 
        int n; cin >> n;
        string s = "", x = "ACL";
        for(int i = 0; i < n; i++)
        	s += x;
        cout << s ;
        return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <stack>
#include <vector>
#include <algorithm>

#define maxn 5005
#define mod 1000000007
using namespace std;
long long dp[maxn][maxn];

long long qmod(long long a, long long b) {
    long long ans = 1;
    while (b) {
        if (b & 1)
            ans = (ans * a) % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}

char a[maxn];
long long n;
int main() {
    dp[0][0] = 1;
    scanf("%lld%s", &n, a);
    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j <= i; ++j) {
            //dp[i][j]=(dp[i-1][max(0,j-1)]*2+dp[i-1][j+1]+dp[i][j])%mod;
            dp[i + 1][j + 1] = (dp[i][j] * 2 % mod + dp[i + 1][j + 1] ) % mod;
            dp[i + 1][max(0, j - 1)] = (dp[i + 1][max(0, j - 1)] + dp[i][j]) % mod;
        }
    }
    printf("%lld\n", qmod(qmod((long long) 2, (long long) strlen(a)), mod - 2) * dp[n][strlen(a)] % mod);
    return 0;
}

Measured memory_bytes: 194048
#include "bits/stdc++.h"
using namespace std;
// #define endl '\n'
// #define double long double
// #define int long long
// int MOD = 1000 * 1000 * 1000 + 7;
// int MOD = 998244353;

int k;
int found = 0;

stack<int> active;

void curr() {
	stack<int> tr;
	while (!active.empty()) {
		int f = active.top();
		active.pop();
		tr.push(f);
	}
	while (!tr.empty()) {
		cout << tr.top(); tr.pop();
	}
	cout << endl;
}

void find(int more, int here) {
	active.push(here);
	if (more == 0) {
		found++;
		if (found == k) {
			curr();
			exit(0);
		}
		active.pop();
		return;
	}
	for (int j=here-1; j<=here+1; j++) {
		if (j < 0 || j > 9) continue;
		find(more-1, j);
	}
	active.pop();
}

signed main() {

	cin >> k;
	
	for (int digits=1; digits<=100; digits++) {
		for (int i=1; i<=9; i++) {
			// cout << "!" << endl;
			find(digits-1, i);
		}
	}
	
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int Alice = sc.nextInt();
		int Borys = sc.nextInt();

		int dif = Borys - Alice;

		if(dif %2 == 0) {
			System.out.println("Alice");
		} else {
			System.out.println("Borys");
		}
	}	
}


Measured memory_bytes: 23124
use proconio::input;

fn main() {
    input! {
        n: usize,
    }
    match n % 10 {
        2 | 4 | 5 | 7 | 9 => println!("hon"),
        0 | 1 | 6 | 8 => println!("pon"),
        3 => println!("bon"),
        _ => unreachable!(),
    }
}


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

using namespace std;

string s;
char depth[10];
long long int ans =0;

void solve(int pos){
   if( pos == (s.size()-1) ){    //最下層到達なら
       long long int sum = 0;
       long long int num = 0;
       string local_s;
               local_s.clear();
       for(int i=0; i< (s.size() -1); i++){
           local_s += s[i];
           if(depth[i] == 1){
//               cout << "tmp1" << endl;
               ans += stol(local_s);
//               cout << ans <<endl;
               local_s.clear();
           }
           if(i == (s.size() -2)){ // 末尾だけの特別処理
               local_s += s[ s.size() -1 ];
//               cout << "tmp2" << endl;
               ans += stol(local_s);
//               cout << ans <<endl;
           }
       }
       return;
   }

   // +を当てるなら
   { 
       depth[pos] = 1;
       solve(pos + 1);
   }
   { // +を当てないなら
       depth[pos] = 0;
       solve(pos + 1);
   }
   return;
}


int main(void){
   cin >> s;
   if(s.size() == 1){
   // size0は足したら終わり
       ans = stol(s);
   }else{
       solve(0);
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.Math;


public class Main{
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int n;
		double x1, x2, x3, y1, y2, y3, xp, yp, r;
		double a, b, c, d, e, f;
		
		n = sc.nextInt();
		
		for(int i=0; i < n; i++){
		
			x1 = sc.nextDouble();
			y1 = sc.nextDouble();
			x2 = sc.nextDouble();
			y2 = sc.nextDouble();
			x3 = sc.nextDouble();
			y3 = sc.nextDouble();
			
			a = 2 * (x2 - x1);
			b = 2 * (y2 - y1);
			c = Math.pow(x1, 2) - Math.pow(x2, 2) + Math.pow(y1, 2) - Math.pow(y2, 2);
			d = 2 * (x3 - x1);
			e = 2 * (y3 - y1);
			f = Math.pow(x1, 2) - Math.pow(x3, 2) + Math.pow(y1, 2) - Math.pow(y3, 2);
			
			xp = (b * f - c * e) / (e * a - b * d);
	        yp = (d * c - a * f) / (e * a - d * b);
	        
	        r = Math.sqrt(Math.pow(x1 - xp, 2) + Math.pow(y1 - yp, 2));
	        
	        System.out.printf("%.3f %.3f %.3f\n", xp, yp, r);
		}
	}

}

Measured memory_bytes: 12000
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


int main(int argc, char* argv[])
{
    int a[4][3][10]={0};
    int n;
    scanf("%d", &n);

    int i;
    for(i=0; i<n; i++) {
        int b,f,r,v;
        scanf("%d%d%d%d", &b, &f, &r, &v);
        a[b-1][f-1][r-1]+=v;
    }

    int j,k;
    for(i=0; i<4; i++) {
        for(j=0; j<3; j++) {
            for(k=0; k<10; k++) {
                printf(" %d", a[i][j][k]);
            }
            printf("\n");
        }
        if(i<3) printf("####################\n");
    }

    return 0;
}



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

const int maxn = 100010;
int n, m, d[maxn];

int main() {
    cin >> n >> m;
    for (int i = 1, u, v; i <= m; i++) {
        cin >> u >> v;
        d[u]++, d[v]++;
    }
    for (int i = 1; i <= n; i++) {
        if (d[i] & 1) { cout << "NO" << endl; exit(0); }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

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

    int n; cin >> n;
    vint a(1e7+1,1);

    for(int i=2; i<1e7+1; i++){
        for(int j=i; j<1e7+1; j+=i){
            a[j]++;
        }
    }

    int res=0;
    for(int i=1; i<=n; i++){
        res+=i*a[i];
    }
    cout<<res<<endl;
}

Measured memory_bytes: 81328
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int N;

int main()
{
    cin >> N;
    vector<int> h(N);
    for (int i = 0; i < N; i++)
    {
        cin >> h[i];
    }

    for (int i = 1; i < N; i++)
    {
        if (h[i] > h[i - 1])
            h[i]--;
        if (h[i] < h[i - 1])
        {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
}

Measured memory_bytes: 640