akhauriyash/Code-Regression huggingface dataset:
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define range_for(i, b, e) for(int i=(b), i##_len=(e); i<=i##_len; ++i)
# define ALL(x) (x).begin(), (x).end()
# define RALL(x) (x).rbegin(), (x).rend()
# define pb push_back
# define len(x) ((int)(x).size())
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define debug(x) std::cerr<<#x<<": "<<(x)<<endl;
# define LINT_MAX (LONG_LONG_MAX)
# define cauto const auto
using namespace std;
using lint = long long;
template <class Type> inline constexpr bool InRange(const Type& x, const Type& i, const Type& a) { return (i <= x) && (x <= a); }
template<class Integer>bool chmax(Integer &a, const Integer &b) { if (a<b) { a=b; return 1; } return 0; }
template<class Integer>bool chmin(Integer &a, const Integer &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Integer>bool IsOdd(Integer &n) { return n & 1; }
template<class Integer>bool IsEven(Integer &n) { return !(n & 1); }
int ctoi(const char c) { return ('0' <= c && c <= '9') ? (c - '0') : -1; }
string YesNo(bool b) { return b ? "Yes" : "No"; }
string YESNO(bool b) { return b ? "YES" : "NO"; }
string yesno(bool b) { return b ? "yes" : "no"; }
static const lint MOD9 = (lint)1e9+7;
int dy[4] = {0, 1, 0, -1};
int dx[4] = {1, 0, -1, 0};

// 整数の桁数を返す ( log(N) )
template <class Integer> Integer GetDigit(Integer n) {
    Integer d = 0;
    while (n) {
        n /= 10;
        d++;
    }
    return d;
}

// 素数かどうかを返す ( O(sqrt(N)) )
template <class Integer>
constexpr bool IsPrime(const Integer n) noexcept {
    if (n < 4) return n == 2 || n == 3;
    if (n % 2 == 0 || n % 3 == 0 || (n % 6 != 1 && n % 6 != 5)) return false;
    for (Integer i = 5; i * i <= n; i += 6) if (n % i == 0 || n % (i + 2) == 0) return false;
    return true;
}


int main()
{
    int x, y, z; cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);

    cout << x << " " << y << " " << z << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i = 0;i < n; i++)
#define REP(i,n) for(int i = 1;i <= n; i++)
// ----GCC ONLY---- //
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// ----        ---- //
#define ll long long
#define MOD 10000007
#define PB push_back
 
using namespace std;


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

    if(s == "ABC")puts("ARC");
    else puts("ABC");
}

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

int main() {
    int n;
    cin >> n;
    vector<int>  management(n + 10, 0);
    for (int i = 1; i < n; i++)
    {
        int numberA;
        cin >> numberA;
        management[numberA]++;
    }
    for (int i = 1; i <= n; i++)
    {
        cout << management[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 4048
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>

#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n;i++)
#define repf(i, a, b) for (int i = (int)a; i < (int)b;i++)
#define repv(x, arr) for (auto& x:arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a,b) make_pair(a,b)
#define op(i) cout << (i) << endl;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;

const ll mod = 1e9 + 7;



int main(){
    ll a, b, x;
    cin >> a >> b >> x;
    ll aa, bb;
    if (a==0){
        aa = -1;
    }
    else{
        aa = (a - 1) / x;
    }
    bb = b / x;
    cout << bb-aa << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args)
  {
    Scanner scan =new Scanner (System.in);
    int S =  scan.nextInt();
    int W =  scan.nextInt();
    if (W>=S){
      System.out.println("unsafe");
    }else{
      System.out.println("safe");
    }
  }
}

Measured memory_bytes: 35716
#include<iostream>
#include<vector>

#define rep(i, n) for (int i = 0; i < n; i++)

using namespace std;
using ll = long long int;

int main(void) {
    string s;
    cin >> s;
    s == "ABC" ? cout << "ARC" << endl : cout << "ABC" << endl;
}

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

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))

#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define concat(xs, ys) (xs).insert((xs).end(), (ys).begin(), (ys).end())

const int mod = 1000000007;

struct mint {
    ll x;
    mint(ll x=0):x(x%mod){}

    mint& operator+=(const mint a) {
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint& operator-=(const mint a) {
        if (x < a.x) {
          x += mod;
        }
        x -= a.x;
        return *this;
    }

    mint& operator*=(const mint a) {
        x = (x * a.x) % mod;
        return *this;
    }

    mint& operator/=(const mint a) {
        *this *= a.inv();
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }

    mint pow(ll n) const {
        mint a(*this);
        mint res = 1;
        while (n > 0) {
            if (n & 1) res *= a;
            a *= a;
            n >>= 1;
        }
        return res;
    }

    mint inv() const {
        return pow(mod - 2);
    }
};

long gcd( long m, long n )
{
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

long lcm( long m, long n )
{
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n);
}


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

  long a, b;
  cin >> a >> b;
  
  cout << lcm(a, b) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const int MOD = 1000000007; 

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

int main() {
    ll a; ll b; ll c; ll d;
    cin >> a >> b >> c >> d;
    ll l = c*d/gcd(c, d);
    ll ret =  b - b /c  - b/d + b/l; 
    --a; 
    ret -= a - a/c - a/d + a/l;
    cout << ret << endl; 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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; }
template<class T, class U>T rem(T a, U b) { return a - b*floor(a/b); }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll H, W;
        cin >> H >> W;
        vector<vector<char>> pic(H, vector<char>(W));
        rep(i, 0, H) rep(j, 0, W) cin >> pic[i][j];

        rep(i, 0, H) {
                rep(j, 0, 2) {
                        rep(k, 0, W) {
                                cout << pic[i][k];
                        }
                        cout << endl;
                }
        }
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
typedef long long ll;
using namespace std;
int main(){
  ll a,b,k;
  cin>>a>>b>>k;
  ll t=min(a,k);
  a-=t;
  k=k-t;
  b=max(0ll,b-k);
  cout<<a<<" "<<b<<endl;
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const long double eps=1e-5;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

typedef vector<long double> vec;
typedef vector<vec> mat;
vec gauss_jordan(const mat &A,const vec &b){
    const int n=A.size();
    mat B(n,vec(n+1));
    for(int i=0; i<n; ++i) for(int j=0; j<n; ++j) B[i][j]=A[i][j];
    for(int i=0; i<n; ++i) B[i][n]=b[i];

    for(int i=0; i<n; ++i){
        int pivot=i;
        for(int j=i; j<n; ++j) if(abs(B[j][i])>abs(B[pivot][i])) pivot=j;
        swap(B[i],B[pivot]);

        if(abs(B[i][i])<eps) return vec();

        for(int j=i+1; j<=n; ++j) B[i][j]/=B[i][i];
        for(int j=0; j<n; ++j) if(i!=j) for(int k=i+1; k<=n; ++k) B[j][k]-=B[j][i]*B[i][k];
    }
    vec x(n);
    for(int i=0; i<n; ++i) x[i]=B[i][n];
    return x;
}

bool solve(){
    int d;
    cin >> d;
    if(!d) return false;
    mat M(d+3,vec(d+1));
    vector<long double> v(d+3);
    rep(i,0,d+3){
        rep(j,0,d+1) M[i][j]=pow(i,d-j);
        cin >> v[i];
    }

    rep(i,0,d+3) rep(j,0,d+3) if(i!=j){
        mat A;
        vec b;
        rep(k,0,d+3){
            if(k==i or k==j) continue;
            A.emplace_back(M[k]);
            b.emplace_back(v[k]);
        }
        const vec res=gauss_jordan(A,b);
        if(res==vec()) continue;

        auto ok=[&](const vec &v_,const long double x){
            long double tmp=0;
            rep(k,0,d+1) tmp+=v_[k]*res[k];
            return abs(tmp-x)<eps;
        };
        const bool f1=ok(M[i],v[i]),f2=ok(M[j],v[j]);
        if(f1 and !f2){
            cout << j << endl;
            return true;
        }
        if(!f1 and f2){
            cout << i << endl;
            return true;
        }
    }
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    cout << fixed << setprecision(8);
    while(solve());
    return 0;
}

Measured memory_bytes: 3464
#include <iostream>
#include <cstring>

using namespace std;

const int mod = 100000;

int dp[102][102][4];

int main()
{
    int w, h;
    
    while (cin >> w >> h, w) {
        memset(dp, 0, sizeof(dp));

        dp[0][1][1] = 1;
        dp[1][0][0] = 1;

        for (int i = 0; i < h; ++i) {
            for (int j = 0; j < w; ++j) {
                // k == 0: ?????????????¶?????????????
                // k == 1: ?????????????¶?????????????
                // k == 2: ??´????????????????????£???
                // k == 3: ??´????????????????????£???

                if (i - 1 >= 0) {
                    (dp[i][j][0] += dp[i - 1][j][0] + dp[i - 1][j][2]) %= mod;;
                    (dp[i][j][2] += dp[i - 1][j][1]) %= mod;
                }

                if (j - 1 >= 0) {
                    (dp[i][j][1] += dp[i][j - 1][1] + dp[i][j - 1][3]) %= mod;
                    (dp[i][j][3] += dp[i][j - 1][0]) %= mod;
                }
            }
        }

        int ans = 0;

        for (int i = 0; i < 4; ++i) ans += dp[h - 1][w - 1][i];

        ans %= mod;
        cout << ans << endl;
    }
}

Measured memory_bytes: 3236
class Node
  attr_accessor :id, :left, :right, :parent
  def initialize(input)
    @id, @left, @right = input
    @parent = nil
  end
end

class Binary_tree
  def initialize(n, inputs)
    #nodesを生成
    @nodes = inputs.inject({}) do |memo, input|
      memo[input[0]] = Node.new(input)
      memo
    end

    #left, rightにポインタを代入
    @nodes.each do |key, node|
      @nodes[key].left = (@nodes[key].left != -1 ? @nodes[@nodes[key].left] : nil)
      @nodes[key].right = (@nodes[key].left != -1 ? @nodes[@nodes[key].right] : nil)
    end

    @root = get_root()
  end

  def get_root
    @nodes.each do |key, node|
      if @nodes[key].left
        @nodes[key].left.parent = @nodes[key]
      end

      if @nodes[key].right
        @nodes[key].right.parent = @nodes[key]
      end
    end

    @nodes.each do |key, node|
      if !node.parent
        return key
      end
    end
  end


  def preorder(node)
    if node == nil
      return
    end
    print " %d" % [node.id.to_s]
    preorder(node.left)
    preorder(node.right)
  end

  def inorder(node)
    if node == nil
      return
    end
    inorder(node.left)
    print " %d" % [node.id.to_s]
    inorder(node.right)
  end

  def postorder(node)
    if node == nil
      return
    end
    postorder(node.left)
    postorder(node.right)
    print " %d" % [node.id.to_s]
  end

  def run
    #p @nodes
    puts "Preorder"
    preorder(@nodes[@root])
    print "\n"

    puts "Inorder"
    inorder(@nodes[@root])
    print "\n"

    puts "Postorder"
    postorder(@nodes[@root])
    print "\n"
  end
end

n = gets.to_i
inputs = Array.new(n){gets.split.map(&:to_i)}
Binary_tree.new(n, inputs).run


Measured memory_bytes: 8892
#include<iostream>
#include<algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <sstream>

using namespace std;
typedef long long ll;

int main() {
	cin.sync_with_stdio(0); cin.tie(0); cout.tie(NULL);
	
	string s, t; cin >> s >> t;
	int ans = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != t[i]) {
			ans += 1;
		}
	}
	cout << ans << '\n';



}

Measured memory_bytes: 3376
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		int x = scan.nextInt();
		int y = scan.nextInt();
   
		if(x+y <10){
			System.out.println(x+y);
		} else if(x+y>=10){
			System.out.println("error");
		}
	}

}


Measured memory_bytes: 21844
#設定
import sys
input = sys.stdin.buffer.readline
con = 998244353

#ライブラリインポート
from collections import defaultdict

#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	D = getlist()
	M = max(D)
	dic = defaultdict(int)
	for i in D:
		dic[i] += 1
	if D[0] != 0 or dic[0] >= 2:
		print(0)
	else:
		ans = 1
		for i in range(M):
			x = dic[i]
			y = dic[i + 1]
			for j in range(y):
				ans = ans * x
				ans %= con
		print(ans)
	
if __name__ == '__main__':
	main()

Measured memory_bytes: 20428
#include <stdio.h>
#include <string.h>

#define Length 1000

int LSCLength(char *,char*);

int main(){

   int i;
   int n;
   int match;
  char X[Length];
  char Y[Length];
  
  scanf("%d",&n);

  for(i=0;i<n;i++){
  scanf("%s %s",X+1,Y+1);
  match = LSCLength(X ,Y);
  printf("%d\n",match);
  }

  return 0;
}

int LSCLength(char *X,char *Y){

  int i;
  int j;
  int m;
  int n;
  int c[Length+1][Length+1];

  m = strlen(X+1);
  n = strlen(Y+1);
  
  for(i=1;i<=m;i++){
    c[i][0] = 0;
  }

  for(j=0;j<=n;j++){
    c[0][j] = 0;
  }

  for(i=1;i<=m;i++){
   for(j=1;j<=n;j++){
      if(X[i] == Y[j]){
     c[i][j] = c[i-1][j-1] + 1;
  }
      
  else if(c[i-1][j] >= c[i][j-1] ){
     c[i][j] = c[i-1][j];
  }

  else{
    c[i][j] = c[i][j-1];
  }
      
   }
  }
   return c[m][n];
} 

Measured memory_bytes: 4520
#include<bits/stdc++.h>
using namespace std;
#define ff(i,n) for(i=0;i<n;i++)
#define ll long long int
#define pb push_back
#define mp make_pair
ll bg=998244353;
void updateBIT(ll BITree[], ll n, ll index, ll val) 
{ 
    index = index + 1; 
    while (index <= n) 
    { 
        BITree[index] += val; 
        index += index & (-index); 
    } 
} 
ll *constructBITree(ll arr[], ll n) 
{ 
    ll *BITree = new ll[n+1]; 
    for (ll i=1; i<=n; i++) 
        BITree[i] = 0; 
    for (ll i=0; i<n; i++) 
        updateBIT(BITree, n, i, arr[i]); 
    return BITree; 
} 
ll getSum(ll BITree[], ll index)  
{
	ll sum =0;
    index = index + 1; 
    while (index>0) 
    { 
        sum += BITree[index]; 
        index -= index & (-index); 
    } 
    return sum; 
} 
void update(ll BITree[], ll l, ll r, ll n, ll val) 
{ 
    updateBIT(BITree, n, l, val); 
    updateBIT(BITree, n, r+1, -val); 
} 
ll gcd(ll n1, ll n2) {
    if (n2 != 0)
        return gcd(n2, n1 % n2);
    else
        return n1;
}
int main()
{
    ll t;
    t=1;
    while(t--)
    {
    	ll i,j,n,q,a,b;
    	cin>>n>>a;
    	ll a1=(n*(n-1))/2,a2=(a*(a-1))/2;
		ll ss =a1+a2;
		cout<<ss; 
    }
    return 0;
}

Measured memory_bytes: 256
import math
import sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from functools import lru_cache, reduce
from heapq import heapify, heappop, heappush
from itertools import chain, combinations, permutations, product
from typing import List, Dict

# import numpy as np

sys.setrecursionlimit(10**5 + 1)
input = sys.stdin.readline
write = sys.stdout.write


def read_item(cls=int):
    return cls(input())


def read_n_item(cls=int) -> list:
    return [cls(s) for s in input().split()]


def list2d(row, col, init_val=0) -> List[list]:
    return [[init_val] * col for _ in range(row)]


MOD = 10**9 + 7
# MOD = 998244353


k = read_item()
a, b = read_n_item()

for i in range(a, b+1):
    if i % k == 0:
        print('OK')
        break
else:
    print('NG')




Measured memory_bytes: 10272
#include <cmath>
#include <cstdio>
int n, s, p[1000]; double d;
int main() {
	while(~scanf("%d", &n)) {
		if(n == 0) break; d = 0, s = 0;
		for(int i = 0; i < n; i++) scanf("%d", &p[i]), s += p[i];
		for(int i = 0; i < n; i++) {
			d += (p[i] - 1.0 * s / n) * (p[i] - 1.0 * s / n);
		}
		printf("%.9f\n", sqrt(d / n));
	}
	return 0;
}

Measured memory_bytes: 2664
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	b=0;
	c=0;
	for(int i=0;i<3;i++){
		cin>>a;
		if(a==7){
			b=b+1;
		}else if(a==5){
			c=c+1;
		}
	}
	if(b==1&&c==2){
		cout<<"YES";
	}else{
		cout<<"NO";
	}
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 1; i < (n); ++i)
#define REP2(i, n) for (int i = 2; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  int x;
  cin >> x;
  int mx = 0;
  REP(i,1000){
	REP2(j,1000){
      ll n1 = pow(i,j);
      if(n1 >= mx && n1 <= x){
        mx = n1;
      }
    }
  }
                                       
  cout << mx << endl;                                     
}

Measured memory_bytes: 4188
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const int INF (1 << 30);
const ll LLINF (1LL << 55LL);
const int MOD = 1000000007;
const int MAX = 510000;
const double pi = acos(-1);
const double eps = 1e-9;


struct UnionFind {
    vector<ll> par;
        
    UnionFind(ll n) : par(n, -1) { }
    void init(ll n) { par.assign(n, -1); }
    
    ll find(ll x) {
        if (par[x] < 0) return x;
        else return par[x] = find(par[x]);
    }
    
    bool same(ll x, ll y) {
        return find(x) == find(y);
    }
    
    bool unite(ll x, ll y) {
        x = find(x); y = find(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    ll size(ll x) {
        return -par[find(x)];
    }

    void print(ll x){
        rep(i,x){
            cout<<par[i]<<endl;
        }
        return ;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,m,v[100010];
    cin>>n>>m;
    vll l[100010];
    UnionFind uf(n);
    vector<pll> G;

    rep(i,n){
        cin>>v[i];
        rep(j,v[i]){
            ll b;
            cin>>b;
            l[b].push_back(i);
        }
    }
    rep2(i,1,m+1){
        if(l[i].size()<=1) continue;
        rep(j,l[i].size()){
            if(j==l[i].size()-1) continue;
            uf.unite(l[i][j],l[i][j+1]);
        }
    }
    if(uf.size(0)==n) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define LLINF (1e18)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

using P = pair<int, int>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<vector<P>> graph(n);
    for (int i = 0; i < m; i++)
    {
        int l, r, d;
        cin >> l >> r >> d;
        l--;
        r--;
        graph[l].push_back(P(r, d));
        graph[r].push_back(P(l, -d));
    }

    vector<bool> seen(n, false);
    vector<int> dist(n, INF);

    stack<P> st;
    bool flg = true;

    for (int i = 0; i < n; i++)
    {
        if (!seen[i])
        {
            st.push(P(i, 0));
        }

        while (!st.empty())
        {
            P p = st.top();
            st.pop();
            seen[p.first] = true;
            if (p.second != dist[p.first] && dist[p.first] != INF)
            {
                flg = false;
            }
            else
            {
                dist[p.first] = p.second;
            }

            for (auto v : graph[p.first])
            {
                if (!seen[v.first])
                {
                    st.push(P(v.first, v.second + dist[p.first]));
                }
            }
        }
    }
    string ans = flg ? "Yes" : "No";
    cout << ans << endl;
}

Measured memory_bytes: 10112
#include<bits/stdc++.h>
#define U [7<<15]={}
#define G )+((c=A[a]+A[P[a]]+C[a])%k?c:0)-M(
typedef long long L;using namespace std;map<L,L>T U;L P U,E U,Z U,H U,C U,A U,O U,X U,B U,k,n,a,b,c;char s U;L M(L f){return f?B[f]+M(f^f&-f):0;}L S(L a,L i){for(a=M(i++G i);i<2e5;i+=i&-i)B[i]+=a;}L D(L f){L d;for(map<L,L>::iterator I=T[f].begin();I!=T[f].end();I++)d=I->first,!Z[d]?P[d]=f,E[d]=E[f]+1,C[d]=I->second,Z[d]=1,D(d),Z[f]+=Z[d],Z[H[f]]<Z[d]?H[f]=d:0:0;}L K(L f){a=X[f];n=X[b];return a-n?M(O[E[a]<E[n]?a=n,n=b,b=f,n:f]G O[a])+K(P[a]):abs(M(O[f])-M(O[b]));}main(){for(cin>>n>>k;--*Z,--n;T[a][b]=T[b][a]=c)cin>>a>>b>>c;for(D(a=0);Z[n];a=H[P[++n]]-n?n:0)for(;!O[a];S(a=H[a],O[a]=++b))X[a]=n;for(cin>>a;cin>>s>>a>>b;S(H[a],O[a]),S(a,O[a]-1))*s&2?cout<<K(a)<<endl,0:A[a]+=b;}

Measured memory_bytes: 38104
import java.util.*;
public class Main {
	public static void main(String[] args) {
		C();
	}
	
	public static void A() {
		Scanner sc = new Scanner(System.in);
		Integer n = sc.nextInt();
		sc.close();
		String num = n.toString();
		if(num.charAt(1) != num.charAt(2)) {
			System.out.println("No");
			return;
		}
		char mid = num.charAt(1);
		if(mid == num.charAt(0) || mid == num.charAt(3)) {
			System.out.println("Yes");
		}
		else System.out.println("No");
	}
	
	public static void B() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if(N==1) {
			System.out.println(1);
			return;
		}
		sc.close();
		long Li = 2;
		long Lj = 1;
		long temp;
		for(int i=2;i<N+1;i++) {
			temp = Lj;
			Lj = Li+Lj;
			Li = temp;
		}
		System.out.println(Lj);
	}
	
	// 条件満たす演算子があれば、そのリストを返す、なければnull
	// 1 + 2 - 3 =  ->  1 + 2 | -3 ..後ろから切っていく
	public static void C() {
		Scanner sc = new Scanner(System.in);
		String num = sc.next();
		int[] nums = new int[4];
		for(int i=0;i<4;i++) {
			nums[i] = Character.getNumericValue(num.charAt(i)); 
		}
		ArrayList<Character> lis = calc(nums,7);
		System.out.print(nums[0]);
		for(int i=0;i<3;i++) {
			System.out.print(lis.get(i)+ "" +nums[i+1]);
		}
		System.out.println("=7");
	}
	public static ArrayList<Character> calc(int[] nums, int right) {
		return calc(nums,nums.length-1,right,new ArrayList<Character>());
	}
	public static ArrayList<Character> calc(int[] nums, int idx, int right, ArrayList<Character> lis) {
		if(idx == 0) {
			if(nums[0] == right) return lis;
			else return null;
		}
		ArrayList<Character> cand1 = calc(nums,idx-1,right+nums[idx],lis);
		if(cand1 != null) {
			cand1.add('-');
			return cand1;
		}
		ArrayList<Character> cand2 = calc(nums,idx-1,right-nums[idx],lis);
		if(cand2 != null) {
			cand2.add('+');
			return cand2;
		}
		return null;
	}
	
}


Measured memory_bytes: 23124
import sys
input = sys.stdin.readline
w,h = map(int,input().split())
a = [10**18]+[int(input()) for i in range(w)]
b = [10**18]+[int(input()) for i in range(h)]
a.sort(reverse=True)
b.sort(reverse=True)
ans = 0
while len(a)>1 or len(b)>1:
  if a[-1]<b[-1]:
    ans += a[-1]*len(b)
    a.pop()
  else:
    ans += b[-1]*len(a)
    b.pop()
print(ans)

Measured memory_bytes: 49756
# -*- coding:utf-8 -*-
"""解説
Union-Find

i番目の辺(ai, bi)を除く全ての辺を使ってUnion-Find木を作る。

その後、ai と bi がつながっているかを判定する。つながっていないならば、ai,biの辺は橋である。

この操作をすべてのiにおいて全探索する。

【計算量】
たぶんO(NM)

Union-Findによるあるノード(a, b)が同じグループかどうか（今回では、同じグループ＝繋がっている）
の判定は高速でできる。

"""
class UnionFind():
    def __init__(self, N):
        """ N個のノードのUnion-Find木を作成する """
        # 親の番号を格納する。自分が親だった場合は、自分の番号になり、それがそのグループの番号になる
        self.parent = [n for n in range(0, N)]
        # グループの深さ
        self.depth = [1] * N

    def find(self, x):
        """ 木の根(どのグループか)を求める """
        if self.parent[x] == x: return x
        self.parent[x] = self.find(self.parent[x]) # 縮約
        return self.parent[x]

    def unite(self, x, y):
        """ xとyの属する集合を併合する """
        gx = self.find(x)
        gy = self.find(y)
        if gx == gy: return

        # 小さい方を大きい方に併合させる（木の偏りが減るので）
        if self.depth[gx] < self.depth[gy]:
            self.parent[gx] = gy
        else:
            self.parent[gy] = gx
            if self.depth[gx] == self.depth[gy]: self.depth[gx] += 1

    def is_same_group(self, x, y):
        """ xとyが同じ集合に属するか否か """
        return self.find(x) == self.find(y)


def solve():
    N, M = list(map(int, input().split()))
    edges = []

    for i in range(M):
        a, b = list(map(int, input().split()))
        edges.append([a-1, b-1])

    # 各辺について、その辺が存在しない時、aとbが連結になるかをUnion-Findで判定する
    ans = 0
    for i in range(M):
        uf = UnionFind(N)
        for j, edge in enumerate(edges):
            if i == j: continue
            
            a, b = edge
            uf.unite(a, b)
        
        # i番目の辺を除くすべての辺をつないだあとで、i番目の辺(a, b)がつながるかを判定する
        # つながらないならば、そのi番目の辺は橋である
        a, b = edges[i]
        if not uf.is_same_group(a, b): ans += 1
    
    print(ans)
    

if __name__ == "__main__":
    solve()


Measured memory_bytes: 3064
import java.util.*;
import java.util.Vector;
import java.math.*; 
public class Main {
     Scanner sc = new Scanner(System.in);
	//	System.out.println( );
	
	
	
	void run(){ // kokonikaku
		int n=sc.nextInt();
		int k=sc.nextInt();
		
		
		String s=sc.next();
		
		int l=s.length();
		List<Integer> ve1 = new ArrayList<Integer>();
		List<Integer> ve0 = new ArrayList<Integer>();
		if(s.charAt(0)=='0') ve1.add(0);
		
		for(int i=0;i<l;i++){
			if(i==0){
				if(s.charAt(i)=='0'){
					ve0.add(1);
				}
				else{
					ve1.add(1);
				}
			}
			else if(s.charAt(i-1)=='0' &&s.charAt(i)=='0'){
				ve0.set(ve0.size()-1,ve0.get(ve0.size()-1)+1);
			}
			
			else if(s.charAt(i-1)=='1' &&s.charAt(i)=='1'){
				ve1.set(ve1.size()-1,ve1.get(ve1.size()-1)+1);
			}
			
			else if(s.charAt(i-1)=='0' &&s.charAt(i)=='1'){
				ve1.add(1);
			}
			
			else if(s.charAt(i-1)=='1' &&s.charAt(i)=='0'){
				ve0.add(1);
			}
		}
		if(s.charAt(l-1)=='0')ve1.add(0);
		
		int g=ve0.size();
		
	//	System.out.println(ve0);
	//	System.out.println(ve1);
		
		int ans=0;
		
		List<Integer> rui1 = new ArrayList<Integer>();
		List<Integer> rui0 = new ArrayList<Integer>();
		
		rui0.add(0);
		rui1.add(0);
		for(int i=0;i<g;i++){
			rui0.add(rui0.get(i)+ve0.get(i));
		}
		
		for(int i=0;i<=g;i++){
			rui1.add(rui1.get(i)+ve1.get(i));
		}
		
		if(g<=k){
			ans=l;
		}
		else{
			for(int i=k;i<=g;i++){
				int t1=rui0.get(i)-rui0.get(i-k);
				int t2=rui1.get(i+1)-rui1.get(i-k);
				ans=Math.max(ans,t1+t2);
			}
		}
		System.out.println(ans);
	}

	
	public static void main(String[] args) {
		new Main().run();
        
    }
}

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

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2767>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

ll solve(){
    ll res = 0;
    ll N; cin >> N;
    string S; cin >> S;
    vector<int> alpha;
    for(int i = 0; i < 26;i++){
        int x = (int)count(S.begin(),S.end(),'a'+i);
        if(x == 0) continue;
        alpha.push_back(x);
    }
    sort(alpha.begin(),alpha.end());
    ll len0 = INF, len1 = 0;
//    for(auto v:alpha){
//        if(v == 1) len0 += 1;
//        else len0 += 3;
//    }
//    len0 += alpha.size()-1;
//
    for(int x = 1; x <= 9; x++){
        int y = (int)count(alpha.begin(),alpha.end(),x);
        if(y == 0) continue;
        if(x == 1){
            len1 += (2*y-1);
        }else{
            if(y == 1){
                len1 += 3*y;
            }else{
                len1 += (4+2*y-1);
            }
        }
    }
    alpha.erase(unique(alpha.begin(),alpha.end()),alpha.end());
    len1 += alpha.size()-1;
    res = min(len0,len1);
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}



Measured memory_bytes: 3208
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int INF = 1e10;
const long double PI = (acos(-1));


signed main() {
	int M, D;
	cin >> M >> D;
	int ans = 0;
	for (int m = 1; m <= M; m++) {
		for (int d1 = 2; d1 <= 9; d1++) {
			for (int d10 = 2; d10 <= 9; d10++) {
				int day = d1 + d10 * 10;
				if (day > D)break;
				if (d1 * d10 == m)ans++;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int a, b;
    scanf("%d", &a);
    b = (a % 10);
    a -= b;
    if (b==2 || b==4 || b==5 || b==7 || b==9){
        printf("hon");
    }
    else if (b==0 || b==1 || b==6 || b==8){
        printf("pon");
    }
    else
    {
        printf("bon");
    }
    return 0;
    
}    

Measured memory_bytes: 1728
//AGC037A
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main(){
	char s[1000000];
	scanf("%s",s);
	long long int num;
	num = strlen(s);
	long long int i=0;
	long long int count=0ll;
	while(i<num-1){
		if(s[i]==s[i+1]){
			count++;
			i = i + 3;
		}else{
			count = count;
			i = i + 1;
		}
	}
	printf("%lld",num-count);
}

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

int main()
{
    int a,b,c,x;
    cin>>a>>b>>c;
        if(a>=(b+c))
        {
            x=0;
            printf("%d\n",x);
        }
        else
        {
            x=(b+c)-a;
            printf("%d\n",x);
        }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e+14
#define int long long
using namespace std;

struct edge{int to,cap,rev; };

vector<edge> G[120];
int level[120],iter[120];

void add_edge(int from,int to,int cap){
	G[from].push_back((edge){to,cap,G[to].size()});
	G[to].push_back((edge){from,0,G[from].size() - 1});
}

void bfs(int s){
	memset(level,-1,sizeof(level));
	queue<int> que;
	level[s] = 0;
	que.push(s);
	while(!que.empty()){
		int v = que.front();que.pop();
		for(int i = 0;i < G[v].size();i++){
			edge &e = G[v][i];
			if(e.cap > 0 && level[e.to] < 0){
				level[e.to] = level[v] + 1;
				que.push(e.to);
			}
		}
	}
}

int dfs(int v,int t,int f){
	if(v == t) return f;
	for(int &i = iter[v];i < G[v].size();i++){
		edge &e = G[v][i];
		if(e.cap > 0 && level[v] < level[e.to]){
			int d = dfs(e.to,t,min(f,e.cap));
			if(d > 0){
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s,int t){
	int flow = 0;
	while(1){
		bfs(s);
		if(level[t] < 0) return flow;
		memset(iter,0,sizeof(iter));
		int f;
		while((f = dfs(s,t,INF)) > 0) flow += f;
	}
}

signed main(){
	int n,sum = 0;
	cin >> n;
	for(int i = 1;i <= n;i++){
		int a;
		cin >> a;
		if(a > 0){
			sum += a;
			add_edge(0,i,0);
			add_edge(i,n + 1,a);
		}else{
			add_edge(0,i,-a);
			add_edge(i,n + 1,0);
		}
		for(int j = i * 2;j <= n;j += i) add_edge(i,j,INF);
	}
	cout << sum - max_flow(0,n + 1) << endl;
	return 0;
}

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

void solve(long long N, std::vector<long long> A)
{
    ll head = 0;
    ll tail = 0;
    bool nobasu = true;
    ll Axor_sum = 0;
    ll Asum = 0;
    ll ans = 0;
    while (head < N) {
        if (nobasu) {
            Axor_sum ^= A[tail];
            Asum += A[tail];
            tail++;
            if (Axor_sum == Asum) {
                ans += tail - head;
                if (tail == N) {
                    break;
                }
            } else {
                nobasu = false;
            }
        } else {
            Axor_sum ^= A[head];
            Asum -= A[head];
            head++;
            if (head == tail || Axor_sum == Asum) {
                ans += tail - head;
                if (tail == N) {
                    break;
                }
                nobasu = true;
            }
        }
    }
    cout << ans << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int s=S.size();
  long long ans=0;
  vector<long long> w(12),e(10);
  w[0]=1; e[0]=1;
  for(int i=1;i<=11;i++){w[i]=w[i-1]*2;}
  for(int i=1;i<=9;i++){e[i]=e[i-1]*10;}
  reverse(S.begin(),S.end());
  for(int i=0;i<s;i++){
    int q=S[i]-'0';
    long long t=0;
    for(int j=i;j>=0;j--){t+=q*e[j]*w[max(0,i-j-1)];}
    ans+=t*w[s-i-1];
    //cout << ans << endl;
  }
  cout << ans << endl;
}

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

int main() {
	int n, k;
	cin>>n>>k;
	int arr[n];
	int sum=0;
	for(int i=0; i<n; i++){
		cin>>arr[i];
		sum+=arr[i];
	}
	for(int i=sum; i>=1; i--){
		if(sum%i!=0){
			continue;
		}
		int b[n];
		for(int j=0; j<n; j++){
			b[j]=arr[j]%i;
		}
		sort(b, b+n);
		int sum2=0;
		for(int j=0; j<n; j++){
			sum2+=b[j];
		}
		int num=sum2/i;
		int val=0;
		for(int j=n-1; j>=n-num; j--){
			val+=b[j];
		}
		int rem=sum2-val;
		if(rem<=k){
			cout<<i;
			return 0;
		}
	}
	return 0;
}

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

const int MAX_N =  102, MAX_K = 1e5+2;
int N, K;
int a[MAX_N];
bool dp[MAX_K];

void solve()
{
	for(int i=0;i<=K;++i){
		dp[i] = false;
		for(int j=0;j<N;++j)if(i>=a[j]&&!dp[i-a[j]]){
			dp[i]=true;
			break;
		}	
	}
	if(dp[K]) cout << "First\n";
	else cout << "Second\n";
}

int main()
{
	cin >> N >> K;
	for(int i=0;i<N;++i) cin >> a[i];
	solve();
	return 0;
}

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

#define ll long long

const int mxN=3e3, M=1e9+7;
int n;
string s;
ll dp[mxN][mxN];

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

	cin >> n >> s;
	dp[0][0]=1;
	for(int i=0; i<n-1; ++i) {
		if(s[i]=='<') {
			for(int j=1; j<=i; ++j)
				dp[i][j]=(dp[i][j]+dp[i][j-1])%M;
			for(int j=1; j<=i+1; ++j)
				dp[i+1][j]=dp[i][j-1];
		} else {
			for(int j=i; j>=0; --j)
				dp[i][j]=(dp[i][j]+dp[i][j+1])%M;
			for(int j=0; j<=i; ++j)
				dp[i+1][j]=dp[i][j];
		}
	}
	ll ans=0;
	for(int i=0; i<n; ++i)
		ans+=dp[n-1][i];
	cout << ans%M;
}


Measured memory_bytes: 68864
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		String s = sc.next();
		for(int i = 0; i < s.length() / 2; i++) {
			if(s.charAt(i) != s.charAt(s.length() - 1 - i))
				ans++;
		}
		System.out.println(ans);

	}

}


Measured memory_bytes: 21716
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

#include <stack>
#include <queue>
#include <algorithm>
#include <vector>
#include <list>
using namespace std;

typedef pair<int,int> P;
typedef long long lint;

#define MAXN 500005
int n,cnt;
int a[MAXN],b[MAXN];
void get_input() {
    scanf("%d",&n);
    for(int i=0;i<n;i++) scanf("%d",&a[i]);
}
// ?量cnt用来?“比?次数”，?目中表述不是很明?
void merge(int beg,int end) {
    if(beg>=end) return;
    int mid=(beg+end)>>1;
    merge(beg,mid);
    merge(mid+1,end);
    int i,j,k;
    for(i=beg,j=mid+1,k=beg;i<=mid && j<=end;k++) {
        cnt++;
        if(a[i]<a[j]) {
            b[k]=a[i++];
        } else {
            b[k]=a[j++];
        }
    }
    for(;i<=mid;i++) {
        cnt++;
        b[k++]=a[i];
    }
    for(;j<=end;j++) {
        cnt++;
        b[k++]=a[j];
    }
    memcpy(a+beg,b+beg,sizeof(int)*(end-beg+1));

}

void solve() {
    merge(0,n-1);
}

void display_output() {
    printf("%d",a[0]);
    for(int i=1;i<n;i++) printf(" %d",a[i]);
    printf("\n%d\n",cnt);
}

int main() {
#ifdef debug
    freopen("in.txt","r",stdin);
#endif
    get_input();
    solve();
    display_output();
}

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

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

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



int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int  n;
	cin >>n;
	VI a(n), b(n);
	rep(i, n) cin >>a[i] >>b[i];
	sort(all(a)); sort(all(b));
	
	if(n&1){
		cout <<  b[n/2] - a[n/2] +1 <<"\n";
	}else{
		cout<<  b[n/2] + b[n/2-1] - a[n/2] - a[n/2-1] +1 <<"\n";
	}
	return 0;
}


Measured memory_bytes: 4776
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp10
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            string[] strArray = str.Split(' ');

            int k = int.Parse(strArray[0]);
            int x = int.Parse(strArray[1]);

            int min = x - k + 1;
            
            int max = x + k - 1;

            for (int ans = min; ans <= max; ans++)
                Console.Write(ans + " ");
            Console.WriteLine();
        }
    }
}

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

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define REP(i,n)  for(int i=0;i<(n);i++)

void trace(int a[], int n){
    REP(i, n){
        if(i>0)printf(" ");
        printf("%d",a[i]);
    }
}

int bubbleSort(int a[],int n){
    bool flag = 1;
    int i = 0,cnt=0;
    while(flag){
        flag = 0;
        for(int j=n-1;j>=i+1;j--){
            if(a[j]<a[j-1]){
                swap(a[j],a[j-1]);
                flag = 1;
                cnt++;
            }
        }
        i++;
    }
    return cnt;
}

int main(){
    int a[100],n,cnt;
    cin>>n;
    REP(i, n)cin>>a[i];
    
    cnt = bubbleSort(a, n);
    
    REP(i, n){
        if(i)cout<<" ";
        cout<<a[i];
    }
    
    cout<<endl;
    cout<<cnt<<endl;
    
    return 0;
}


Measured memory_bytes: 3088
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define lb long double
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define mod 1000000007LL
#define INF 1234567890123456
typedef pair<int, int> P;
typedef pair<int, P> PP;

const int maxn =1e3 + 10;

//initialization here
//
int l[201];
//
//initialization finish


// your function is here
//
ll solve(ll a, ll b)
{
	if (a%b==0) return 2*a-b;

	return 2 * (a / b) * b+solve(b, a%b);
}
//
// your function finished



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	// your code is here
	//
	ll n, x; cin >> n >> x;

	ll dai = max(x, n - x);
	ll syou = min(x, n - x);

	
	Print(n+solve(dai,syou));

	//
	// your code finished


	return 0;
}

Measured memory_bytes: 256
import sys
inp = sys.stdin.readline

S = inp().replace('\n', '')
a, b, c, d = S[0], S[1], S[2], S[3]

ops = ['+', '-']
for op1 in ops:
  for op2 in ops:
    for op3 in ops:
      tmp = a + op1 + b + op2 + c + op3 + d
      if(eval(tmp) == 7):
        print(tmp + '=7')
        exit()

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<vector<int> > num(n+1, vector<int>(n+1, 0));
        for(int i=0; i<n; ++i){
            for(int j=0; j<n; ++j){
                cin >> num[i][j];
                num[i][n] += num[i][j];
                num[n][j] += num[i][j];
                num[n][n] += num[i][j];
            }
        }

        for(int i=0; i<=n; ++i){
            for(int j=0; j<=n; ++j){
                cout << setw(5) << num[i][j];
            }
            cout << endl;
        }
    }
}

Measured memory_bytes: 0