akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(a,b) memset(a,b,sizeof(a))
#define msn(a,n,b) for(int i=0;i<=n;i++)a[i]=b
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define fi first
#define se second
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const int mod=1e9+7;
const int seed=233;
const double PI=acos(-1.0);
const double eps=1e-7;
const int inf=0x3f3f3f3f;
const int max_n=100005;
ll ceil(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?(x+y-1)/y:-x/y;}
ll floor(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?x/y:-(x+y-1)/y;}
namespace {
    inline int Add(int x,int y){return (x+=y)>=mod?x-mod:x;}
    inline int Sub(int x,int y){return (x-=y)<0?x+mod:x;}
    inline int Mul(int x,int y) {return 1ll*x*y%mod;}
    inline int Pow(int x,int y=mod-2){if(y==0)return 1;int res=1;while(y){if(y&1)res=1ll*res*x%mod;x=1ll*x*x%mod;y>>=1;}return res;}
}
/**********************head************************/
ll n;
ll solve(ll n){
    if(n==1)return 1;
    return 1+solve(n/2)*2;
}
int main(){
    scanf("%lld",&n);
    printf("%lld\n",solve(n));
    return 0;
}

Measured memory_bytes: 256
(set! *unchecked-math* true)
(def ^:const D-Y-X
  [[-1 -1] [-1 0] [-1 1] [0 -1] [0 1] [1 -1] [1 0] [1 1]])

(def ^:const one (unchecked-int \0))

(defn get_H_W []
  (->> (clojure.string/split (read-line) #"\s")
    (map #(Integer/parseInt %))))

(defn set_Array [H W ^"[[C" Array]
  (loop [h 0]
    (when (< h H)
      (do (->> (read-line)
            (char-array W)
            (aset ^"[[C" Array h))
          (recur (unchecked-inc-int h))))))


(defn Minesweeper [H W ^"[[C" Array]
  (let [X (range W)
        Y (range H)]
    (dorun
      (for [x X
            y Y
            :let [v (aget ^"[C" (aget ^"[[C" Array y) x)]
            :when (not= \# v)]
        (->> (for [d-y-x D-Y-X
                   :let [[dy dx] (map + (list y x) d-y-x)]
                   :when (and
                           (<= 0 dx)
                           (< dx W)
                           (<= 0 dy)
                           (< dy H)
                           (= \# (aget ^"[C"(aget ^"[[C"Array dy) dx)))]
               true)
          count
          (unchecked-add-int one)
          unchecked-char
          (aset ^"[C"(aget^"[[C" Array y) x))))))

(defn output [^chars Array]
  (->> Array
    (map #(apply str %))
    (map println-str)
    (apply str)
    println))

(let [[H W] (get_H_W) Array (make-array Character/TYPE H W)]
  (do (set_Array H W Array)
      (Minesweeper H W Array)
      (output Array)))

Measured memory_bytes: 72672
using System;
using System.Collections.Generic;
using System.Linq;
namespace csharptest
{
    class Program
    {
        static void Main(string[] args)
        {
            long a, b;
            string []str=Console.ReadLine().Split(' ');
            a = long.Parse(str[0]);
            b = long.Parse(str[1]);
            if (a < b)
            {
                long t = a;
                a = b;
                b = t;
            }
            long d = 0;
            do {
                d = a % b;
                a = b;
                b = d;
            } while (d != 0);
            Console.WriteLine(a);
        }
    }
}

Measured memory_bytes: 19940
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
	int w[10],k[10];
	for(int i=0;i<10;i++)	cin>>w[i];
	for(int i=0;i<10;i++)	cin>>k[i];
	sort(w,w+10);
	sort(k,k+10);
	cout<<w[7]+w[8]+w[9]<<' '<<k[7]+k[8]+k[9]<<endl;
	return 0;
}

Measured memory_bytes: 0
<?php
fscanf(STDIN, "%s",$str);
$arr=str_split($str);
$check=false;
$cnt=0;
$start_no=0;
while(!$check){
	$chk_cnt=0;
	for($i=$start_no;$i<count($arr);$i++){
		if($i==(count($arr)-1)){
			$check=true;
			break 2;
		}
		if($arr[$i]==$arr[$i+1] && $i<>(count($arr)-1)){
			$cnt++;
			$chk_cnt=1;
			if($arr[$i+1]==0){
				$arr[$i+1]=1;
			}else{
				$arr[$i+1]=0;
			}
			$start_no=$i+1;
			break;
		}
	}
	if($chk_cnt==0){
		$check=true;
	}
}
echo $cnt;
?>

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> a(H, vector<char>(W));
  vector<int> h, w;
  for (int i = 0; i < H; i++)
    for (int j = 0; j < W; j++)
      cin >> a.at(i).at(j);
  // ここまでOK
  for (int i = 0; i < H; i++) {
    bool allwhite = true;
    for (int j = 0; j < W; j++)
      if (a.at(i).at(j) == '#') {
        allwhite = false;
        break;
      }
    if (allwhite == false)
      h.push_back(i);
  }
  for (int i = 0; i < W; i++) {
    bool allwhite = true;
    for (int j = 0; j < H; j++)
      if (a.at(j).at(i) == '#') {
        allwhite = false;
        break;
      }
    if (allwhite == false)
      w.push_back(i);
  }
  // ここからOK
  for (int i = 0; i < h.size(); i++){
    for (int j = 0; j < w.size(); j++)
      cout << a.at(h.at(i)).at(w.at(j));
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
greedy = sorted([V[i] - C[i] for i in range(N)], reverse = True)
res = 0
for i in range(N):
  if greedy[i] <= 0:
    break
  res += greedy[i]
print(res)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

int main(){
    int N, K; cin >> N >> K;
    vector<int> p(N);
    vector<double> prob(N);
    cout << fixed << setprecision(10);
    queue<double> que;
    for (int i = 0; i < N; i++){
        cin >> p[i];
        prob[i] = (double)(p[i]+1)/(2);
    }
    double sum = 0, mx = 0;
    for (int i = 0; i < N; i++){
        que.push(prob[i]);
        sum += prob[i];
        if (que.size() > K){
            sum -= que.front();
            que.pop();
        }
        mx = max(mx, sum);
    }
    cout << mx << endl;
}

Measured memory_bytes: 4224
#include<stdio.h>
int main(void){
	int h, w, i, j;
	
	do{
		scanf("%d %d", &h, &w);
		if(h == 0 && w == 0){
			break;
		}
		for(i = 0; i < h; i++){
			if(i%2 == 0){
				for(j = 0; j < w; j++){
					if(j%2 == 0){
						printf("#");
					}else{
						printf(".");
					}
				}
			}else{
				for(j = 0; j < w; j++){
					if(j%2 == 0){
						printf(".");
					}else{
						printf("#");
					}
				}
			}
			printf("\n");
		}
		printf("\n");
	}while(1);
	return 0;
}



Measured memory_bytes: 2120
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

int main() {
    int n;
    string s;
    cin >> n >> s;
    int left_west[n];
    left_west[0] = 0;
    REP_1(i, n) {
        if (s[i - 1] == 'W') { left_west[i] = left_west[i - 1] + 1; }
        else { left_west[i] = left_west[i - 1]; }
    }
    int right_east[n];
    right_east[n] = 0;
    REP(i, n) {
        if (s[n - i] == 'E') { right_east[n - i - 1] = right_east[n - i] + 1; }
        else { right_east[n - i - 1] = right_east[n - i]; }
    }
    int ans = 10000000;
    REP(i, n) {
        int num = left_west[i] + right_east[i];
        if (num < ans) { ans = num; }
    }
    cout << ans;
    return 0;

}

Measured memory_bytes: 2948
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e18;
const int MAX=200001;
int fac[MAX],finv[MAX],inv[MAX];
 
void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
 
int COM(int n,int k){
    if(n<k)return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

signed main(){
    COMinit();
    int N,M;cin>>N>>M;
    map<int,int>memo;
    for(int i=2;i<=sqrt(M);i++){
        while(M%i==0){
            memo[i]++;
            M/=i;
        }
    }
    if(M!=1)memo[M]++;
    int ans=1;
    for(auto v:memo)ans=ans*COM(v.second+N-1,v.second)%MOD;
    cout<<ans<<endl;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //freopen("data.in", "r", stdin);
  int l, r, d;
  cin >> l >> r >> d;
  int c = 0;
  for (int i = l; i <= r; i++) {
    if (i%d == 0) c++;
  }
  
  cout << c << endl;
  return 0;
}




















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



int partition(vector<int> &a, int p, int r) {
    int x, i, j, t;
    x = a[r];
    i = p - 1;
    for (int j = p; j < r; j++) {
        if (a[j] <= x) {
            i++;
            swap(a[i], a[j]);
        }
    }
    swap(a[i+1], a[r]);
    return i+1;
}

int main() {
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    rep(i, n) {
        scanf("%d", &a[i]);
    }
    int p = partition(a, 0, n-1);
    rep(i, n) {
        if (i == p) printf("[%d]", a[i]);
        else printf("%d", a[i]);
        if (i != n-1) printf(" ");
        else printf("\n");
    }
}


Measured memory_bytes: 3236
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    int n;cin>>n;
    vector<int> a(n);
    rep(i,n) cin>>a.at(i);
    deque<int> d;
    rep(i,n){
        auto p = lower_bound(d.rbegin(), d.rend(),a[i]);
        if(p==d.rbegin()){
            d.push_back(a[i]);
        }else{
            p--;
            *p=a[i];
        }
    }
    cout<<d.size()<<endl;
}
//lower_boundがよくわからない。あとイテレータのクラスも

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>

using namespace std;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	cin >> n;

	int tmp, ans = 0, maxp = 0;
	for (int i = 0; i < n; ++i) {
		cin >> tmp;

		ans += tmp;
		maxp = max(maxp, tmp);
	}
	
	ans -= maxp / 2;
	cout << ans << endl;

	return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0; i< n; i++)
#define ll = long long;
#define P = pair<int, int>;

void printVector(std::vector <int> const &a) {
   std::cout << "The vector elements are : ";
   for(int i=0; i < a.size(); i++)
      std::cout << a.at(i) << ' ';
}

int main(){
	int n;
	cin >> n;
	map<string, int> mp;
	rep(i, n){
		string s;
		cin >> s;
		mp[s]++;
	}
	int mx = 0;
	for(auto p : mp)
		mx = max(mx, p.second);
	for(auto p : mp)
	{
		if (p.second != mx)
			continue;
		cout << p.first << endl;
	}
		
	return 0;
}

Measured memory_bytes: 25216
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("");
	
	var count = 0;
	for(var i = 0; i < 3; i++) {
	    if(parseInt(input[i], 10) === 1) count++;
	}
	console.log(count);
	
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <unordered_set>
#include <unordered_map>

using namespace std;
const int MAXN = 3000;
double dp[MAXN][MAXN];
double p[MAXN];

int main()
{
    int N;
    cin >> N;
    for(int i = 0; i < N; i++) cin >> p[i];
    dp[0][0] = 1;
    double total = 0;
    for(int i = 1; i <= N; i++)
    {
        for(int j = 0; j <= i; j++)
        {
            dp[i][j] = (1-p[i-1])*dp[i-1][j];
            if(j!=0) dp[i][j] += p[i-1]*dp[i-1][j-1];
            if(i==N&&2*j>N) total += dp[i][j];
        }
    }
    cout.precision(12);
    cout << total;
}

Measured memory_bytes: 68992
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
n, a, b = map(int, input().split())
if a > b:
    print(0)
    exit()
if n == 1 and not(a == b):
    print(0)
    exit()
if n == 1 and(a == b):
    print(1)
    exit()
max_x = b*(n-1)+a
min_x = a*(n-1)+b
print(max_x-min_x+1)


Measured memory_bytes: 60012
#include <iostream>
#include <cstdio>
#include <complex>
#include <vector>
#include <cassert>
#include <iomanip>
#include <algorithm>
using namespace std;

#define EPS 1e-8
typedef complex<double> P;
typedef vector<P> G;

double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

bool intersectLS(const L &l, const L &s) {
  return cross(l[1]-l[0], s[0]-l[0])*       // s[0] is left of l
         cross(l[1]-l[0], s[1]-l[0]) < EPS; // s[1] is right of l
}

P crosspoint(const L &l, const L &m) {
  double A = cross(l[1] - l[0], m[1] - m[0]);
  double B = cross(l[1] - l[0], l[1] - m[0]);
  if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
  if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
  return m[0] + B / A * (m[1] - m[0]);
}

int ccw(P a, P b, P c)
{
	b -= a; c -= a;
	if (cross(b, c) > +EPS) return +1;
	if (cross(b, c) < -EPS) return -1;
	if (dot(b, c)   < -EPS) return +2;
	if (norm(b) < norm(c))  return -2;
	return 0;
}

bool notleft(P a, P b, P c)
{
	return (ccw(a,b,c)!=+1);
}

bool isIntoG(const G& g, const P& p)
{
	size_t sz = g.size();
	for(size_t i=0; i<sz; i++)
	{
		if( notleft(p, g[i], g[(i+1)%sz]) ) return false;
	}
	return true;
}

bool isfar(G& g, P& p)
{
	for(int i=0; i<g.size(); i++)
		if(abs(g[i]-p) < EPS) return false;
		
	return true;
}

#define CURR(P, i) P[i]
#define NEXT(P, i) P[(i+1)%P.size()]

bool ConvexCut(G& g, L& l, vector<G>& ret)
{
	int sp,inp=0;
	for(sp=0; sp<g.size(); sp++)
		if(intersectLS(l, L(g[sp], g[(sp+1)%g.size()]))) break;
		
	if(sp==g.size()) return false;
	
	ret.resize(2);
		
	P xp=crosspoint(l, L(g[sp], g[(sp+1)%g.size()]));
	sp++;
	
	for(int i=sp; i<sp+g.size(); i++)
	{
		if(isfar(ret[inp], g[i%g.size()])) ret[inp].push_back(g[i%g.size()]);
		if(intersectLS(l, L(g[i%g.size()], g[(i+1)%g.size()])))
		{
			P tx=crosspoint(l, L(g[i%g.size()], g[(i+1)%g.size()]));
			if(abs(tx-xp) < EPS) continue;
			
			xp=tx;
			for(int j=0; j<2; j++)
			{
				if(isfar(ret[j], xp)) ret[j].push_back(xp);
			}
			
			inp=(inp+1)%2;
		}
	}
	
	return true;
}

L trans(P a, P b)
{
	P med=(a+b);
	med=P(med.real()/2, med.imag()/2);
	P hoge=(a-b);
	hoge*=P(0,1);
	
	return L(med+hoge*P(100000,0), med-hoge*P(100000,0));
}

double Area(G& g)
{
	double ret=0;
	for(int i=0; i<g.size(); i++)
		ret+=cross(CURR(g,i), NEXT(g,i))/2;
		
	return ret;
}

int main()
{
	int T=1;
	while(1) {
		int p[6];
		bool end = true;
		for(int i=0; i<6; i++) {
			cin >> p[i];
			if(p[i]!=0) end = false;
		}

		if(end) break;

		G g,pts;
		vector<L> line;
		g.push_back(P(0,0));
		g.push_back(P(10000, 0));
		g.push_back(P(10000, 10000));
		g.push_back(P(0, 10000));

		for(int i=0; i<3; i++) 
			pts.push_back(P(p[2*i], p[2*i+1]));

		line.push_back(trans(pts[0], pts[1]));
		line.push_back(trans(pts[0], pts[2]));
		
		G f=g;
		for(int i=0; i<2; i++){
			vector<G> cut;
			if(!ConvexCut(f, line[i], cut)) continue;
			if(isIntoG(cut[0], pts[0])) f=cut[0];
			else f=cut[1];	
		}
		
		printf("%d %.5lf\n", T++, Area(f)/Area(g));
	}
}
 

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll a[52];
int main() {
	ll n;
	cin>>n;
	for(ll i=0;i<50;i++){
		a[i]=i;
	}
	ll s=n/50;
	for(ll i=0;i<50;i++){
		a[i]+=s;
	}
	s=n%50;
	for(ll i=0;i<s;i++){
		a[49-i]++;
	}
	cout << 50<<endl;
	for(ll i=0;i<50;i++){
		cout <<a[i]<< " ";
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
const int N=1e5+4;
int s[N],t[N],c[N];
int tt[2*N],rec[2*N];
int32_t main()
{
	#ifndef ONLINE_JUDGE
	freopen("in","r",stdin);
	freopen("out","w",stdout);
	#endif
	int n,C;
	cin>>n>>C;
	for(int i=0;i<n;i++)
	{
		cin>>s[i]>>t[i]>>c[i];
		s[i]=2*s[i]-1;
		t[i]=2*t[i];
	}

	for(int i=1;i<=C;i++)
	{
		for(int j=0;j<2*N;j++)tt[j]=0;
		for(int j=0;j<n;j++)
			if(c[j]==i){tt[s[j]]++;tt[t[j]]--;}

		for(int j=1;j<2*N;j++)tt[j]+=tt[j-1];

		for(int j=0;j<2*N;j++)if(tt[j])rec[j]++;
	}
	int mx=0;
	for(int i=0;i<2*N;i++)mx=max(rec[i],mx);

	cout<<mx;



	
}

Measured memory_bytes: 9108
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
lint dp[5010][5010];
int main()
{
	memset(dp,0,sizeof(dp));
	int n;string s;cin>>n;cin>>s;lint mo=1000000007;
	dp[0][s.size()]=1;
	rep(i,n) rep(j,5005){
		dp[i][j]%=mo;
		//if(j<5) cout<<i<<' '<<j<<' '<<dp[i][j]<<endl;
		if(j>0){
			dp[i+1][j+1]+=dp[i][j]*2;
			dp[i+1][j-1]+=dp[i][j];
		}
		else{
			dp[i+1][j+1]+=dp[i][j]*2;
			dp[i+1][j]+=dp[i][j];
		}
	}
	cout<<(dp[n][0])%mo<<endl;
}


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

using namespace std;
const int N=21;
int dp[N][(1<<N)];
int a[N][N];
int n;
int m=1e9+7;

int bt(int i , int mask)
{
    if(i==n)
        return (mask==((1<<n)-1));
    if(dp[i][mask]!=-1)
        return dp[i][mask];
    int ret=0;
    for(int j=0;j<n;j++)
    {
        if(((mask&(1<<j))==0)&&a[i][j])
        {
            ret+=bt(i+1,(mask|(1<<j)));
            ret%=m;
        }
    }
    dp[i][mask]=ret;
    return ret;
}

int main()
{
    memset(dp,-1,sizeof dp);
    cin>>n;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cin>>a[i][j];
        }
    }
    cout<<bt(0,0)<<endl;
    return 0;
}


Measured memory_bytes: 172288
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Date;
import java.util.LinkedList;
import java.util.ListIterator;

public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());

		Date from = new Date();
		LinkedList<Integer> list = new LinkedList<Integer>();
		for(int i = 0; i < n; i++){
			String[] strArray = br.readLine().split(" ");
			String inst = strArray[0];

			if(inst.equals("insert")){
				list.addFirst(Integer.parseInt(strArray[1]));
			}
			else if(inst.equals("delete")){
				list.removeFirstOccurrence(Integer.parseInt(strArray[1]));
			}
			else if(inst.equals("deleteFirst")){
				list.poll();
			}
			else if(inst.equals("deleteLast")){
				list.removeLast();
			}
			//System.out.println("i = " + i);
			//printList(list);

		}
		Date to = new Date();
		printList(list);
	}

	static void printList(LinkedList<Integer> list){

		Date from = new Date();
		int j = 0;
		StringBuffer sb = new StringBuffer();
		ListIterator<Integer> it = list.listIterator();
		for(int i = 0; i < list.size() ; i++){
			//list.get(i);

			int tmp = it.next();
			sb.append(String.valueOf(tmp));
			if(i != list.size() - 1){
				sb.append(" ");
			}

		}

		System.out.println(sb.toString());
		Date to = new Date();
		//System.out.println("it takes"+(to.getTime() - from.getTime()));
	}
}


Measured memory_bytes: 204640
from collections import Counter

N = int(input())
S = input()

left, right = S[:N], S[N:][::-1]
a, b = Counter(), Counter()

for i in range(2 ** N):
    t = u = v = w = ""
    for j in range(N):
        if (i >> j) & 1:
            t += left[j]
            u += right[j]
        else:
            v += left[j]
            w += right[j]
    a[t, v] += 1
    b[u, w] += 1

print(sum(a[t] * b[t] for t in a.keys()))

Measured memory_bytes: 174384
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;
using TextReader = System.IO.TextReader;
using System.Text;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var a = consoleReader.Int;
            var b = consoleReader.Int;
            var c = consoleReader.Int;
            var d = consoleReader.Int;
            if (Math.Abs(a - c) <= d)
                return "Yes";
            else if (Math.Abs(a - b) <= d && Math.Abs(c - b) <= d)
                return "Yes";
            else
                return "No";
        }

        #region いつもの
        private readonly ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader(Console.In)).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
        #endregion
    }
#pragma warning disable
    public class ConsoleReader
    {
        private string[] line = Array.Empty<string>();
        private int linePosition;
        private TextReader textReader;
        public ConsoleReader(TextReader tr) { textReader = tr; }
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
        public string String
        {
            get
            {
                if (linePosition >= line.Length)
                {
                    linePosition = 0;
                    line = textReader.ReadLine().Split();
                }
                return line[linePosition++];
            }
        }
        public class SplitLine
        {
            private string[] splited;
            public SplitLine(ConsoleReader cr) { splited = cr.textReader.ReadLine().Split(); }
            public int[] Int => String.Select(x => int.Parse(x)).ToArray();
            public long[] Long => String.Select(x => long.Parse(x)).ToArray();
            public double[] Double => String.Select(x => double.Parse(x)).ToArray();
            public string[] String => splited;
        }
        public SplitLine Split => new SplitLine(this);
        public class RepeatReader
        {
            ConsoleReader cr; int count;
            public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; }
            public IEnumerable<T> Select<T>(Func<ConsoleReader, T> func) { for (int i = 0; i < count; i++) yield return func(cr); }
            public IEnumerable<string> String { get { for (int i = 0; i < count; i++) yield return cr.String; } }
            public IEnumerable<int> Int { get { for (int i = 0; i < count; i++) yield return cr.Int; } }
            public IEnumerable<double> Double { get { for (int i = 0; i < count; i++) yield return cr.Double; } }
        }
        public RepeatReader Repeat(int count) => new RepeatReader(this, count);
    }
}

Measured memory_bytes: 13140
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		final int D = sc.nextInt();
		
		final int div = N / (2 * D + 1);
		final int mod = N % (2 * D + 1);
		
		if (mod == 0) {
			System.out.println(div);
		} else {
			System.out.println(div + 1);
		}
	}

}

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

int main()
{
  std::string S;
  std::cin>>S;
  
  int count=0;
  int maxCount=0;
  for(int i=0;i!=S.size();i++)
  {
    if(S[i]=='A'||S[i]=='C'||S[i]=='G'||S[i]=='T')
    {
      count++;
      maxCount=count>maxCount?count:maxCount;
    }
    else
    {
      count=0;
    }      
  }
  
  std::cout<<maxCount<<std::endl;
  
  return 0;
}

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

int		main(void)
{
	int n;

	cin >> n;
	vector<int> nums(n);

	for (int i = 1; i <= n; i++)
		nums[i - 1] = i; 
	int ans = 1, ans_cnt = 0;

	for (int i = 0; i < n; i++)
	{
		int tmp = nums[i];
		int cnt = 0;
		while (tmp % 2 == 0)
		{
			cnt++;
			tmp /= 2;
		}
		if (ans_cnt < cnt)
		{
			ans_cnt = cnt;
			ans = nums[i];
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
N, A, B, C, D = map(int, input().split())
S = input()

not_pass_array = []
can_change_array = []

for i in range(len(S) - 2):
    if S[i] == "#" and S[i + 1] == "#":
        not_pass_array.append(i)
    elif S[i] == "." and S[i + 1] == "." and S[i + 2] == ".":
        can_change_array.append(i + 1)
if S[-1] == "#" and S[-2] == "#":
    not_pass_array.append(len(S) - 2)

# print(not_pass_array, can_change_array)
A = A - 1
B = B - 1
C = C - 1
D = D - 1
if C < D:
    for i in not_pass_array:
        if A >= i:
            continue
        if D <= i:
            print("Yes")
            exit()
        if (A < i and i < C) or (B < i and i < D):
            print("No")
            exit()
    else:
        print("Yes")
        exit()

else:
    for i in not_pass_array:
        if A >= i:
            continue
        if C <= i:
            break
        if (A < i and i < C) or (B < i and i < D):
            print("No")
            exit()
    for b_pos in can_change_array:
        if b_pos >= B and b_pos <= D:
            print("Yes")
            exit()
    print("No")


Measured memory_bytes: 40304
using System;

namespace ITP1_9_C
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int a = 0, b = 0;
            for (int i = 0; i < n; i++)
            {
                string[] strs = Console.ReadLine().Split(' ');
                if (string.Compare(strs[0], strs[1]) > 0) a += 3;
                else if (string.Compare(strs[0], strs[1]) < 0) b += 3;
                else { a++; b++; }
            }
            Console.WriteLine(a + " " + b);
        }
    }
}

Measured memory_bytes: 9868
#include <atcoder/all>
#include "bits/stdc++.h"
using namespace std;
using namespace atcoder;

int n,q,t,u,v;

int main()
{
	scanf("%d%d",&n,&q);
	auto ds=dsu(n);
	while(q--)
	{
		scanf("%d%d%d",&t,&u,&v);
		if(t==0) ds.merge(u,v);
		else printf("%d\n",ds.same(u,v));
	}
}

Measured memory_bytes: 3960
//I AM THE CREED
/* //I AM THE CREED
/* package codechef; // don't place package name! */
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.StringTokenizer; 
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException 
    { 
  
        Scanner input = new Scanner(System.in);
        while(input.hasNext()){
            int n=input.nextInt();
            int s=7;
            int digits=1;
            HashSet<Integer> remainders=new HashSet<>();
            while(n>s){
                s=(s*10)+7;
                digits++;
            }
            boolean possible=true;
            int prev=s%n;
            remainders.add(prev);
            while(prev!=0){
                int mod=((prev*10)+7)%n;
                digits++;
                if(mod==0){
                    break;
                }
                if(remainders.contains(mod)){
                    possible=false;
                    break;
                }
                remainders.add(mod);
                prev=mod;
            }
            if(possible){
                System.out.println(digits);
                continue;
            }
            System.out.println(-1);
            
            
        }
        
    }
    


}

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


int main() {
    vector<vector<int>> a(3, vector<int>(3));
    rep(i,3) rep(j,3) cin >> a.at(i).at(j);

    int n; cin >> n;

    vector<int> b(n);
    rep(i,n) cin >> b[i];

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
                if(a[j][k] == b[i]) a[j][k] = 0;
            }
        }
    }

    int count = 0;
    for (int i = 0; i < 3; ++i) {
        if(a[i][0] + a[i][1] + a[i][2] == 0) count++;
    }
    for (int i = 0; i < 3; ++i) {
        if(a[0][i] + a[1][i] + a[2][i] == 0) count++;
    }
    if(a[0][0] + a[1][1] + a[2][2] == 0)count++;
    if(a[0][2] + a[1][1] + a[2][0] == 0)count++;

    if(count > 0)print("Yes");
    else print("No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORr(i, k, n) for(int i = (k); i > (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORr(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(void){
  int n;
  cin >> n;
  
  vector<vector<int>> a(n, vector<int>(n-1));
  REP(i, n){
    REP(j, n-1){
      cin >> a[i][j];
      a[i][j]--;
    }
    reverse(ALL(a[i]));
  }

  vector<P> q;
  auto check = [&](int i){
    if(a[i].size() == 0) return;
    int j = a[i].back();
    if(a[j].size() == 0) return;
    if(a[j].back() == i){
      if(j < i) swap(i, j); 
      q.emplace_back(P(i, j));
    }
  };
  REP(i, n){
    check(i);
  }
  int day = 0;
  while(q.size() > 0){
    day++;
    sort(ALL(q));
    q.erase(unique(ALL(q)), q.end());
    vector<P> prevQ;
    swap(prevQ, q);
    for(P p : prevQ){
      int i = p.first;
      int j = p.second;
      a[i].pop_back();
      a[j].pop_back();
    }
    for(P p : prevQ){
      int i = p.first;
      int j = p.second;
      check(i);
      check(j);
    }
  }

  REP(i, n){
    if(a[i].size() != 0){
      cout << -1 << endl;
      return 0;
    }
  }

  cout << day << endl;

  return 0;
}

Measured memory_bytes: 6272
#include <iostream>
#include <iomanip>
#include <queue>
#include <deque>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <bitset>

#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x, y) memset(x, y, sizeof(x))
#define pb push_back
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

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 (a > b) {
      a = b;
      return 1;
   }
   return 0;
}

using namespace std;
using ll = long long;

const int kInf = 2e9;
const ll kLInf = 2e18;

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

int N;

int main()
{
   cout << fixed << setprecision(10);
   cin >> N;
   int X = ceil(N / 1.08);
   if (floor(X * 1.08) != N) {
      cout << ":(" << endl;
   } else {
      cout << X << endl;
   }
   
   return 0;
}



Measured memory_bytes: 256
def main():
    r,g,b = map(int, input().split())
    k=int(input())
    for _ in range(k):
        if r >= g:
            g *= 2
        elif g >= b:
            b *= 2
        else:
            break
    print("Yes" if r<g<b else "No")

if __name__ == '__main__':
    main()

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

using namespace std;

typedef long long ll;
typedef long double ld;

int good[100005];
int h[100005];


int main(){
    ios_base::sync_with_stdio(false);
	cout.precision(10);
	cout << fixed;

    int n, m;
    cin >> n >> m;
    for(int i=1; i<=n; i++){
        cin >> h[i];
        good[i] = 1;
    }
    while(m--){
        int a, b;
        cin >> a >> b;
        if(h[a] >= h[b]) good[b] = 0;
        if(h[b] >= h[a]) good[a] = 0;
    }
    int res = 0;
    for(int i=1; i<=n; i++) res += good[i];
    cout << res;
    return 0;
}


Measured memory_bytes: 4396
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int main(){
	cin>>a>>b>>c;
	if(a==b&&a!=c)
		printf("Yes");
		else if(a==c&&a!=b)
			printf("Yes");
			else if(b==c&&a!=b)
				printf("Yes");
			
	else
	printf("No");
	return 0;
	
} 

Measured memory_bytes: 256
s = str(input())
t = str(input())
temp = s
answer = "No"
if temp==t:
    answer = "Yes"
else:
    for i in range(len(s)):
        temp = s[-1]+s[:-1]
        if temp==t:
            answer = "Yes"
            break
        s = temp
print(answer)    

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dbg puts("It's Just Begining.Wait For The End!!!!!\n")
#define CHECK(x) cout << (#x) << " is " << (x) <<"\n";
#define endl printf("\n")
typedef pair<ll,ll> pii;
#define pb push_back
#define ms(a,b) memset(a, b, sizeof(a))
#define in(x) scanf("%lld",&x)
#define out(x) printf("%lld",x)
#define sps printf(" ");
#define X first
#define Y second
#define dou(x) cout<<fixed<<setprecision(6)<<x
#define MAX 100005
#define mod 1000000007
int main()
{
    ll a,b,c;
    in(a);in(b);in(c);
    if((a==b&&b!=c)||(b==c&&a!=c)||(a==c&&b!=c))puts("Yes");
    else puts("No");
    return 0;
}


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

int main(){
    string s;
    cin >> s;
if(s.at(2) == s.at(3) && s.at(4) == s.at(5)){
    cout << "Yes" << endl;
}else{
    cout << "No" << endl;
}
}

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

int main(){
  int n;
  cin>> n;
  string s;
  cin>> s;
  int ans=0;
  rep(i,n-1){
    if(s[i]!=s[i+1])++ans;
  }
  ans++;
  cout<< ans<< endl;
  return 0;
}

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


int main(void)
{
	int n = 0;
	int ans = 0;
	int input = 0;

	while (scanf("%d" , &n) && n != 0)
	{
		ans = 0;
		for (int i = 0; i < n / 4; i++)
		{
			cin >> input;
			ans += input;
		}

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1248
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		long x = in.nextLong();
		long a = in.nextLong();
		long b = in.nextLong();
		if(a >= b){
			System.out.println("delicious");
		}else if(x >= b - a){
			System.out.println("safe");
		}else{
			System.out.println("dangerous");
		}
	}
}


Measured memory_bytes: 21972
using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var nab = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var n = nab[0];
        var a = nab[1];
        var b = nab[2];

        Console.WriteLine(Math.Min(a * n, b));
    }
}


Measured memory_bytes: 13268
import numpy as np

N = input()
K = int(input())

dp = np.zeros((len(N), 2, K+1), dtype=np.int)

for i in range(len(N)) : 
    n = int(N[i])
    if ( i == 0 ) :
        dp[i][0][0] = 1
        dp[i][0][1] = n-1
        dp[i][1][0] = 0
        dp[i][1][1] = 1
    else : 
        if n == 0 : 
            dp[i][0][0] = dp[i-1][0][0] 
            dp[i][1][0] = dp[i-1][1][0]
            for k in range(1,K+1) :
                dp[i][0][k] = dp[i-1][0][k-1]*9 + dp[i-1][0][k] 
                dp[i][1][k] = dp[i-1][1][k]
        else : 
            dp[i][0][0] = dp[i-1][0][0] + dp[i-1][1][0]
            dp[i][1][0] = 0
            for k in range(1, K+1) :
                dp[i][0][k] = dp[i-1][0][k-1]*9 + dp[i-1][0][k] + dp[i-1][1][k-1] * (n-1) + dp[i-1][1][k]
                dp[i][1][k] = dp[i-1][1][k-1]

#for k in range(K+1) :
#    print( "_" * 10 )
#    print( "K == {}".format(k) )
print( dp[len(N)-1][0][K] + dp[len(N)-1][1][K] )



Measured memory_bytes: 12504
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double tax = 1.08;
		int candidateAmount = (int) Math.ceil(N / tax);
		if ((int) Math.floor(candidateAmount * tax) == N) {
			System.out.print(candidateAmount);
		} else {
			System.out.print(":(");
		}
	}
}


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    double w, h, x, y;
    cin >> w >> h >> x >> y;

    //cout << w * h / 2.0 << " " <<(x*2 == w && y *2 == h ? 1 : 0) << endl;
    printf("%lf %d\n",w * h / 2.0, (x*2 == w && y * 2 == h ? 1 :0));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   for(int i=0;i<(n);++i)
#define SORT(c)    sort((c).begin(),(c).end())
const double EPS = 1e-10;//sample:if((double)>=(double)+EPS)
#define CLR(a) memset((&a), 0 ,sizeof(a))//clear memory
#define dump(x)  cerr << #x << " = " << (x) << endl;//debug
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
//cin,cout release
//std::cin.tie(0);
//ios::sync_with_stdio(false);

unsigned long long int cnt=0;
using namespace std;
void merge(int A[], int left, int mid, int right){
  int n1=mid-left,n2=right-mid,L[300000],R[300000];
  for(int i=0;i<n1;i++)L[i] = A[left+i];
  for(int i=0;i<n2;i++)R[i] = A[mid+i];
  L[n1]=R[n2]=INT_MAX;
  int i=0,j=0;
  for(int k=left;k<right;k++){
    if(L[i]<=R[j]) A[k]=L[i++];
    else {
      A[k]=R[j++];
      cnt+=n1-i;
    }
  }
}
void mergeSort(int A[], int left, int right){
  if(left+1<right){
    int mid = (left + right) / 2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}

int main(){
  int n;
  cin>>n;
  int S[300000];
  for(int i=0;i<n;i++)scanf("%d",&S[i]);
  mergeSort(S,0,n);
  //for(int i=0;i<n-1;i++)cout<<S[i]<<" ";
  //cout<<S[n-1]<<endl;
  cout<<cnt<<endl;
  return 0;
}



Measured memory_bytes: 4800
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int n;cin>>n;
	vector<int> arr(n);
	for(int i=0;i<n;++i) cin>>arr[i];
	vector<int> pff(n);
	pff[0]=arr[0];
	for(int i=1;i<n;++i) pff[i]=min(arr[i],pff[i-1]);
	int count=0;
	for(int i=0;i<n;++i){
		if(arr[i]<=pff[i]) ++count;
	}
	cout<<count<<"\n";
	return 0;
}

Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
#ABC110C
import sys

s = input()
t = input()

#tmp = input().split()
#hoge = list(map(lambda a: int(a), tmp))
#n=hoge[0]
#x=hoge[1]

checktable=[]
checktable2=[]
for i in range(0,26):
	checktable.append(0)
	checktable2.append(0)

for i in range(0,len(s)):
	index=ord(s[i])-ord("a")
	if(checktable[index]==0):
		checktable[index]=ord(t[i])-ord("a")
	else:
		if(checktable[index]!=ord(t[i])-ord("a")):
			print("No")
			sys.exit()
for i in range(0,len(s)):
	index=ord(t[i])-ord("a")
	if(checktable2[index]==0):
		checktable2[index]=ord(s[i])-ord("a")
	else:
		if(checktable2[index]!=ord(s[i])-ord("a")):
			print("No")
			sys.exit()
print("Yes")



Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
  string S;
  int K; cin>>S>>K;
  rep(i,K){
    if(S.at(i)=='1'&&i==K-1){
      cout<<1<<endl;
      return 0;
    }
    else if(S.at(i)!='1'){
      cout<<S.at(i)<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3524
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,a=0; cin>>n;
  string s,x,y; cin>>s;
  for(int i=1; i<n; i++){
    int cnt=0;
    x=s.substr(0,i);
    y=s.substr(i);
    for(char c='a'; c<='z'; c++){
      if(count(x.begin(),x.end(),c)!=0 && count(y.begin(),y.end(),c)!=0) cnt++;
    }
    a=max(a,cnt);
  }
  cout<<a;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B;
    cin >> A >> B;
    if(B == 1){
        cout << 0 << endl;
        return 0;
    }
    int cnt = 1;
    int tap = A;
    if(tap >= B){
        cout << 1 << endl;
        return 0;
    }
    while(tap < B){
        tap += A-1;
        cnt++;
    }
    cout << cnt << endl;
}


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

int sum(int x, int y)
{
	return x+y;
}
int sub(int x, int y)
{
	return x-y;
}
int mul(int x, int y)
{
	return x*y;
}

int main(void)
{
	int a, b, sm, sb, ml, gr=1010;
	scanf("%d %d", &a, &b);
	
	sm = sum(a, b);
	sb = sub(a, b);
	ml = mul(a, b);
	
	if(sm >= sb && sm >= ml) gr = sm;
	else if(sb >= sm && sb >= ml) gr = sb;
	else if(ml >= sm && ml >= sb) gr = ml;
	
	printf("%d\n", gr);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long n , x[500000] , sum ;
int main(){
	cin >> n;
	for(int i = 1 ; i <= 3*n ; i++){
		cin >> x[i];
	}
	sort(x + 1 , x + (3*n) + 1);
	for(int i = (3*n) - 1 ; i >= n ; i -= 2){
		sum += x[i];
	}
	cout << sum << endl;
}

Measured memory_bytes: 5972
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
#include<cctype>

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max)) 

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VII;
typedef pair<int,int> PII;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

struct Cake{
	Cake(int w_, int h_, int cuti_):w(w_), h(h_), size(w_ * h_), cuti(cuti_){}
	int w;
	int h;
	int size;
	int cuti;
	bool operator <(const Cake& b) const{
		if(cuti == b.cuti){
			return size < b.size;
		}
		else{
			return cuti < b.cuti;
		}
	}
};

vector<Cake> cakes;

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int N, W, D;

	while(1){
		cakes.clear();
		cin >> N >> W >> D;
		if(N == 0 && W == 0 && D == 0) break;
		VI p(N), s(N);
		rep(i, N){
			cin >> p[i] >> s[i];
			p[i]--;
		}
		cakes.pb(Cake(W, D, 0));
		rep(i, N){
			Cake cake = cakes[p[i]];
			cakes.erase(cakes.begin() + p[i]);
			s[i] %= cake.w + cake.h;
			if(s[i] < cake.w){
				cakes.pb(Cake(s[i], cake.h, i + 1));
				cakes.pb(Cake(cake.w - s[i], cake.h, i + 1));
			}
			else{
				s[i] -= cake.w;
				cakes.pb(Cake(cake.w, s[i], i + 1));
				cakes.pb(Cake(cake.w, cake.h - s[i], i + 1));
			}
			sort(all(cakes));
		}
		VI S;
		rep(i,cakes.size()){
			S.pb(cakes[i].size);
		}
		sort(all(S));
		rep(i,S.size()){
			cout << S[i] << (i == S.size() - 1? '\n' : ' ');
		}
	}
	return 0;
}

Measured memory_bytes: 1240
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N, M = map(int, readline().split())

    students = []

    for _ in range(N):
        a, b = map(int, readline().split())
        students.append((a, b))

    cp = []
    for _ in range(M):
        c, d = map(int, readline().split())
        cp.append((c, d))

    for i in range(N):
        dist_min = INF
        idx = -1
        x1, y1 = students[i]
        for j in range(M):
            x2, y2 = cp[j]
            dist_cur = abs(x2 - x1) + abs(y2 - y1)
            if dist_cur < dist_min:
                dist_min = dist_cur
                idx = j + 1
        print(idx)


if __name__ == '__main__':
    main()


Measured memory_bytes: 67312