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

typedef long long ll;

const int MOD = 1e9 + 7;
const int INF = 0x3F3F3F3F;
const ll INFLL = 0x3F3F3F3F3F3F3F3FLL;

int main(){
	
	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	
	int n, a, b;
	cin >> n >> a >> b;
	
	int d = (abs(b-a));
	
	if(d & 1) cout << "Borys\n";
	else cout << "Alice\n";
	
	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("atcoder-problems/agc005_a.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cout << v[l] << " "; } \
cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  string S;
  cin >> S;
  int N = S.size();

  ll ans = 0;
  int cur = 0;
  rep(i, N) {
    if (S[i] == 'S') {
      cur++;
    } else {
      if (cur > 0) {
        cur--;
      } else {
        ans += 2;
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3768
from collections import Counter
N = int(input())
Alist = list(map(int, input().split()))
Ac = Counter(Alist)
mod = 10**9+7
if N%2==0:
    for i in range(1, N, 2):
        if Ac[i] != 2:
            print(0)
            break
    else:
        print(pow(2, (N//2), mod))
else:
    if Ac[0] != 1:
        print(0)
    else:
        for i in range(2, N, 2):
            if Ac[i] != 2:
                print(0)
                break
        else:
            print(pow(2, (N//2), mod))


Measured memory_bytes: 14820
A, B, C, X, Y = tuple(map(int, input().split()))

def money(A, B, C, X, Y):
    
    axby = A*X + B*Y
    if max([A, B, C]) == C:
        return axby
    
    cxy = C*max([X,Y])*2
    if X < Y:
        abcxy = C*X*2 + (Y-X)*B
    else:
        abcxy = C*Y*2 + (X-Y)*A
    
    return min([axby, cxy, abcxy])
  
print(money(A, B, C, X, Y))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;} 


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

int A, B; cin >> A >> B;

VS ans{""};
rep(i, 0, 100) ans[0].push_back('#');
rep(i, 0, 49) ans.push_back(ans[0]);
ans.push_back("");
rep(i, 0, 100) ans[50].push_back('.');
rep(i, 0, 49) ans.push_back(ans[50]);

--A;
for(int h = 0; h < 49; h += 2)
    for(int w = 0; w < 100; w += 2, A--) if (A > 0)
        ans[h][w] = '.';

--B;
for(int h = 99; h > 50; h -= 2)
    for(int w = 99; w >= 0; w -= 2, B--) if (B > 0)
        ans[h][w] = '#';


cout << ans.size() << ' ' << 100 << "\n";
for(string s: ans) cout << s << "\n";

return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 問題文から考える。自分ができることから考える。
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索。逆から考える。
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

	int n; cin >> n;
	std::cout << std::setprecision(10) << ((n - n / 2) / (double) n) << endl;;
	return 0;
}

Measured memory_bytes: 256
N, Y = map(int, input().split())

count = 0

for x in range(N+1):
    for y in range(N+1):
        z = N - x - y
        
        if 10000*x + 5000*y + 1000*z == Y and z>=0:
            count += 1
            if count == 1:
                print(x,y,z)

if count == 0 :
    print(-1,-1,-1)

Measured memory_bytes: 3064
import sys
from heapq import *

H,W=map(int,input().split())
si,sj=[int(x)-1 for x in input().split()]
ti,tj=[int(x)-1 for x in input().split()]
A=list(sys.stdin)

ans=-1
hp=[(0,si,sj)]
dirs=[-2,-1,0,1,2]
dist=[[float('inf')]*W for _ in range(H)]
dist[si][sj]=0
while hp:
    k,i,j=heappop(hp)
    if i==ti and j==tj:
        ans=k
        break
    if k>dist[i][j]:
        continue
    for di in dirs:
        for dj in dirs:
            if di==dj==0:
                continue
            ni,nj=i+di,j+dj
            if not (0<=ni<H and 0<=nj<W):
                continue
            if A[ni][nj]=='#':
                continue
            if abs(di)+abs(dj)==1:
                nk=k
            else:
                nk=k+1
            if nk>=dist[ni][nj]:
                continue
            dist[ni][nj]=nk
            heappush(hp,(nk,ni,nj))

print(ans)


Measured memory_bytes: 130740
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dunk(n) cout << n << endl
int main() {
  int n,m;
  cin >> n >> m;
  vector<int> road1(m), road2(m), city(n);
 
  rep(i,n){ // i番目の都市について
    city[i] = 0;
    rep(j,m){ // j番目の道路について
      cin >> road1[j] >> road2[j];
      if(road1[j] == i+1) city[i]++;
      if(road2[j] == i+1) city[i]++;
    }
    dunk( city[i] );
  }
}
      
  
  

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>

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

    int cnt = 0;

    std::string ss[2];
    for (int i = 0; i < 2; ++i)
    {
        std::string str;
        ss[i].resize(S.length());
        for (int j = 0; j < S.length(); ++j)
        {
            char c = ((i + j) % 2 == 0 ? '0' : '1');
            str += c;
        }
        ss[i] = str;
    }

    int cnt1 = 0;
    for (int i = 0; i < S.length(); ++i)
    {
        if (S[i] != ss[0][i])
        {
            cnt++;
        }
        if (S[i] != ss[1][i])
        {
            cnt1++;
        }
    }


    std::cout << (cnt < cnt1 ? cnt : cnt1) << std::endl;

    return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //NOTE: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7


/*********** variables ************/
string O, E;
/**********************************/

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

    REP(i, E.size()) {
        cout << O[i] << E[i];
    }
    if(O.size()>E.size()) cout << O[O.size()-1];
    cout << endl;
}


Measured memory_bytes: 256
#ifdef OJ_MISC_OFFLINE

#include "prolog.h"

#else
#define LOG
#define PRINT
#define LCERR
#include <iostream>
auto optimize_cpp_stdio = []() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::setvbuf(stdout, nullptr, _IOFBF, BUFSIZ);
    return 0;
}();
#endif

#include <algorithm>
#include <array>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>

namespace {

using namespace std;

class Solution {
public:
    int64_t lazy_faith(const vector<int64_t>& shrines, const vector<int64_t>& temples, int64_t x) {
        auto east_shrine_idx = lower_bound(shrines.begin(), shrines.end(), x) - shrines.begin();
        auto east_temple_idx = lower_bound(temples.begin(), temples.end(), x) - temples.begin();
        int64_t min_distance = numeric_limits<int64_t>::max();
        if (east_shrine_idx > 0 && east_temple_idx > 0) {
            min_distance = min(min_distance, distance(x, shrines[east_shrine_idx - 1],
                                                      temples[east_temple_idx - 1]));
        }
        if (east_shrine_idx < shrines.size() && east_temple_idx < temples.size()) {
            min_distance = min(min_distance, distance(x, shrines[east_shrine_idx],
                                                      temples[east_temple_idx]));
        }
        if (east_shrine_idx > 0 && east_temple_idx < temples.size()) {
            min_distance = min(min_distance, distance(x, shrines[east_shrine_idx - 1],
                                                      temples[east_temple_idx]));
        }
        if (east_shrine_idx < shrines.size() && east_temple_idx > 0) {
            min_distance = min(min_distance, distance(x, shrines[east_shrine_idx],
                                                      temples[east_temple_idx - 1]));
        }
        return min_distance;
    }

    int64_t distance(int64_t p0, int64_t p1, int64_t p2) {
        return min(abs(p1 - p0) + abs(p2 - p1), abs(p2 - p0) + abs(p1 - p2));
    }

private:

};

int solve() {
    Solution solution;
    // handle IO here
    size_t S, T, Q;
    cin >> S >> T >> Q;
    vector<int64_t> shrines(S);
    vector<int64_t> temples(T);
    vector<int64_t> queries(Q);
    for (auto i = 0u; i < S; ++i) {
        cin >> shrines[i];
    }
    for (auto i = 0u; i < T; ++i) {
        cin >> temples[i];
    }
    for (auto i = 0u; i < Q; ++i) {
        cin >> queries[i];
    }
    for (auto q : queries) {
        cout << solution.lazy_faith(shrines, temples, q) << '\n';
    }
    return 0;
}

} // anonymous namespace

#ifdef OJ_MISC_OFFLINE

#include "epilog.h"

#else

int main() {
    return solve();
}

#endif


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(const T a, const T b){return a>=0 ? a/b : (a+1)/b-1;}
template<class T> T div_ceil(const T a, const T b){return a>=0 ? (a-1)/b+1 : a/b;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 1000010;

int dp[2][MAX];
vector<int> x[2];

void solve(int c){
    rep(i, MAX) dp[c][i] = MAX;
    dp[c][0] = 0;
    rep(i, MAX)if(dp[c][i] < MAX){
        for(int j: x[c]){
            if(i+j >= MAX) break;
            chmin(dp[c][i+j], dp[c][i] + 1);
        }
    }
}

int f(int i){
    return i*(i+1)*(i+2) / 6;
}

int main(){
    for(int i=1; f(i)<=MAX; ++i){
        x[0].push_back(f(i));
        if(f(i) % 2 == 1) x[1].push_back(f(i));
    }
    rep(i, 2) solve(i);
    int n;
    while(scanf("%d", &n) && n){
        printf("%d %d\n", dp[0][n], dp[1][n]);
    }
}


Measured memory_bytes: 10964
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,a[1001],ans;
vector<ll> v,u;
int main(void){
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=n;i++){
        a[i]+=a[i-1];
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<=n;j++){
            v.push_back(a[j]-a[i]);
        }
    }
    for(ll i=50;i>=0;i--){
        for(auto x:v){
            if(((x>>i)&1)==1){
                u.push_back(x);
            }
        }
        if(u.size()>=m){
            ans|=(1LL<<i);
            v=u;
        }
        u={};
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
int n, m;
string s;
int main() {
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            cin >> s;
            if (s == "snuke") {
                cout << (char)(j + 'A' - 1) << i << endl;
                return 0;
            }
        }
    }
	return 0;
} 
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>

using namespace std;

int main(){

  string S; cin >> S;
  string T;
  for (int i = 0; i < S.length(); i++){
    T += S[S.length() - 1 - i];
  }
  
  for (int i = 0; i < T.length(); i++){
    char A = T[i];
    if (A == 'b') A = 'd';
    else if (A == 'd') A = 'b';
    else if (A == 'p') A = 'q';
    else if (A == 'q') A = 'p';
    
    T[i] = A;
  }
  
  if (S == T) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 640
#include<iostream>

int main(){
    int a,b,c;
    std::cin >> a;
    std::cin >> b;
    std::cin >> c;
    if ( ((c > a) && (b > c)) || ((c < a) && (b < c)))
    {
        std::cout << "Yes\n";
    }else{
        std::cout << "No\n";
    }
    return 0;
}

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

using namespace std;

const int maxn=1<<25;
const int mod=1e9+9;

int main()
{
	int n;
	cin>>n;
	if(n==1){
		cout<<"Hello World";
	}else{
		int a,b;
		cin>>a>>b;
		cout<<a+b;
	}
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll Game(vector< int > &element,int n)
{
     vector< vector < pair< ll,ll > > >   DP(n+2,vector< pair< ll,ll > > (n+1,make_pair(0,0)));
     for(int l=0;l<n;l++){
          for(int  i=1;i<=n-l;i++){
               int j = i+l;
               if(element[i-1]+ DP[i+1][j].second>element[j-1] + DP[i][j-1].second){
                    DP[i][j].first = element[i-1]+ DP[i+1][j].second;
                    DP[i][j].second = DP[i+1][j].first;
               }
               else{
                    DP[i][j].first = element[j-1] + DP[i][j-1].second;
                    DP[i][j].second = DP[i][j-1].first;
              }
          }
     }
     return DP[1][n].first - DP[1][n].second;
}
int main()
{
     //freopen("in.txt","r",stdin);
     int n;
     cin >> n;
     vector< int >  element(n);
     for(int i=0;i<n;i++)     cin >> element[i];
     ll ans = Game(element,n);
     cout << ans << endl;
}


Measured memory_bytes: 141184
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << #x << ": " << x << '\n';
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  vector<char> vec(n);
  char first, second;
  cin >> first;
  int cnt = 1;
  second = first;
  for (int i = 1; i < n; ++i) {
    cin >> first;
    if (first != second) {
      second = first;
      cnt++;
    }
  }
  cout << cnt << '\n';
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    int x;
	    String inputed;
	    ArrayList<String> inputs = new ArrayList<String>();

	    while(true){
	    	try {
	    		inputed = br.readLine();
	    		if(Character.getNumericValue(inputed.charAt(0)) == 0) {
	    			break;
	    		}
	    		inputs.add(inputed);
	    	} catch (IOException e) {
	    		e.printStackTrace();
	    	}
	    }
		for(int i = 0; i < inputs.size(); i++){
			x = 0;
			for(int j = 0; j < inputs.get(i).length(); j++) {
				x += Character.getNumericValue(inputs.get(i).charAt(j));
			}
			System.out.printf("%d\n",x);
		}
	}
}



Measured memory_bytes: 24980
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A, B, C;
    cin >> A >> B >> C;
    if((A == B && A != C)||(A == C && A != B)||(B == C && B !=A)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rep3(i, m, n) for(ll i=m;i<=(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000
#define LLINF 1000000000000000000

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

void solve_abc_d() {
	ll n, m;
	ll l_ans = 0;

	cin >> n >> m;

	V mv[8];
	ll x, y, z;
	rep(i, n) {
		cin >> x >> y >> z;

		mv[0].push_back(x + y + z);
		mv[1].push_back(-x + y + z);
		mv[2].push_back(x - y + z);
		mv[3].push_back(x + y - z);
		mv[4].push_back(-x - y + z);
		mv[5].push_back(-x + y - z);
		mv[6].push_back(x - y - z);
		mv[7].push_back(-x - y - z);
	}

	rep(i, 8) sort(RALL(mv[i]));
	
	V sum(8, 0);
	rep(i, 8) {
		rep(j, m) {
			sum[i] += mv[i][j];
		}
	}

	rep(i, 8) {
		chmax(l_ans, sum[i]);
	}


	cout << l_ans << "\n";
}

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

	solve_abc_d();

	return 0;
}


Measured memory_bytes: 3720
#include <stdio.h>

int main(void) {
	int a,b;
	a=1;
	b=1;
	while(a!=0)
	{
		scanf("%d",&a);
		if(a==0)
		{
			break;
		}
		printf("Case %d: %d\n",b,a);
		b++;
	}
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <stdlib.h>
#include <vector> //vector
#include <algorithm> //sort()
#include <iomanip>

using namespace std;

template<class T> inline bool chmin(T& a, T b);
template<class T> inline bool chmax(T& a, T b);

int64_t a, b, c, d, i, j, k, n;
double ans;

int main(){
//////////////////////////////////////////////////////

    cin >> n  >> k;

    // cout << "n:" << n << endl;

    // vector<long> input(n+1);
    // for (int i = 1 ; i <= n ; i ++ )
    // {
    //     cin >> input[i];
    //     cout << "input[" << i << "]=" << input[i] << endl;
    // }

    // sort(input.begin() , input.end());

    // uint64_t max = numeric_limits<uint64_t>::max();

    //uint64_t sum = 0;


    //ans += (n - k + 1);

    //cout << "ans="<< ans << endl;
    //uint64_t pos = k - 1;
    uint64_t div = 1;
    for ( i = n ; i >= 1 ; --i )
    {
        while( i * div < k)
        {
            div *= 2;
            //cout << "i=" << i << ", div="<< div << endl;
        }
        ans += 1.0 / (double)div;
        //cout << "i=" << i << ", ans="<< ans << endl;

    }

    cout << setprecision(15) << ans / (double)n << endl;

    //////////////////////////////////////////////////////
    // DP

    // // 無限大の値
    // const uint64_t INF = (uint64_t)1 << 60;
    // //const int64_t NINF = -1 * ((int64_t)1 << 60 );

    // // DP テーブル
    // uint64_t dp[100010];

    // //DPテーブル初期化（最小化用）
    // for (int i = 0; i < 100010; ++i)
    // {
    //     //dp[i] = INF;
    //     dp[i] = 0;
    // } 

    // // 初期条件
    // dp[0] = 0;

    // // ループ
    // for (int i = 1; i <= n; ++i) {
    //     //chmin( dp[i], dp[i - 1] + abs( input[i] - input[i - 1] ));
    //     //if (i < 2)continue;
    //     //chmin( dp[i], dp[i - 2] + abs( input[i] - input[i - 2] ));



    //     // chmax ( dp [i] , dp[i - 1]);
    //     // chmax ( dp [i] , dp[i - 1] + input[i]);
    //     // cout << "dp[" << i <<"] = " << dp[i] << endl;

    // }



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

    //cout << ans << endl;

    //cout << dp[n] << endl;

//////////////////////////////////////////////////////
// Ctrl + Opt + N to make
    return 0;
}


//最小化用関数
template<class T> inline bool chmin(T& a, T b)
{
    if (a > b) 
    {
        a = b;
        return true;
    }
    return false;
}

//最大化関数
template<class T> inline bool chmax(T& a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean check = false;
		
		for(int i = 1; i<10; i++){

			if(check == false){

				for(int j =1; j <10; j++){

					if(i*j == n){
						check = true;
						break;
					}

				}

			}else{
				break;
			}
		}

		if(check){
			System.out.println("Yes");
		}else{
			System.out.println("No");

		}
		
	}
}



Measured memory_bytes: 35568
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>

#define fup(i, a, b) for (int i = (a); i < (b); (i)++)
#define req(i, l, r) for (int i = (l); i <= (r); (i)++)

// in
#define pn printf("\n")
#define psp printf(" ")
#define pd(n) printf("%d", (n))
#define pld(n) printf("%lld", (n))

using namespace std;
string a, b;
int num = 0;
int main() {
#ifdef LOCAL
    freopen("test.in", "r", stdin);
    freopen("test.out", "w", stdout);
#endif
    cin >> a >> b;
    int len = a.length();
    fup(i, 0, len) {
        if (a[i] != b[i])
            num++;
    }
    pd(num);

    return 0;
}

Measured memory_bytes: 3892
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void solve(long long A, long long B, long long C, long long K){
  if(A+B>=K) {
    std::cout << min(A,K) << std::endl;
  } else {
    std::cout << A-(K-(A+B)) << std::endl;
  }
}

int main(){
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
  long long C;
  scanf("%lld",&C);
  long long K;
  scanf("%lld",&K);
  solve(A, B, C, K);
  return 0;
}



Measured memory_bytes: 3244
#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
	x = 0;
	char ch = 0;
	bool sign = false;
	while (ch < '0' || '9' < ch) sign |= ch == '-', ch = getchar();
	while ('0' <= ch && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
	x = sign ? -x : x;
}
template <typename T>
inline void print(T x) {
	static char outp[64];
	if (!x) { putchar('0'); return; }
	if (x < 0) putchar('-'), x = -x;
	int tot = 0;
	while (x) outp[tot++] = x % 10 + '0', x /= 10;
	while (tot) putchar(outp[--tot]);
}
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef unsigned long long ull;
#define fst first
#define sed second
#define pb push_back
#define mp make_pair
#define rint register int
#define all(it) it.begin(), it.end()
#define rep(it, f, e) for (rint it = f; it <= e; ++it)
#define per(it, f, e) for (rint it = f; it >= e; --it)
int pot[10], tot1, tot2;
int main() {
	//ios::sync_with_stdio(false);
	//cin.tie(NULL), cout.tie(NULL);
	rep (i, 1, 6) {
		int u;
		cin >> u;
		++pot[u];
	}
	rep (i, 1, 4) {
		if (pot[i] == 1) ++tot1;
		if (pot[i] == 2) ++tot2;
	}
	puts(tot1 == 2 && tot2 == 2 ? "YES" : "NO");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <string.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define INF 2147483647
#define LLINF 9223372036854775807
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	long long cnt=0;
	long long i;
	long long j;
	for(i=0;i<k;i++){
		cnt+=i;
	}
	long long ans=0;
	for(j=n;j>=n+1-k;j--){
		ans+=j;
	}
	long long sum=(ans-cnt+1)%1000000007;
	for(int l=0;l<n+1-k;l++){
		cnt+=i;
		ans+=j;
		sum+=(ans-cnt+1);
		sum%=1000000007;
		i++;
		j--;
	}
	cout<<sum<<endl;
	return 0;
}

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


int S[1000];
int top;

void push(int x){
  top++;
  S[top] = x;
}

int pop(){
  top--;
  return S[top + 1];
}

int main(){
  top = 0;
  char s[100];
  int a,b;

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

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



Measured memory_bytes: 2044
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    private struct Pair { public int x, y; public Pair(int xx, int yy) { x = xx; y = yy; } }
    private static int[] dx = { 1, 0, -1, 0 };
    private static int[] dy = { 0, -1, 0, 1 };
    public static void Main()
    {
        int N = NextInt();
        int[] A = LineInt();
        SegTree ST = new SegTree();
        ST.Set(N);
        for (int i = 0; i < N; i++) ST.Add(i, A[i]);
        ST.Grow();
        int ans = 1;
        for (int i = 0; i < N; i++)
        {
            int nx = ST.GCD(ST.Query(0, i), ST.Query(i + 1, N));
            ans = Math.Max(ans,nx);
        }
        Console.WriteLine(ans);
    }
}


public class SegTree
{
    private static List<int> table = new List<int>();
    private static int size = 1;
    public void Set(int n)
    {
        while (size < n) size *= 2;
        for (int i = 0; i < 2 * size - 1; i++) table.Add(1);
    }
    public void Add(int x, int v)
    {
        table[x + size - 1] = v;
    }
    public void Grow()
    {
        for (int i = size - 2; i >= 0; i--) table[i] = GCD(table[i * 2 + 1], table[i * 2 + 2]);
    }
    public int Query(int a, int b, int x = 0, int l = 0, int r = 0)
    {
        if (r <= l) r = size;
        if (r <= a || b <= l) return 0;
        if (a <= l && r <= b) return table[x];
        int left = Query(a, b, x * 2 + 1, l, (r + l) / 2);
        int right = Query(a, b, x * 2 + 2, (r + l) / 2, r);
        return GCD(left, right);
    }
    public int GCD(int a, int b)
    {
        if (b == 0) return a;
        if (a < b) GCD(b, a);
        var d = a % b;
        while (b != 0)
        {
            d = a % b;
            a = b;
            b = d;
        }
        return a;
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


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

int n;
int ans = 0;
vector<int> d(110);

void input(){
  cin >> n;
  rep(i, n){
    cin >> d.at(i);
  }
}

void solve(){
  input();
  rep(i, n){
    rep(j, i){
      ans += d.at(i) * d.at(j);
      //cout << ans << " ";
    }
  }
  cout << ans << endl;
}

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


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

using namespace std;
 
#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()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = 1e9+7; typedef vector<ll> VL;
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 l(2*n);
	rep(i, 2*n) cin >>l[i];
	sort(all(l));
	int ans = 0;
	rep(i, n){
		ans += min(l[2*i], l[2*i+1]);
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
#include<cstdlib>
#include<ctime>
#include<vector>
#include<map>
using namespace std;

int main(){
//srandom((unsigned long)time(NULL));

string s,t;
cin>>t;
s=t;

for(int i=0;i<t.length();i++){
    int x=1;
    s.erase(s.length()-1);
    if(s.length()%2==0){
        for(int j=0;j<s.length()/2;j++){
            if(s[j]!=s[j+s.length()/2]){
                x=0;
            }
        }
        if(x==1){
            cout<<s.length()<<endl;
            return 0;
        }
    }
}

return 0;
}

Measured memory_bytes: 256
n=int(input())
p=tuple(map(float,input().split()))
dp=[[0.0]*(n+1) for _ in range(n+1)]
dp[0][0]=1.0
for i in range(1,n+1):
  for j in range(i+1):
    dp[i][j]=dp[i-1][j]*(1-p[i-1])
    if j>0:
      dp[i][j]+=dp[i-1][j-1]*p[i-1]
print(sum(dp[n][n//2+1:]))

Measured memory_bytes: 111580
import java.util.*;
import static java.lang.System.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] w = new int[n];
		int sum = 0;
		for(int i =0; i < n; i++) {
			w[i] = sc.nextInt();
			sum += w[i];
		}
		int min = Integer.MAX_VALUE / 10;
		for(int i = 1; i < n; i++) {
			int a = 0; int b = 0;
			for(int j = 0; j < i; j++) {
				a += w[j];
			}
			b = sum - a;
			int score = Math.abs(a - b);
			if (min > score)min = score;
		}
		out.println(min);
		
	}
}

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

int main()
{
    long long x;
    std::cin >> x;

    long long h1 = (x / 500);
    long long h2 = (x % 500) / 5;

    std::cout << h1*1000 + h2*5 << std::endl;

    return 0;
}


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

int main() {
  int H, W;

  cin >> H >> W;

  vector<string> a(H);

  for (int i = 0; i < H; i++) {
    cin >> a.at(i);
  }

  for (int i = 0; i < H; i++) {
    int j = 0;
    while (j < W && (a.at(i).at(j) == '.' || a.at(i).at(j) == ' ')) {
      j++;
    }
    if (j == W) {
      for (int j = 0; j < W; j++) {
        a.at(i).at(j) = ' ';
      }
    }
  }

  for (int i = 0; i < W; i++) {
    int j = 0;
    while (j < H && (a.at(j).at(i) == '.' || a.at(j).at(i) == ' ')) {
      j++;
    }
    if (j == H) {
      for (int j = 0; j < H; j++) {
        a.at(j).at(i) = ' ';
      }
    }
  }

  for (int i = 0; i < H; i++) {
    int replacedCount = 0;
    for (int j = 0; j < W; j++) {
      if (a.at(i).at(j) != ' ') {
        cout << a.at(i).at(j);
      } else {
        replacedCount++;
      }
    }
    if (replacedCount < W) {
      cout << endl;
    }
  }
}


Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;


int main(){

    int A, B;
    cin >> A >> B;

    int plus = 0;
    while (true){
        int cnt = A * plus - plus + 1;
        if(cnt >= B){
            cout << plus << endl;
            break;
        }
        plus ++;
    }
    

}

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

int main(){
  int a,b;
  cin>>a>>b;
  vector<int> n(14);
  n={0,13,1,2,3,4,5,6,7,8,9,10,11,12};
  if(n[a]>n[b])cout<<"Alice"<<endl;
  if(n[a]==n[b])cout<<"Draw"<<endl;
  if(n[a]<n[b])cout<<"Bob"<<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, C: int):
    a = sorted([A, B, C])
    o = sum([x & 1 for x in a])
    c = 0 < o and o < 3
    if o == 2:
        for i in range(3):
            a[i] += a[i] & 1
    elif o == 1:
        for i in range(3):
            a[i] += 1 - (a[i] & 1)
    print((2*a[2] - a[1] - a[0]) // 2 + c)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please



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


	int A, B, C;
	cin >> A >> B >> C;
	swap(A, B);
	swap(A, C);

	cosp(A);
	cosp(B);
	co(C);


	Would you please return 0;
}

Measured memory_bytes: 256
// May this submission get accepted
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) { if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(DUMPALL_ITR, (q).size()) { cerr << (q)[DUMPALL_ITR] << (DUMPALL_ITR == DUMPALL_ITR_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using  ld = long double;
using namespace std;

// 標準入出力
struct inp {
    size_t sz;
    inp(size_t _sz = 1) : sz(_sz) {}
    template <typename T> operator T () const { T a; cin >> a; return a; }
    template <typename T> operator vector<T> () const { vector<T> a(sz); for (size_t i = 0; i < sz; i++) cin >> a[i]; return a; }
    template <typename T, typename U> operator pair<T, U> () const { T f; U s; cin >> f >> s; return pair<T, U>(f, s); }
};
inp inp1; // input one
template <typename T> void say(T &x, char end = '\n') { cout << x << end; }
template <typename T> void say(vector<T> &x, char sep = ' ', char end = '\n') { for (size_t i = 0, sz = x.size(); i < sz; i++) { cout << x[i] << (i == sz-1 ? end : sep); } }

// モジュール


// 処理内容
int main() {
    
    ios::sync_with_stdio(false); // stdioを使うときはコメントアウトすること
    cin.tie(nullptr);            // インタラクティブ問題ではコメントアウトすること
    
    ll n = inp1;
    vector<ll> p = inp(n);
    vector<ll> q = inp(n);

    if (p > q) {
        p.swap(q);
    }

    ll ans = 0;
    while (p < q) {
        next_permutation(ALL_OF(p));
        ans++;
    }
    say(ans);
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define x first
#define y second
#define IOS ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef unsigned long long ULL;
typedef pair<int,int> PII;
const int N=25;
ULL n,m,x,y;
string s;
int main(){
	IOS;
	cin>>s;
	string ans=s[2]==s[3]&&s[4]==s[5]?"Yes":"No";
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cstdlib>
#include <iostream>

using namespace std;

#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int H, W;
char C[101][101];

namespace MF {
#define MAXN 100000
#define MAXM 100000
#define wint int
const wint wEPS = 0;
const wint wINF = 1001001001;
int n, m, ptr[MAXN], next[MAXM], zu[MAXM];
wint capa[MAXM], tof;
int lev[MAXN], see[MAXN], que[MAXN], *qb, *qe;
void init(int _n) {
	n = _n; m = 0; memset(ptr, ~0, n * 4);
}
void ae(int u, int v, wint w0, wint w1 = 0) {
	next[m] = ptr[u]; ptr[u] = m; zu[m] = v; capa[m] = w0; ++m;
	next[m] = ptr[v]; ptr[v] = m; zu[m] = u; capa[m] = w1; ++m;
}
wint augment(int src, int ink, wint flo) {
	if (src == ink) return flo;
	wint f;
	for (int &i = see[src]; ~i; i = next[i]) if (capa[i] > wEPS && lev[src] < lev[zu[i]]) {
		if ((f = augment(zu[i], ink, min(flo, capa[i]))) > wEPS) {
			capa[i] -= f; capa[i ^ 1] += f; return f;
		}
	}
	return 0;
}
bool solve(int src, int ink, wint flo = wINF) {
	wint f;
	int i, u, v;
	for (tof = 0; tof + wEPS < flo; ) {
		qb = qe = que;
		memset(lev, ~0, n * 4);
		for (lev[*qe++ = src] = 0, see[src] = ptr[src]; qb != qe; ) {
			for (i = ptr[u = *qb++]; ~i; i = next[i]) if (capa[i] > wEPS && !~lev[v = zu[i]]) {
				lev[*qe++ = v] = lev[u] + 1; see[v] = ptr[v];
				if (v == ink) goto au;
			}
		}
		return 0;
	au:	for (; (f = augment(src, ink, flo - tof)) > wEPS; tof += f);
	}
	return 1;
}
}

int main()
{
	scanf("%d%d", &H, &W);
	for (int i = 0; i < H; ++i) scanf("%s", C[i]);
	for (int i = 0; i < H; ++i) for (int j = 0; j < W; ++j) {
		if ((i == 0 || i == H - 1 || j == 0 || j == W - 1) && C[i][j] == 'X') {
			puts("-1");
			return 0;
		}
	}
	MF::init(2 * H * W + 2);
	int s = 2 * H * W;
	int t = s + 1;
	auto idx = [H, W, t](int y, int x) {
		if (y < 0 || y == H || x < 0 || x == W) return t;
		return 2 * (y * W + x);
	};
	int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 };

	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			if (C[i][j] == 'X') {
				MF::ae(s, idx(i, j) + 1, 100);
			} else {
				MF::ae(idx(i, j), idx(i, j) + 1, 1);
			}
			for (int k = 0; k < 4; ++k) {
				MF::ae(idx(i, j) + 1, idx(i + dx[k], j + dy[k]), 100);
			}
		}
	}
	MF::solve(s, t);
	printf("%d\n", MF::tof);
	return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
    int n;
    cin>>n;
    double a[n];
    for (int i = 0; i < n; ++i) {
        cin>>a[i];
    }

    double dp[n+1][n+1];
    fill_n(&dp[0][0],(n+1)*(n+1),0);
    dp[0][0]=1;
    for (int i = 1; i < n+1; ++i) {
        dp[i][0]= dp[i-1][0]*(1-a[i-1]);
    }
    for (int i = 1; i < n+1; ++i) {
        for (int j = 1; j < i+1; ++j) {
            dp[i][j] = dp[i-1][j]*(1-a[i-1])+dp[i-1][j-1]*a[i-1];
        }
    }


    double s=0;
    for (int i = (n+2)/2; i < n+1; ++i) {
        s+=dp[n][i];
    }
    cout<<fixed<<setprecision(10)<<s;
}

Measured memory_bytes: 70528
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
constexpr long long int INF = std::numeric_limits<long long int>::max();
#define int long long int

void solve() {
  int x, a;
  cin >> x >> a;
  if (x < a) {
    cout << 0 << endl;
  } else {
    cout << 10 << endl;
  }
  // cout << endl;
}

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


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int a , b;
    cin >> a >> b;
    if (a >= 13){
        cout << b;
    }else if (a >= 6 && a <= 12){
        cout << b / 2;
    }else if (a <= 5){
        cout << 0;
    }
    return 0;
}


Measured memory_bytes: 3520
import java.util.Scanner;

public class Main {
	static Scanner in = new Scanner(System.in);
	
	public static void main(String[] args){
		int x = in.nextInt(), y = in.nextInt();
		
		if((0 <= x || y <= 0) && x < y){
			System.out.println(Math.abs(y - x));
		}else if(y < x && ((x < 0 && y < 0) || (0 < x && 0 < y))){
			int ans = Math.abs(Math.abs(x) - Math.abs(y));
			System.out.println(ans + 2);
		}else{
			int ans = Math.abs(Math.abs(x) - Math.abs(y));
			System.out.println(ans + 1);
		}
	}
}

Measured memory_bytes: 23124
using System;
using System.Linq;
using System.Collections.Generic;
namespace AtCoder
{
	class Programs
	{
		static void Main ()
		{
			var s = Console.ReadLine ();
			var t = Console.ReadLine ();
			bool judge = true;
			for (char c = 'a'; c <= 'z'; c++) {
				var list = new List<char> ();
				for (int i = 0; i < s.Length; i++) {
					if (s [i] == c)
						list.Add (t [i]);
				}
				if (list.Distinct ().Count () > 1)
					judge = false;

				list = new List<char> ();
				for (int i = 0; i < s.Length; i++) {
					if (t [i] == c)
						list.Add (s [i]);
				}
				if (list.Distinct ().Count () > 1)
					judge = false;
			}
			Console.WriteLine (judge?"Yes":"No");
		}
	}
}

Measured memory_bytes: 16864
import math
def comb(n, r):
    if(n>=r):
        return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
    else:
        return 0
        
m,n = map(int, input().split())
ans = comb(m, 2) + comb(n, 2)
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int i,j,n,k;
char tmp;
int main()
{
  for(cin>>n;i*4<=n;i++)for(j=0;j*7<=n;j++)if(i*4+j*7==n)return cout<<"Yes",0;
  cout<<"No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int N, M, K;
    cin >> N >> M >> K;
    bool ans = false;
    REP(i,N+1) {
        int count = M*i;
        int md = N - i*2;
        int rest = K-count;
        if (md == 0) {if (count == K) ans = true;}
        else if (md > 0 && (rest > 0)) {if (rest % md == 0 && rest / md <= M) ans = true;}
        else if (md < 0 && (rest < 0)) {if (rest % md == 0 && rest / md <= M) ans = true;}
        if (ans) break;
    }
    ATYN(ans)

    return 0;
}

Measured memory_bytes: 3620
n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
light_position =1
light_position = a[light_position-1]
count = 1
while True:
    if light_position == 2:
        break
    elif light_position == 1 or count > n:
        count = -1
        break        
    light_position = a[light_position-1]
    count += 1
print(count)

Measured memory_bytes: 7192
a,v = gets.split(' ').map(&:to_i)
b,w = gets.split(' ').map(&:to_i)
t = gets.to_i
#ans = false
dist = (b-a).abs
if v == w
  puts 'NO'
elsif v < w
  puts 'NO'
else
  if dist <= (v-w)*t
    puts 'YES'
  else
    puts 'NO'
  end
end

Measured memory_bytes: 14284
package main

import (
	"bufio"
	"fmt"
	"os"
	"reflect"
	"strings"
)

// 元の文字列と逆順にした文字列、そして回文かどうかを真偽値で返す
func GetPalindrome(slice []string) bool {
	sre := make([]string, 0)

	for i := len(slice) - 1; i >= 0; i-- {
		sre = append(sre, slice[i])
	}
	if reflect.DeepEqual(slice, sre) {
		return true
	}
	return false
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()

	scan := scanner.Text()

	slice := strings.Split(scan, "")

	flag := GetPalindrome(slice)

	if flag == false {
		fmt.Println("No")
		os.Exit(0)
	}

	flag = GetPalindrome(slice[:(len(slice)-1)/2])

	if flag == false {
		fmt.Println("No")
		os.Exit(0)
	}

	flag = GetPalindrome(slice[((len(slice)+3)/2)-1:])

	if flag == false {
		fmt.Println("No")
		os.Exit(0)
	}

	fmt.Println("Yes")

}


Measured memory_bytes: 1796
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<ll, ll> P;

#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define all(x) (x).begin(),(x).end()
#define stop char nyaa; cin>>nyaa;



ll a[2020][2020], b[2020][2020], c[2020][2020], e[2020][2020];

void solve() {
	int h, w, m;
	cin >> h >> w >> m;
	vector<string> s(h);
	rep(i, h)cin >> s[i];
	b[1][1] = s[0][0] - '0';
	c[1][1] = 1;
	e[1][1] = 1;
	rep(i, h)rep(j, w) {
		if (i == 0 && j == 0)continue;
		e[i + 1][j + 1] = (e[i][j + 1] + e[i + 1][j]) % m;
		if (s[i][j] == '*') {
			a[i + 1][j + 1] = (a[i][j + 1] + a[i + 1][j]) % m;
			c[i + 1][j + 1] = (b[i][j + 1] + b[i + 1][j]) % m;
		}
		else if (s[i][j] == '+') {
			a[i + 1][j + 1] = (a[i][j + 1] + a[i + 1][j]) % m;
			a[i + 1][j + 1] += (b[i][j + 1] + b[i + 1][j]) % m;
			a[i + 1][j + 1] %= m;
			c[i + 1][j + 1] = e[i + 1][j + 1];
		}
		else {
			ll d = s[i][j] - '0';
			a[i + 1][j + 1] = (a[i][j + 1] + a[i + 1][j]) % m;
			b[i + 1][j + 1] = (10 * (b[i][j + 1] + b[i + 1][j]) + d * (c[i][j + 1] + c[i + 1][j])) % m;
			c[i + 1][j + 1] = (c[i][j + 1] + c[i + 1][j]) % m;
		}
	}
	cout << (a[h][w] + b[h][w]) % m << endl;
}

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


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


void swap(int &a,int &b)
{
    int t;
    t=a;
    a=b;
    b=t;
}
int main() {
	// your code goes here
	int n;
	cin>>n;
	int flag=0;
	while(n)
	{
	    if(n%10==9)
	    flag=1;
	    n/=10;
	}
	if(flag)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}


Measured memory_bytes: 256
import itertools
N=int(input())
L=list(map(int,input().split()))
L=sorted(L)
c=0
for i in range(N):
    for j in range(i):
        for k in range(j):
            if L[j]-L[k]<L[i]<L[j]+L[k] and L[j]!=L[k]and L[j]!=L[i] and L[i]!=L[k]:
                c+=1
print(c)

Measured memory_bytes: 9136