akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };



int main() {
	char N[12];
	scanf("%s", &N);

	int len = strlen(N);

	int sum=0;
	int num = 0;
	int bai = 1;

	for (int i = 0; i < len; i++) {
		sum += int(N[i])-48;
		num += (int(N[len - 1 - i])-48)*bai;
		bai *= 10;
	}

	if (num%sum == 0)printf("Yes");
	else printf("No");

}





/*         提出前の確認事項

・デバッグ用の関数は＜＜コメント化＞＞しているか？
・すべての＜＜入力例＞＞は試したか？
・＜＜限界値分析＞＞はしたか？
・＜＜出力の改行＞＞の有無は確認したか？
・文字列の＜＜スペル＞＞は確認したか？
　　　　　　　　↓
	 ＜＜提出先＞＞に注意して提出！！
*/

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;

int n,a[N],ans;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	for (int i=1;i<=n;i++){
		cin >> a[i];
	}
	for (int i=1;i<n;i++){
		if (a[i]==i){
			swap(a[i],a[i+1]);
			i++;
			ans++;
		}
	}
	if (a[n]==n){
		ans++;
	}
	cout << ans << "\n";
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod (int)1000000007
#define pb push_back
#define endl "\n"
#define all(a) a.begin(),a.end()
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repe(i,a,b) for(int i=a;i<=b;i++)
#define repo(i,b) for(int i=(int)0;i<b;i++)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

signed solve(){
	int n,wt;
	cin>>n>>wt;
	int dp[wt+1]={0};
	while(n--){
		int w,v;
		cin>>w>>v;
		for(int i=wt-w;i>=0;i--){
			dp[i+w]=max(dp[i+w],dp[i]+v);
		}
	}
	int ans=0;
	for(int i=0;i<wt+1;i++) ans=max(ans,dp[i]);
	cout<<ans<<endl;
	return 0;
}

signed main(){
	fast;
	int tests=1;
	// cin>>tests;
	while(tests--){
		solve();
	}
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

string invc(string s) {
  return s.substr(1, SZ(s)-1) + s[0];
}

string invj(string s) {
  return s[SZ(s)-1] + s.substr(0, SZ(s)-1);
}

string inve(string s) {
  if(SZ(s) % 2 == 0) {
    return s.substr(SZ(s)/2, SZ(s)/2) + s.substr(0, SZ(s)/2);
  } else {
    return s.substr(SZ(s)/2+1, SZ(s)/2) + s[SZ(s)/2] + s.substr(0, SZ(s)/2);
  }
}

string inva(string s) {
  reverse(ALL(s));
  return s;
}

string invm(string s) {
  REP(i, SZ(s)) {
    if('0' <= s[i] && s[i] <= '9') {
      s[i] = (((s[i] - '0') + 1) % 10) + '0';
    }
  }
  return s;
}

string invp(string s) {
  REP(i, SZ(s)) {
    if('0' <= s[i] && s[i] <= '9') {
      s[i] = (((s[i] - '0') + 9) % 10) + '0';
    }
  }
  return s;
}



int main () {
  cin.tie(0);
  cout << setprecision(10);

  int n; cin >> n;
  REP(i, n) {
    string s; cin >> s;
    string a; cin >> a;
    RREP(i, SZ(s)-1) {
      switch(s[i]) {
      case 'J':
        a = invj(a);
        break;
      case 'C':
        a = invc(a);
        break;
      case 'E':
        a = inve(a);
        break;
      case 'A':
        a = inva(a);
        break;
      case 'P':
        a = invp(a);
        break;
      default:
        a = invm(a);
        break;
      }
    }
    cout << a << endl;
  }
}



Measured memory_bytes: 3040
# -*- coding: utf-8 -*-

# ケアレスミスしないように一旦紙に式を書くこと

n = int(input())
k = int(input())
x = int(input())
y = int(input())

diff = y - x

p_x = x * n
p_y = diff * (n - k) if (n - k) > 0 else 0

print(p_x + p_y)

#p_x = x * k if n - k >= 0 else x * n
#p_y = (n - k) * y if n - k > 0 else 0

#print(p_x + p_y)

Measured memory_bytes: 9100
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

int main(){
    string str;
    int page;
    map<string, vector<int> > dict;
    while (cin >> str >> page){
	dict[str].push_back(page);
    }
    for (map<string, vector<int> >::iterator it = dict.begin(); it != dict.end(); it++){
	sort (it->second.begin(), it->second.end());
	cout << it->first << endl;
	for (int i = 0; i < (int) it->second.size(); i++){
	    cout << it->second[i];
	    cout << ((i < (int)it->second.size()-1)? ' ':'\n');
	}
    }
}

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



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

   int l = 0, r = n - 1;
   int ans = 0;

   while(l < r)
   {
       while(l < r && str[l] == 'R')
        l++;
       while(l < r && str[r] == 'W')
        r--;

        if(l < r)
            ans ++;
       l++;
       r--;

   }

   cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3752
#include <iostream>
using namespace std;
int main(void){
    int total_a=0, total_b=0, a, b;
    for(int i=1; i<=4; i++){
        cin >> a;
        total_a += a;
    }
    for(int i=1; i<=4; i++){
        cin >> b;
        total_b += b;
    }
    if(total_a >= total_b) cout << total_a << endl;
    else cout << total_b << endl;
    return 0;
    
}



Measured memory_bytes: 3100
from collections import deque

h, w = (int(x) for x in input().split())
ch, cw = (int(x) - 1 for x in input().split())
dh, dw = (int(x) - 1 for x in input().split())
s = [list(input()) for _ in range(h)]
grid = [[-1] * w for _ in range(h)]
grid[ch][cw] = 0
walk = [[0, 1], [0, -1], [1, 0], [-1, 0]]
warp = [[2, 2], [2, 1], [2, 0], [2, -1], [2, -2], [1, 2], [1, 1], [1, -1], [1, -2], [0, 2], [0, -2], [-1, 2], [-1, 1],
     [-1, -1], [-1, -2], [-2, 2], [-2, 1], [-2, 0], [-2, -1], [-2, -2]]

que = deque([(0, ch, cw)])
while que:
    count, y, x = que.popleft()
    if grid[y][x] < count:
        continue
    for NY, NX in walk:
        if 0 <= y + NY < h and 0 <= x + NX < w and s[y + NY][x + NX] != '#':
            if grid[y + NY][x + NX] == -1 or grid[y + NY][x + NX] > count:
                grid[y + NY][x + NX] = count
                que.appendleft((count, y + NY, x + NX))
    for NY, NX in warp:
        if 0 <= y + NY < h and 0 <= x + NX < w and s[y + NY][x + NX] != '#':
            if grid[y + NY][x + NX] == -1 or grid[y + NY][x + NX] > count + 1:
                grid[y + NY][x + NX] = count + 1
                que.append((count + 1, y + NY, x + NX))

print(grid[dh][dw])

Measured memory_bytes: 158368
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 201010;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
char notes[110][10];
ll treasure[3030][3030];
ll dp[3030][3030][4];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	string s;
	cin >> s;
	ll n = s.length();
	ll ans = 0;
	ll res = 0;
	rep(i, n - 1) {
		if (s[i] == 'A')res++;
		else {
			if (s[i] == 'B' && s[i + 1] == 'C') {
				ans += res;
				i++;
			}
			else {
				res = 0;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;
int k, n, i, maxval=-1, mini=-1, sum=0;
int a[200000];

int main() {
    scanf(" %d %d", &k, &n);
    for (i=0;i<n;i++) {
        scanf(" %d", &a[i]);
        if (i > 0 && a[i] - a[i-1] > maxval) maxval = a[i] - a[i-1];
    }
    int t = k - a[n-1] + a[0];
    if (t > maxval) maxval = t;
    printf("%d\n", k - maxval);
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
int main(){
int a;scanf("%d",&a);
int L=a/100;
int R=a%100;
if(1<=L&&L<=12){
if(1<=R&&R<=12)printf("AMBIGUOUS\n");
else printf("MMYY\n");
}else{
if(1<=R&&R<=12)printf("YYMM\n");
else printf("NA\n");
}
}


Measured memory_bytes: 3756
#include<iostream> 
using namespace std;
int main()
{ int a, b, x;
 cin >> a >> b >> x;
 if( a > x ){
 cout << "NO";
 return 0;
 }
else{
 if( b < x - a ){
 cout << "NO";
 return 0;
 } }
 cout << "YES";
 return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
int main()
{
  IOS;
  ll t=1;
  //cin>>t;
  while(t--)
  {
    ll i,n,k,sum=0,x,p=0,l,r,ans=0,mx,cnt=0,m,j;
    cin>>n>>m>>k;
    char a[n][m];
    char b[n][m];
    for(i=0;i<n;i++)
    {
      for(j=0;j<m;j++)
      b[i][j]='a';
    }

    for(i=0;i<n;i++)
    {
      for(j=0;j<m;j++)
      cin>>a[i][j];
    }
    ans=0;
    for(i=0;i<(1<<n);i++)
    {
      for(j=0;j<(1<<m);j++)
      {
        for(l=0;l<n;l++)
        {
          for(r=0;r<m;r++)
          {
            b[l][r]=a[l][r];
          }
        }

      /*  cout<<"\n";
        for(l=0;l<n;l++)
        {
          for(r=0;r<m;r++)
          {
            cout<<b[l][r];
          }
          cout<<"\n";
        }
        cout<<"\n"; */
        for(l=0;l<n;l++)
        {
          if(i&(1<<l))
          {
            for(r=0;r<m;r++)
            {
              b[l][r]='$';
            }
          }
        }

        for(l=0;l<m;l++)
        {
          if(j&(1<<l))
          {
            for(r=0;r<n;r++)
            {
              b[r][l]='$';
            }
          }
        }
      /*  cout<<"\n";
        for(l=0;l<n;l++)
        {
          for(r=0;r<m;r++)
          {
            cout<<b[l][r];
          }
          cout<<"\n";
        }
        cout<<"\n"; */
        cnt=0;
        for(l=0;l<n;l++)
        {
          for(r=0;r<m;r++)
          {
            if(b[l][r]=='#')
            cnt++;
          }
        }

        if(cnt==k)
        {
          ans++;
        }
      }
    }

    cout<<ans<<"\n";

  }
    return 0;
}


Measured memory_bytes: 3600
#include<stdio.h>

int main(void){
  int k,a[100],t,max=0,i,j;
  scanf("%d%d",&k,&t);
  for(i=0;i<t;i++){
    scanf("%d",&a[i]);
    if(a[i]>max) max=a[i];
  }

  if(max>(k+1)/2) printf("%d\n",max-(k-max)-1);
  else puts("0");
  return 0;
}

			 


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

using ll = long long;

//constant
const ll MOD = 1e+9 + 7;
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// view vector
template<typename T> void view(T e) { std::cout << e << std::endl; }
template<typename T> void view(const std::vector<T>& v) { for (const auto& e : v) { std::cout << e << " "; } std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// DP
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; }

// ***************************************

// modint: mod 計算を int を扱うように扱える構造体
const ll inf = 1LL << 60;

struct Mint {
    ll v;
    ll _mod;
    Mint() : v(0) {}
    Mint(signed v, ll _mod = MOD) : v(v), _mod(_mod) {}
    Mint(ll t, ll _mod = MOD) : _mod(_mod) {
        v = t % _mod;
        if (v < 0)
            v += _mod;
    }

    Mint pow(ll k) {
        Mint res(1), tmp(v);
        while (k) {
            if (k & 1)
                res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    static Mint add_identity() { return Mint(0); }
    static Mint mul_identity() { return Mint(1); }
    Mint inv() { return pow(_mod - 2); }

    Mint& operator+=(Mint a) {
        v += a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    Mint& operator-=(Mint a) {
        v += _mod - a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    Mint& operator*=(Mint a) {
        v = v * a.v % _mod;
        return *this;
    }
    Mint& operator/=(Mint a) { return (*this) *= a.inv(); }

    Mint operator+(Mint a) const { return Mint(v) += a; };
    Mint operator-(Mint a) const { return Mint(v) -= a; };
    Mint operator*(Mint a) const { return Mint(v) *= a; };
    Mint operator/(Mint a) const { return Mint(v) /= a; };

    Mint operator-() const { return v ? Mint(_mod - v) : Mint(v); }

    bool operator==(const Mint a) const { return v == a.v; }
    bool operator!=(const Mint a) const { return v != a.v; }
    bool operator<(const Mint a) const { return v < a.v; }
};
ostream& operator<<(ostream& os, Mint m) { return os << m.v; }

Mint nCk(int n, int k) {
    Mint ret = 1;
    for (int i = n; i > n - k; --i) {
        ret *= i;
    }
    for (int i = 1; i <= k; ++i) {
        ret /= i;
    }
    return ret;
}

int main(void) {

    ll N;
    int a, b;
    cin >> N >> a >> b;

    Mint ans = Mint(2).pow(N) - 1;
    ans -= nCk(N, a);
    Mint tmp = nCk(N, b);
    ans = ans - tmp;

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

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

void sort_M(char str[], int size) {
	int i, j, last, sorted;

	sorted = size;
	while(sorted) {
		last = 0;

		for(i = 0; i < sorted - 1; i++) {
			if(str[i] < str[i + 1]) {
				int tmp;
				tmp = str[i];
				str[i] = str[i + 1];
				str[i + 1] = tmp;

				last = i + 1;
			}
		}

		sorted = last;
	}
}

void sort_m(char str[], int size) {
	int i, j, last, sorted;

	sorted = size;
	while(sorted) {
		last = 0;

		for(i = 0; i < sorted - 1; i++) {
			if(str[i] > str[i + 1]) {
				int tmp;
				tmp = str[i];
				str[i] = str[i + 1];
				str[i + 1] = tmp;

				last = i + 1;
			}
		}

		sorted = last;
	}
}

int main(void) {
	int n;
	char input[16], str_m[16], str_M[16];
	int i;
	int max, min;

	scanf("%d", &n);

	for(i = 0; i < n; i++) {
		scanf("%s", input);
		memcpy(str_m, input, sizeof(input));
		memcpy(str_M, input, sizeof(input));

		sort_m(str_m, 8);
		sort_M(str_M, 8);

		min = atoi(str_m);
		max = atoi(str_M);

		printf("%d\n", max - min);
	}

	return 0;
}

Measured memory_bytes: 592
package main

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

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	ans := 0
	for i := 0; i < n; i++ {
		sc.Scan()
		x, _ := strconv.Atoi(sc.Text())
		ans += x - 1
	}

	fmt.Println(ans)
}


Measured memory_bytes: 640
<?php

while (($line = trim(fgets(STDIN))) !== '') {
    sscanf($line, '%d', $weight);
    //2進数に変換
    $bin = decbin($weight);
    //配列 => 逆順 => 値が0なものを除外
    $arr = array_filter(array_reverse(str_split($bin)), function ($n) {
        return (int)$n === 1;
    });
    //キー(指数)を取り出して2のn乗した配列
    $arr = array_map(function ($n) {
        return pow(2, $n);
    }, array_keys($arr));
    echo implode(' ', $arr), PHP_EOL;
}

Measured memory_bytes: 6616
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t a,b;
    cin >> a >> b;
    vi va ,vb;
    rep(i,2000){
        if(floor((i*8)/100)==a) va.push_back(i);
        if(floor((i*10)/100)==b) vb.push_back(i);
    }
    vi intersection;
    set_intersection(va.begin(), va.end(), vb.begin(), vb.end(), back_inserter(intersection));
    if(intersection.empty()){
        cout << "-1" << endl;
    }else{
        cout << intersection.at(0) << endl;
    }
}


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

typedef long long lli;

const int maxn = 1e5 + 10;

int n;
lli c;
lli sumval;
lli x[maxn], val[maxn];
lli costl[maxn], costlret[maxn];
lli ans = 0;

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

    cin >> n >> c;
    x[n + 1] = c;

    for(int i = 1; i <= n; i++) {
        cin >> x[i] >> val[i];
        sumval += val[i];
    }

    lli maxl = 0, maxlret = 0;

    for(int i = n; i >= 0; i--) {
        ans = max(ans, sumval - x[i] + maxlret);
        ans = max(ans, sumval - 2 * x[i] + maxl);
        costl[i] = costl[i + 1] - (x[i + 1] - x[i]) + val[i];
        costlret[i] = costlret[i + 1] - 2 * (x[i + 1] - x[i]) + val[i];
        maxl = max(maxl, costl[i]);
        maxlret = max(maxlret, costlret[i]);
        sumval -= val[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3328
/*Author: ADITYA SHETH*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
#define t1(x)             cerr<<#x<<"="<<x<<endl
#define t2(x, y)          cerr<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define t3(x, y, z)       cerr<<#x<<"=" <<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define t4(a,b,c,d)       cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<endl
#define t5(a,b,c,d,e)     cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<endl
#define t6(a,b,c,d,e,f)   cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<" "<<#f<<"="<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
//freopen("output.txt","w",stdout);
//freopen("input.txt","r",stdin);
/*-------------------------------------------------------------------------------------------------------------------------------------*/
#define MOD 1000000007
#define endl "\n" 
#define int long long // remove when constraints are tight.
#define inf 1e18
/*-------------------------------------------------------------------------------------------------------------------------------------*/

string s;
int32_t main()
{
	ios::sync_with_stdio(0);cin.tie(0);	
	cin>>s;
	int n=s.length();
	int ar[n+1];
	memset(ar,0,sizeof(ar));
	for(int i=0;i<n-1;i++)
	{
		if(s[i]=='>' && s[i+1]=='<')
		{
			ar[i+1]=0;		
			int cur=i+1;
			while(cur<n && s[cur]=='<')
			{
				ar[cur+1]=max(ar[cur+1],ar[cur]+1);
				cur++;
			}
			cur=i;
			while(cur>=0 && s[cur]=='>')
			{
				ar[cur]=max(ar[cur+1]+1,ar[cur]);
				cur--;
			}
		}
	}
	if(s[0]=='<')
	{
		ar[0]=0;
		int cur=0;
		while(cur<n && s[cur]=='<')
		{
			ar[cur+1]=max(ar[cur+1],ar[cur]+1);
			cur++;
		}
	}
	if(s[n-1]=='>')
	{
		ar[n]=0;
		int cur=n-1;
		while(s[cur]=='>' && cur>=0)
		{
			ar[cur]=max(ar[cur+1]+1,ar[cur]);
			cur--;
		}
	}
	int ans=0;
	for(int i=0;i<=n;i++)ans+=ar[i];
	cout<<ans<<endl;
}


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

int main() {
  ll A,B,C,K; cin>>A>>B>>C>>K;
  if(K<=A) cout << K << endl;
  if(A<K && K<=A+B) cout << A << endl;
  if(A+B<K && K<=A+B+C) cout << 2*A-K+B << endl;
}


Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

int full_search(string &S, int index, int cnt, int ans){
    if(index==4){
        //cout << ans << ' ' << cnt << endl;
        if(cnt==7){
            return ans;
        }else{
            return 0;
        }
    }

    int tmp=full_search(S, index+1, cnt+(S[index]-'0'), (ans<<1)+1);
    if(tmp)return tmp;
    tmp=full_search(S, index+1, cnt-(S[index]-'0'), (ans<<1));
    if(tmp)return tmp;
    return 0;
}

int main(){
    string S;
    cin >> S;

    int ans=full_search(S, 1, S[0]-'0', 0);
    //cout << ans << endl;
    for(int i=0; i<4; i++){
        cout << S[i];
        if(i==3){
            cout << "=7" << endl;
            break;
        }

        int tmp=ans>>(2-i);
        ans-=(tmp<<(2-i));
        if(tmp){
            cout << '+';
        }else{
            cout << '-';
        }
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a[3005];
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	int sum=0;
	for(int i=0;i<n;i++)
		sum+=a[i];
	printf("%d",sum-n);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
using namespace std;
int n,m,x;
int rc,lc;

int main(){
	cin>>n>>m>>x;
	for(int i=0;i<m;i++){
		int t;
		cin>>t;
		if(t<x){
			lc++;
		}else{
			rc++;
		}
	}
	cout<<min(rc,lc)<<endl;
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0;i<n;i++) cin >> a[i];

    if(n%2 == 0){
        for(int i = n-1;i >= 0;i -= 2){
            cout << a[i] << " ";
        }
        if(n != 1){
            for(int i = 0;i < n;i+=2){
                cout << a[i];
                if(i != n-1 && i != n-2){
                    cout << " ";
                }
            }
        cout << endl;
        }
    }
    else{
        for(int i = n-1;i >= 0;i -= 2){
            cout << a[i] << " ";
        }
        if(n != 1){
            for(int i = 1;i < n;i+=2){
                cout << a[i];
                if(i != n-1 && i != n-2){
                    cout << " ";
                }
            }
        cout << endl;
        }
    }

    

    return 0;
}

Measured memory_bytes: 2944
process.stdin.resume()
process.stdin.setEncoding('utf8')
process.stdin.on('data', function(input) {
  var result = input.split(' ').map(Number).reduce(compare)

  out(result)
})

var out = function(x) {
  console.log(x)
  return x
}

var compare = function(a, b) {
    if (a < b) {
      return "a < b"
    } else if (a == b) {
      return "a == b"
    } else if (a > b) {
      return "a > b"
    }
}

Measured memory_bytes: 15512
//#include<atcoder/all>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
//using namespace atcoder;

#define ll long long
#define pal pair<ll,ll>
#define pad pair<double,double>
#define PB push_back
#define MP make_pair
#define F first
#define S second

const ll MOD = 998244353;
const ll INF = 1e18;
const double EPS = 1e-8;

template<typename T,typename U>
bool chmax(T& max, const U& x){
	if(max<x){
		max = x;
		return true;
	}
	return false;
}

template<typename T,typename U>
bool chmin(T& min, const U& x){
	if(min>x){
		min = x;
		return true;
	}
	return false;
}


int main(){
	ll n,k;
	cin >> n>>k;
	vector<pal> ivl;
	vector<ll> dp(n+1,0);
	vector<ll> ruiwa(n+1,0);
	for(ll i=0;i<k;i++){
		ll l,r;
		cin >> l >> r;
		ivl.PB(MP(l,r));
	}
	dp[1]=1;
	ruiwa[1]=1;
	for(ll i=2;i<=n;i++){
		for(pal p : ivl){
			if(i-p.F<0){
				continue;
			}
			ll hiku=ruiwa[0];
			if(i-p.S>0){
				hiku=ruiwa[i-p.S-1];
			}
			dp[i]= dp[i] + ruiwa[i-p.F]-hiku;
			dp[i]%=MOD;
			if(dp[i]<0) dp[i]+=MOD;
		}
		ruiwa[i]=ruiwa[i-1]+dp[i];
		ruiwa[i]%=MOD;
	}
	cout << dp[n] << endl;

}

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

using namespace std;

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

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

const int N = 6005;
int a[N];
int d[N];
bool take[N];

vector<int> solve(vector<int> g){ 
  if(g[0] == 0){
    vector<int> pa, pb;
    for(int i = 0 ; i < g.size() ; i ++ ){
      if(g[i] == 0)pa.push_back(i);
      else pb.push_back(i);
    }
    int cur = -1;
    vector<int> sol;
    for(int i = 0 ; i < pa.size(); i ++ ){
      if(pa[i] > cur){
        sol.push_back(0);
        sol.push_back(1);
        cur = pb[i];
      }
    }
    return sol;
  }
  else{
    vector<int> best;
    vector<int> pa, pb;
    for(int i = 0 ; i < g.size() ; i ++ ){
      if(g[i] == 0) pa.push_back(i);
      else pb.push_back(i);
    }
    for(int i = 0 ; i < pb.size(); i ++ ){
      for(int j = 0 ; j < g.size(); j ++ ){
        take[j] = false;
      }
      for(int j = i ; j < pb.size(); j ++ ){
        take[pb[j]] = true;
        take[pa[j]] = true;
      }
      vector<int> cur;
      for(int j = 0 ; j < g.size(); j ++ ){
        if(take[j])
          cur.push_back(g[j]);
      }
      if(cur > best)
        best = cur;
    }
    return best;
  }
}

int main(){
  fastIO;
  int n;
  cin >> n;
  n *= 2;
  char f;
  for(int i = 1; i <= n; i ++ ){
    cin >> f;
    a[i] = f - 'a';
  }
  for(int i = 1; i <= n; i ++ ){
    d[i] = d[i - 1] + (a[i] == 0 ? 1 : -1);
  }
  vector<string> parts;
  int b;
  for(int i = 1; i <= n; i ++ ){
    if(d[i] == 0){
      b=i;
      while(d[b-1] != 0) b--;
      vector<int> pp;
      for(int j = b; j <= i ; j ++ ){
        pp.push_back(a[j]);
      }
      vector<int> bes = solve(pp);
      string go;
      for(int x : bes){
        go.push_back((x == 0 ? 'a' : 'b'));
      }
      parts.push_back(go);
    }
  }
  string sol;
  for(int i = (int)parts.size() - 1; i >= 0 ; i -- ){
    sol = max(sol, parts[i] + sol);
  }
  cout << sol << "\n";
  return 0;
}


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

int main() {
  
  int a[3][3];
  int c[3][3];
  int i, j, k, n, temp;
  
  for(i = 0; i < 3; ++i){
   for(j = 0; j < 3; ++j){
     cin >> temp;
     a[i][j] = temp;
     c[i][j] = 0;
   }
  }
    
  //cout << "ok1" << endl;
  
  cin >> n;
  for(i = 0; i < n; ++i){
    cin >> temp;
    for(j = 0; j < 3; ++j){
     for(k = 0; k < 3; ++k){
         if(temp == a[j][k]){
             c[j][k] = 1;
         }
      }
    }
  }

  //cout << "ok2" << endl;
    
  string res = "No";
  //縦チェック
  for(i = 0; i < 3; ++i){
    if(c[i][0] == 1 && c[i][1] == 1 && c[i][2] == 1){
      res = "Yes";
      break;
    }
  }
  //横チェック
  for(i = 0; i < 3; ++i){
    if(c[0][i] == 1 && c[1][i] == 1 && c[2][i] == 1){
      res = "Yes";
      break;
    }
  }
  
  //斜めチェック
  if(c[0][0] == 1 && c[1][1] == 1 && c[2][2] == 1) res = "Yes";
  if(c[0][2] == 1 && c[1][1] == 1 && c[2][0] == 1) res = "Yes";
  
  cout << res << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 55;
const int M = 105;
const int mo = 1e+9+7;

int n,m,c;
int h[N],tot;
struct edge{
	int x,nxt;
}e[M*2];
int dfn[N],f[N],k;
int sta[N],tp;
int be[N],u;
int fa[N];
LL ans;
LL js[1005],ny[1005];

void inse(int x,int y){e[++tot].x=y;e[tot].nxt=h[x];h[x]=tot;}

int gcd(int x,int y){return y==0?x:gcd(y,x%y);}

LL quickmi(LL x,LL tim){LL ans=1;x%=mo;for(;tim;tim/=2,x=x*x%mo)if (tim&1)ans=ans*x%mo;return ans;}

LL calc(int n,int m){return js[n]*ny[m]%mo*ny[n-m]%mo;}

void solve(int x){
	dfn[x]=f[x]=++k;
	sta[++tp]=x;
	for(int p=h[x];p;p=e[p].nxt)
	if (e[p].x!=fa[x]){
		if (!dfn[e[p].x]){
			fa[e[p].x]=x;
			solve(e[p].x);
			f[x]=min(f[x],f[e[p].x]);
		}
		else f[x]=min(f[x],dfn[e[p].x]);
	}
	if (fa[x]&&dfn[x]==f[x])ans=ans*c%mo;
	if (!fa[x])return;
	if (f[x]==dfn[fa[x]]){
		be[x]=++u;
		int cnt=0,qtp=tp;
		while(sta[tp]!=x)be[sta[tp--]]=u;
		tp--;
		fo(i,tp+1,qtp){
			int v=sta[i];
			for(int p=h[v];p;p=e[p].nxt)
			if ((e[p].x==fa[x]||be[e[p].x]==u)&&dfn[e[p].x]<dfn[v])cnt++;
		}
		int siz=qtp-tp;
		if (siz+1==cnt){
			siz++;
			LL tmp=0;
			fo(i,1,siz){
				int v=gcd(i,siz);
				tmp=(tmp+quickmi(c,v))%mo;
			}
			tmp=tmp*quickmi(siz,mo-2)%mo;
			ans=ans*tmp%mo;
		}
		else ans=ans*calc(cnt+c-1,cnt)%mo;
	}
	else
		if (f[x]==dfn[x]){
			be[x]=++u;
			int cnt=0,qtp=tp;
			while(sta[tp]!=x)be[sta[tp--]]=u;
			tp--;
			fo(i,tp+1,qtp){
				int v=sta[i];
				for(int p=h[v];p;p=e[p].nxt)
				if ((be[e[p].x]==u)&&dfn[e[p].x]<dfn[v])cnt++;
			}
			int siz=qtp-tp;
			if (siz>1){
				if (siz==cnt){
					LL tmp=0;
					fo(i,1,siz){
						int v=gcd(i,siz);
						tmp=(tmp+quickmi(c,v))%mo;
					}
					tmp=tmp*quickmi(siz,mo-2)%mo;
					ans=ans*tmp%mo;
				}
				else ans=ans*calc(cnt+c-1,cnt)%mo;	
			}
		}
}

int main(){
	n=get();m=get();c=get();
	fo(i,1,m){
		int x=get(),y=get();
		inse(x,y),inse(y,x);
	}
	js[0]=1;fo(i,1,1000)js[i]=js[i-1]*i%mo;
	ny[1000]=quickmi(js[1000],mo-2);
	fd(i,999,0)ny[i]=ny[i+1]*(i+1)%mo;
	ans=1;
	fo(i,1,n)
	if (!dfn[i])solve(i);
	printf("%lld\n",ans);
	return 0;
}

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

int main() {
    int n, m;
    int a[101000] = {0};
    int b[101000] = {0};
    int pos = 0;
    
    cin >> n >> m;
    
    for (int i = 0; i < m; i++) {
        cin >> a[i];
    }
    
    for (int i = 0; i <= n; i++) {
        if (i == 0) {
            b[i] = 1;
        }
        else {
            if (i == a[pos]) {
                pos++;
                continue;
            }
            
            if (i == 1) {
                b[i] = 1;
            }
            else {
                b[i] = (b[i - 2] + b[i - 1]) % 1000000007;
            }
        }
    }
    
    cout << (b[n] % 1000000007) << endl;
    return 0;
}

Measured memory_bytes: 1024
void main() {
	auto S = rs;
	ulong res;
	ulong tmp;
	foreach(i; S) {
		if(i == 'A' || i == 'T' || i == 'C' || i == 'G') {
			tmp++;
		} else {
			res = max(res, tmp);
			tmp = 0;
		}
	}
	res = max(res, tmp);
	res.writeln;
}

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

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 256
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

S=list(ns())
S_o=''.join(S[0::2])
S_e=''.join(S[1::2])
print('Yes' if ((not ('L' in S_o)) and (not ('R' in S_e))) else 'No')  

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		//		143
		int N = sc.nextInt();
		String S = sc.next();

		char[] A = S.toCharArray();

		int ans = 1;
		for (int i = 0; i < N-1; i++) {
			if (A[i] != A[i + 1])
				ans++;
		}

		System.out.println(ans);
    }
}

Measured memory_bytes: 25556
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int go[5];
int main(){
    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    go[a]++;
    go[b]++;
    go[c]++;
    go[d]++;
    go[e]++;
    go[f]++;
    for(int i=1;i<=4;i++)
        if(go[i]==0){
            cout<<"NO"<<endl;
            return 0;
        }
    int cnt=0;
    for(int i=1;i<=4;i++)
        if(go[i]%2)
            cnt++;
    cout<<((cnt!=2 && cnt!=0)?"NO":"YES")<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;

class Program
{
	static void Main(string[] args)
	{
		var Param = int.Parse(Console.ReadLine());

		var Hour = Param / 3600;
		var Minutes = (Param % 3600) / 60;
		var Second = ((Param % 3600) % 60);

		Console.WriteLine(string.Format("{0}:{1}:{2}", Hour, Minutes, Second));
	}
}

Measured memory_bytes: 9188
// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);
//#define _GLIBCXX_DEBUG//only for debugging
#include <bits/stdc++.h>
#include <ext/rope>
#define VALHALLA cin.tie(0)->ios_base::sync_with_stdio(false);cout<<fixed<<setprecision(13);
#define endl "\n"
#define pb push_back
#define all(v) v.begin(),v.end()
#define debug(x) std::cerr << #x << ": " << (x) << '\n';
#define sz(x) (int)x.size()
#define fast(map_name) map_name.reserve(1024);map_name.max_load_factor(0.25);
using namespace std;
using namespace __gnu_cxx;
typedef long long int ll;
typedef pair<int,int> ii;
typedef complex<double> point;
const double epsilon=1e-9;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int mod=1e9+7;
/* VARIABLE DECLARATION START */
int fact[int(2e5+1)];
int inv[int(2e5+1)];
/*  FUCNTION TEMPLATE STARTS  HERE */

double dot(point a,point b){ return (conj(a)*b).real() ; }
double cross(point a,point b){ return (conj(a)*b).imag() ; }
double dist(point a, point b){ return abs(a-b); }
struct neal {
static uint64_t splitmix64(uint64_t x)
 {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const
 {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
}
};
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return (size_t) x.first * 37U + (size_t) x.second;
  }
};
bool isprime(ll n) {
    if (n == 2 || n == 3) return true;
    if (n < 2 || n % 2 == 0 || n % 3 == 0) return false;
    for (ll i = 6; (i - 1) * (i - 1) <= n; i += 6) {
        if (n % (i - 1) == 0 || n % (i + 1) == 0) {
            return false;
        }
    }
    return true;
}
inline ll exp(ll a, ll b, ll mod) {
    ll n = 1;
    ll p = a;
    while (b > 0) {
        if (b % 2 == 1) {
            n *= p;
            n %= mod;
        }
        p *= p;
        p %= mod;
        b /= 2;
    }
    return n;
}

inline bool comp(double a,double b)
{
  return (fabs(a-b)<epsilon);
}
ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}

/*  FUCNTION TEMPLATE ENDS HERE */
int main()
{
   VALHALLA  
   int n;cin>>n;
   int arr[n];
   for(int i=0;i<n;++i)cin>>arr[i];
   int sum=accumulate(arr,arr+n,0);
   int val=sum/n;
   if(sum%n==0)
   {
    int ans=0;
    for(int x:arr)ans+=((x-val)*(x-val));
      cout<<ans;
   }
  else
  {
    int ans1=0;
    for(int x:arr)ans1+=((x-val)*(x-val));
    ++val;
    int ans2=0;
    for(int x:arr)ans2+=((x-val)*(x-val));
      cout<<min(ans1,ans2)<<endl;
  }


}

Measured memory_bytes: 256
import java.util.*;
import java.math.*;
import java.awt.geom.*;
import java.io.*;
    
    
public class Main {
	static int INF = 2 << 27;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int r = sc.nextInt();
			int c = sc.nextInt();
			if(r == 0 && c == 0) break;
			System.out.println((r * c)%2 == 0?"yes":"no");
		}
	}
}

Measured memory_bytes: 29084
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;


import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;


public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			final int K = sc.nextInt();
			
			int[] as = new int[N];
			for(int i = 0; i < N; i++) {
				as[i] = sc.nextInt();
			}
			
			int[] imos = new int[N + 1];
			for(int k = 0; k < K; k++) {
				Arrays.fill(imos, 0);
				
				boolean over = true;
				for(int i = 0; i < N; i++) {
					over &= as[i] >= N;
				}
				if(over) { break; }
				
				
				for(int i = 0; i < N; i++) {
					final int lower = Math.max(0, i - as[i]);
					final int upper = Math.min(N - 1, i + as[i]);
					
					imos[lower + 0] += 1;
					imos[upper + 1] -= 1; 
				}
				
				for(int i = 0; i < N; i++) { imos[i + 1] += imos[i]; }
				for(int i = 0; i < N; i++) { as[i] = imos[i]; }
			}
			
			for(int i = 0; i < N; i++) {
				System.out.print((i == 0 ? "" : " ") + as[i]);
			}
			System.out.println();
			
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

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

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

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}


Measured memory_bytes: 59924
X, K, D = map(int, input().split())

k = (D*K-X)//(2*D)
ans = min(abs(X+D*K), abs(X-D*K))
for i in range(k-10, k+10):
  if 0<=i<=K:
    ans = min(ans, abs(X+i*D-(K-i)*D))
print(ans)


Measured memory_bytes: 9176
def m():
    n = int(input())
    a = list(map(int, input().split()))
    ans = set()
    freecont = 0
    for i in range(n):
        t = a[i] // 400
        if t >= 8:
            freecont+=1
            continue
        ans.add(t)

    return "{} {}".format(max(len(ans),1), len(ans) +freecont)
    if len(ans) == 0:
        minc = 1
        maxc = min(freecont, 8)
        return "{} {}".format(minc, maxc)

    minc = len(ans)
    maxc = min(len(ans) + freecont, 8)
    return "{} {}".format(minc, maxc)


print(m())

Measured memory_bytes: 3064
import math as m
a,b,x = map(int,input().split())

area=x/a
limit=a*b/2
if area<limit:
    t=2*area/b
    print(m.degrees(m.atan(b/t)))
else:
    t=2*area/a-b
    print(m.degrees(m.atan((b-t)/a)))


Measured memory_bytes: 38384
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

H, W = MAP()
S = [input() for _ in range(H)]
dy = (1, 0, -1, 0)
dx = (0, -1, 0, 1)

def diff_max(start_y, start_x):
	check = [[-1]*W for _ in range(H)]
	check[start_y][start_x] = 0
	q = deque([(start_y, start_x)])

	while q:
		y, x = q.popleft()
		for i in range(4):
			ny = y + dy[i]
			nx = x + dx[i]
			if 0 <= ny < H and 0 <= nx < W:
				if check[ny][nx] == -1 and S[ny][nx] == ".":
					check[ny][nx] = check[y][x] + 1
					q.append((ny, nx))

	return max([max(x) for x in check])



ans = -INF
for i in range(H):
	for j in range(W):
		if S[i][j] == ".":
			ans = max(ans, diff_max(i, j))

print(ans)


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

bool num[7368792];

int furui(int m, int n) {
  int cnt = 0, boring = m;
  repl(i, m, 7368792) num[i] = false;

  repl(i, m, 7368792) {
    if (num[i]) continue;
    if (cnt == n) {
      boring = i;
      break;
    }
    num[i] = true;
    cnt++;
    int j = i + i;
    while(j < 7368792) {
      num[j] = true;
      j += i;
    }
  }

  return boring;
}


int main(){
  cin.sync_with_stdio(false);
  while(true) {
    int m, n;
    cin >> m >> n;
    if (m == 0 && n == 0) break;
    print(furui(m, n));
  }

  return 0;
}

Measured memory_bytes: 10316
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pairs;

#define MOD 998244353


ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

bool primeNumber(ll n){
    if(n < 2) return false;
    else{
        for(ll i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}


int main(){
    ll a,b,c; cin>>a>>b>>c;
    if(a<b && b<c)puts("Yes");
    else puts("No");
    return 0;
}
 
    
    



Measured memory_bytes: 3072
#include<bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 50000001
#define MOD 1000000007
typedef long long  ll;

using namespace std;

ll ans,cnt;
ll l;

int gcd(int a, int b) {
	return (b > 0) ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

int abc150func(int l, int M) {
	int i = 1;
	int res = 0;
	while (true) {
		if (l*i > M) return res;
		else {
			res++;
			i += 2;
		}
	}
}

int main() {
	ll N, M;
	cin >> N >> M;
	vector<ll> a(N);
	ll temp = 0;
	rep(i, N) {
		cin >> a[i];
		a[i] /= 2;
	}

	l = a[0];
	rep(i, N) l = lcm(l, a[i]);

	rep(i, N) {
		if (l / a[i] % 2 == 0) {
			cout << 0 << endl;
			return 0;
		}
	}
	cout << abc150func(l, M) << endl;
	// cout << M / l - M / (l << 1);
	
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;
typedef long long ll;

ll n;
char c[3] = {'3', '5', '7'};

void solve() {
  vector<string> v;
  v.push_back("375");
  int pos = 0;
  while (true) {
    int end = v.size();
    if (v[end-1].size() >= to_string(n).size()) {
      break;
    }
    for (int i=pos;i<end;i++) {
      for (int j=0;j<3;j++) {
        v.push_back(v[i] + c[j]);
      }
    }
    pos = end;
  }
  set<string> s;
  for (int i=0;i<v.size();i++) {
    sort(v[i].begin(), v[i].end());
    s.insert(v[i]);
  }

  set<ll> s2;
  for (string str : s) {
    do {
      s2.insert(stoll(str));
    } while(std::next_permutation(str.begin(), str.end()));
  }
  auto iter = s2.lower_bound(n);
  if (iter == s2.end() || *iter > n) {
    cout << distance(s2.begin(), iter) << endl;
  } else {
    cout << distance(s2.begin(), iter) + 1 << endl;
  }
}

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


Measured memory_bytes: 1536
import numpy as np
s = np.array(list(input()))
t = np.array(list(input()))
slen = len(s)
tlen = len(t)

dp = np.zeros((slen+1,tlen+1),dtype=int)

equal = (s[:,None] == t[None,:])
for i in range(slen):
    dp[i+1][1:] = np.maximum(dp[i][1:], dp[i][:-1] + equal[i])
    dp[i+1] = np.maximum.accumulate(dp[i+1])

ans = []
while dp[slen,tlen] != 0:
    if s[slen-1] == t[tlen-1]:
        ans.append(s[slen-1])
        slen -= 1
        tlen -= 1
    elif dp[slen,tlen] == dp[slen-1,tlen]:
        slen -= 1
    else:
        tlen -= 1
print("".join(ans[::-1]))

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

int main(){
    string s,t;
    cin >> s >> t;
    int cnt = 0;
    for(int i = 0 ; i < 3 ; i++){
        if(s[i] == t[i]){
            cnt++;
        }
    }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 3009 /// leave to tomorrow anything that can be done today
#define MOD 998244353
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e17 + 9;
ll dp[maxn]; ///soma i tamanho j
ll mult(ll a,ll b){
    return a*b%MOD;
}
ll fastpow(ll a, ll b){
    ll calc=1;
    for(;b>=1LL;b/=2LL){
        if((b&1LL))calc=mult(calc,a);
        a=mult(a,a);
    }
    return calc;
}
ll soma(ll a,ll b){
    if(a+b>MOD)return a+b-MOD;
    else return a+b;
}
ll subt(ll a,ll b){
    if(a-b<0)return a-b+MOD;
    else return a-b;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,s;
    cin>>n>>s;
    ll vet[maxn];
    rep(i,1,n+1){
        cin>>vet[i];
    }
    dp[0] = fastpow(2,n);
    rep(j,1,n+1){/// caras
        per(i,s+1,vet[j]){//soma 
            dp[i] = soma(mult(dp[i-vet[j]],fastpow(2,MOD-2)),dp[i]);
        }
    }
    cout<<dp[s]<<'\n';
    return 0;   
}   

Measured memory_bytes: 3636