akhauriyash/Code-Regression huggingface dataset:
// FindingMissingCards.c
// 太郎が花子と一緒にトランプ遊びをしようとしたところ、
// 52枚あるはずのカードが n 枚のカードしか手元にありません。
// これらの n 枚のカードを入力として、足りないカードを出力するプログラムを作成して下さい。
//
// 太郎が最初に持っていたトランプはジョーカーを除く52枚のカードです。
//
// 52枚のカードは、スペード、ハート、クラブ、ダイヤの４つの絵柄に分かれており、
// 各絵柄には13のランクがあります。
// 【入力】
// 最初の行に太郎が持っているカードの枚数 n (n ≤ 52)が与えられます。
//
// 続いて n 組のカードがそれぞれ１行に与えられます。
// 各組は１つの空白で区切られた文字と整数です。文字はカードの絵柄を表し、
// スペードが'S'、ハートが'H'、クラブが'C'、ダイヤが'D'で表されています。
// 整数はそのカードのランク(1 ～ 13)を表しています。
// 【出力】
// 足りないカードをそれぞれ1行に出力して下さい。
// 各カードは入力と同様に１つの空白で区切られた文字と整数です。
// 出力するカードの順番は以下のとおりとします：
// 
// 絵柄がスペード、ハート、クラブ、ダイヤの順番で優先的に出力する。
// 絵柄が同じ場合は、ランクが小さい順に出力する。
// 【例】
// 入力：
// 47
// S 10
// S 11
// S 12
// S 13
// H 1
// H 2
// S 6
// S 7
// S 8
// S 9
// H 6
// H 8
// H 9
// H 10
// H 11
// H 4
// H 5
// S 2
// S 3
// S 4
// S 5
// H 12
// H 13
// C 1
// C 2
// D 1
// D 2
// D 3
// D 4
// D 5
// D 6
// D 7
// C 3
// C 4
// C 5
// C 6
// C 7
// C 8
// C 9
// C 10
// C 11
// C 13
// D 9
// D 10
// D 11
// D 12
// D 13
// 出力：
// S 1
// H 3
// H 7
// C 12
// D 8
#include<stdio.h>

int main( void) {
  int n;
  int cards[4][13] = {};
	// 行は絵柄、列はランク
	// 絵柄：0=S（スペード）,1=H（ハート）,2=C（クラブ）,3=D（ダイヤ）

  char suitChar;
  int suit, rank1;

  // 太郎が持っているカードを入力から受け取る。
  scanf( "%d\n", &n);	// 入力されるカードの枚数
  for ( int i = 0; i < n; i++) {
    scanf( "%c %d\n", &suitChar, &rank1);
    if ( suitChar == 'S') suit = 0;
    else if ( suitChar == 'H') suit = 1;
    else if ( suitChar == 'C') suit = 2;
    else suit = 3;

    cards[suit][rank1-1] = 1;
  }

  // 太郎が持っていないカードを出力する。
  for ( int i = 0; i < 4; i++) {
    for ( int j = 0; j < 13; j++) {
      if ( cards[i][j] == 0) {
	if ( i == 0) suitChar = 'S';
	else if ( i == 1) suitChar = 'H';
	else if ( i == 2) suitChar = 'C';
	else suitChar = 'D';

	printf( "%c %d\n", suitChar, j+1);
      }
    }
  }

  return 0;
}



Measured memory_bytes: 2144
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{




	public static void main(String[] args){

		int len;
		String array[];

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));

		try{
		String str=reader.readLine();
		array=str.split(" ");

		len=array.length;

		Stack stack=new Stack(len);
		int tmp;

		for(int i=0;i<len;i++){
			switch(array[i]){
			case"+":
				tmp=stack.pop()+stack.pop();
				stack.push(tmp);
				break;
			case"-":
				tmp=stack.pop()-stack.pop();
				stack.push(-tmp);
				break;
			case"*":
				tmp=stack.pop()*stack.pop();
				stack.push(tmp);
				break;
			default:
				tmp=Integer.parseInt(array[i]);
				stack.push(tmp);
			}//swicth

		}//for

		System.out.println(stack.pop());



		}catch(IOException e){

		}

	}//main
}

class Stack{
	int max;
	int ptr;
	int[] array;

	Stack(int capacity){//?????????????????????
		max=capacity;
		ptr=0;
		array=new int[max];
	}

	public void push(int p){
		if(ptr<=max)array[ptr++]=p;
	}//push????????????

	public int pop(){
		if(ptr>0)return array[--ptr];
		else return -1;
	}//pop????????????

}//stack?????????

Measured memory_bytes: 24388
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // write your code here
        //dream dreamer erase eraser
        int H;
        int W;
        String[] sList;
        try (Scanner sc = new Scanner(System.in)) {
            H = sc.nextInt();
            W = sc.nextInt();
            sList = new String[H];
            for (int i = 0; i < H; i++) {
                sList[i] = sc.next();
            }
        }
        long mass[][] = new long[H + 2][W + 2];

        for (int i = 1; i <= H; i++) {
            char[] c = sList[i - 1].toCharArray();
            for (int j = 1; j <= W; j++) {
                if (c[j - 1] == '#') {
                    mass[i][j] = 1;
                }
            }
        }

        for (int i = 1; i <= H; i++) {
            for (int j = 1; j <= W; j++) {
                if (mass[i][j] == 1 && !addSurroundMass(mass, i, j)) {
                    System.out.println("No");
                    return;
                }
            }

        }
        System.out.println("Yes");
        return;
    }

    private static boolean addSurroundMass(long[][] mass, int i, int j) {
        boolean result = mass[i - 1][j] == 1 ||
                mass[i][j - 1] == 1 ||
                mass[i][j + 1] == 1 ||
                mass[i + 1][j] == 1;
        return result;
    }
}


Measured memory_bytes: 22228
//template---{{{
//Header file---{{{
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
//}}}
using namespace std;
 
//DEFINE---{{{
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b); i > (a); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
//end.DEFINE---}}}
 
//end.template ---}}}
 
int main() {
  int N;
  double T, A;
  double H[1000];
  double Htemp[1000];
  int res = 0;
  double num;
 
  cin >> N;
  cin >> T >> A;
 
  REP(i, N) {
    cin >> H[i];
  }


  REP(i, N) {
    Htemp[i] = (T - (H[i] * 0.006)) - A;
  }

  num = Htemp[0];

  for (int i = 1; i < N; ++i) {
    if (num < 0) num *= -1;
    if (Htemp[i] < 0) Htemp[i] *= -1;
    if (num > Htemp[i]) {
      num = Htemp[i];
      res = i;
    }
  }

  cout << res + 1 << endl;

  return (0);
}


Measured memory_bytes: 256
s = input()

n = len(s)

a = 0
b = 0
c = 0

for i in range(n):
    if s[i] == 'a':
        a += 1
    elif s[i] == 'b':
        b += 1
    else:
        c += 1
min_num = min(a,b,c)
a -= min_num
b -= min_num
c -= min_num

if a <= 1 and b <= 1 and c <= 1:
    print('YES')
else:
    print('NO')

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

using namespace std;

const int maxn = 3010;
int dp[maxn][maxn], par[maxn][maxn];
string s, t;

int main()
{
    ios::sync_with_stdio(false);
    cin >> s >> t;

    for (int i = 1; i <= s.size(); i++)
        for (int j = 1; j <= t.size(); j++)
            if (s[i - 1] == t[j - 1])
                dp[i][j] = dp[i - 1][j - 1] + 1, par[i][j] = 1;
            else if (dp[i - 1][j] > dp[i][j - 1])
                dp[i][j] = dp[i - 1][j], par[i][j] = 2;
            else
                dp[i][j] = dp[i][j - 1], par[i][j] = 3;

    string ans;
    for (int i = s.size(), j = t.size(); i && j;)
    {
        if (par[i][j] == 1)
            ans = s[i - 1] + ans, --i, --j;
        else if (par[i][j] == 2)
            --i;
        else
            --j;
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 70912
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORR(x,arr) for(auto& x:arr)
#define VI vector<int>
#define PII pair<int, int>
#define FI first 
#define SE second
#define ALL(x) (x).begin(), (x).end()
const int INF=1<<30; const ll LINF=1LL<<60 ; const ll MOD=1e9+7 ;
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; }
//-------------------
int p,q,r;

int main(){
	cin >> p >> q >> r;
	int ans = p+q+r;
	ans -= max(p,max(q,r));
	cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <queue>

using namespace std;

const int INF = 1e9;
int k;
int a[100005];
queue<int> qp, qq;

void f(int p, int q)
{
    if(a[p] <= q) return;
    a[p] = q;
    f(p * 10 % k, q);
    f((p + 1) % k, q + 1);
}

int main()
{
    scanf("%d", &k);
    for(int i = 0; i < k; i++) a[i] = INF;
//  f(1, 1);
    qp.push(1), qq.push(1);
    while(!qp.empty())
    {
        int p = qp.front(), q = qq.front();
        qp.pop(), qq.pop();
        if(a[p] <= q) continue;
        a[p] = q;
        qp.push(p * 10 % k), qq.push(q);
        qp.push((p + 1) % k), qq.push(q + 1);
    }
    printf("%d", a[0]);
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
using namespace std;
int main(void){
  string s;cin>>s;
  int l=(s[0]=='o')?0:1,r=(s[s.size()-1]=='o')?0:1;
  int cnto=0,cntx=0;
  for(int i=0;i<s.size();){
    char tmp=s[i];
    if(tmp=='o') ++cnto;
    else ++cntx;
    while(s[i]==tmp)++i;
  }
  int turn=0;
  while(cnto&&cntx){
    if(l!=turn){
      if(l) --cntx;
      else --cnto;
      l=turn;
    }
    else if(r!=turn){
      if(r) --cntx;
      else --cnto;
      r=turn;
    }
    turn=(turn+1)%2;
  }
  cout<<((cnto)?'o':'x')<<endl;
  return 0;
}

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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long

static const ll MAX = 1000000;
static const ll INFTY = 1e12;
static const ll MOD = 1000000007;

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const ll INF = 1e18;


int main() {

    int H, W;
    cin >> H >> W;
    int h=H, w=W;
    int Hcount = 0;
    int Vcount = 0;
    // vector<vector<char>> a(H+10, vector<char>('0', W+10));
	vector<string> a(h);
	for (int i = 0; i < h; i++) {
		cin >> a[i];
	}
    vector<int> trueH(H+10, 0), trueW(W+10, 0);

	vector<bool> row(h, false);
	vector<bool> col(w, false);
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}
 
	for (int i = 0; i < h; i++) {
		if (row[i]) {
			for (int j = 0; j < w; j++) {
				if (col[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}

    
}

/*
みんな、くるくるぱーにな〜れ
　∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/



Measured memory_bytes: 256
use std::io::{self, BufRead};

fn main() {
  let stdin = io::stdin();
  let mut lines = stdin.lock().lines();
  let s: Vec<char> = lines.next().unwrap().unwrap().chars().collect();
  let ans = if s[2] == s[3] && s[4] == s[5] { "Yes" } else { "No" };
  println!("{}", ans);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll ZERO = 0;
const ll INF = 1e14;
const ll MOD = 1000000007;
const double PI = 3.1415926535897;

int main() {
    char A;
    cin >> A;
    A += 1;
    cout << A << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forn for(int i=0;i<n;i++)
int main()
{
    int n;
    string s;
    map<string,int> data;
    cin>>n;
  int ans=0;
	for(int i=1; i<=n; i++)
	{
		cin>>s;
		if(!data[s])
		{
			data[s]=1;
			ans++;
		}
		else
		{
			data[s]=0;
			ans--;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 12544
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main() {
    int n,m;
    cin >> n >> m;
    int h[n], ma[n];
    REP(i,n) {
        cin >> h[i];
        ma[i]=0;
    }
    REP(i,m){
        int a,b;
        cin>>a>>b;
        ma[a-1] = max(ma[a-1],h[b-1]);
        ma[b-1] = max(ma[b-1],h[a-1]);
    }

    int ans=0;
    REP(i,n) {
        if(ma[i]<h[i]) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4408
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600
#define long long long // for codeforces

int main(){
  string s;
  cin>>s;
  set<char> st;
  for(auto c : s) st.insert(c);

  if(s.size()==st.size()) cout << "yes" << endl;
  else cout << "no" << endl;

  return 0;
}


Measured memory_bytes: 256
from collections import Counter

n=int(input())
a=list(map(int,input().split()))
c=Counter(a)
if (1 in c.values() and c[0]!=1) or 3 in c.values():
    print(0)
else:
    if n%2==0:
        print((2**(n//2))%(10**9+7))
    else:
        print((2**((n-1)//2))%(10**9+7))

Measured memory_bytes: 14820
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
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; }

int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(){
    ll l, r;
    cin >> l >> r;
    ll ans = 10000000;
    if (r - l >= 2019){
        ans = 0;
    }else{
        for(ll li = l; li < r; li++){
            for(ll ri = li + 1; ri <= r; ri++){
                ans = min(ans, (li * ri)%2019);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3532
#include <bits/stdc++.h>
using ll = unsigned long long int;
using namespace std;
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)

int main() {
    fastIO;
    string a, b;
    cin >> a >> b;

    int num = stoi(a + b);
    for (int i = 1; i * i <= num; i++) {
        if (num == i * i) {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
#include <numeric>
#include <map>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    if (c)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

ll gcdll(ll a, ll b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

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

bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    cout << ((n * a > b) ? b : n * a) << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;

public class Main {
	public static void main(String[] args) {
		FastReader r = new FastReader();		
		int count = r.ri();
		String[] arr = r.rsa();
		Set<String> set = new HashSet<>();
		for(String s : arr)
			set.add(s);
		if(set.size()==3)
			print("Three");
		else
			print("Four");
	}
	
	public static int getDigitSum(int n) {
		String str = ""+n;
		int sum = 0;
		for(int i = 0; i<str.length();i++) {
			sum += Integer.parseInt(""+str.charAt(i));
		}
		return sum;
	}

	public static void rolling(int[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}
	
	public static void rolling(long[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}

	public static void reverse(int[] arr) {
		for (int i = 0; i < arr.length / 2; i++) {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		}
	}
	
	public static void swap(int[] arr, int pos1, int pos2) {
		int temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	public static void swap(long[] arr, int pos1, int pos2) {
		long temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	
	public static String al(String s) {
		return s + "\n";
	}

	public static void print(String s) {
		System.out.println(s);
	}

	public static void print(long s) {
		System.out.println(s);
	}

	public static void print(int s) {
		System.out.println(s);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		int ri() {
			return Integer.parseInt(str());
		}

		long rl() {
			return Long.parseLong(str());
		}

		double rd() {
			return Double.parseDouble(str());
		}

		String str() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		String[] rsa() {
			return str().split(" ");
		}

		int[] ria() {
			String[] s = rsa();
			int[] arr = new int[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]);
			return arr;
		}

		long[] rla() {
			String[] s = rsa();
			long[] arr = new long[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]);
			return arr;
		}

		char[] rca() {
			String s = str();
			char[] arr = new char[s.length()];
			for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i);
			return arr;
		}
		
		String[] rsaml(int m) {
			String[] arr = new String[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = str();
			return arr;
		}

		int[] riaml(int m) {
			int[] arr = new int[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(str());
			return arr;
		}

		long[] rlaml(int m) {
			long[] arr = new long[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(str());
			return arr;
		}
	}
}

class Node {
	public int val;
	public boolean visited;
	public Node(int v) { val=v; }
}


Measured memory_bytes: 21204
import math
from collections import defaultdict

k = int(input())

d = defaultdict(int)
for a in range(1, k+1):
	for b in range(1, k+1):
		d[math.gcd(a,b)] += 1
n = 0
for c in range(1, k+1):
	for g in d:
		n += math.gcd(c, g) * d[g]
			
print(n)

Measured memory_bytes: 9460
import std.stdio;
import std.algorithm;
import std.conv;
import std.numeric;
import std.math;
import std.string;

void main()
{
	auto n = to!int(chomp(readln()));
	long[] t;
	foreach (i; 0..n)
	{
		t ~= to!long(chomp(readln()));
	}
	
	long lcm(long a, long b)
	{
		if (a < b)
		{
			auto tmp = a;
			a = b;
			b = tmp;
		}

		auto r = a % b;
		long x = a, y = b;
		while (r != 0)
		{
			x = y;
			y = r;
			r = x % y;
		}

		return b / y * a;
	}

	auto result = t[0];
	foreach (e; t[1..$])
	{
		result = lcm(result, e);
	}
	
	writeln(result);
	stdout.flush();
}

Measured memory_bytes: 256
sum = 0
stack  = []
stack2 = []

str_inpt = input()

for i in range(len(str_inpt)):
  if str_inpt[i] == '\\':
    stack.append(i)
  elif str_inpt[i] == '/':
    if len(stack) < 1: continue
    pop_index = stack.pop(-1)
    area = i - pop_index
    sum += area
    while True:
      if len(stack2) < 1: break
      if stack2[-1][0] < pop_index: break
      if pop_index < stack2[-1][0]:
        pop_stack2 = stack2.pop(-1)
        area += pop_stack2[-1]

    stack2.append([pop_index, area])

print(sum)

if len(stack2) == 0:
  print('0')
else:
  print(str(len(stack2)) + ' ' + ' '.join([str(e[1]) for e in stack2]))


Measured memory_bytes: 6184
//Catchharsh
#include<bits/stdc++.h>
#define ll long long int 
#define ld long double
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define F first
#define S second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define see(x) cout<<#x<<" = "<<x<<endl
const ll MOD = 1e9+7;
const ll INF = 1011111111;
const ll LLINF = 1000111000111000111LL;
const ld EPS = 1e-10;
const ld PI = 3.14159265358979323;
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
inline ll add(ll a,ll b){a+=b;if(a>=MOD)a-=MOD;return a;}
inline ll sub(ll a,ll b){a-=b;if(a<0)a+=MOD;return a;}
inline ll mul(ll a,ll b){return (a*1ll*b)%MOD;}
ll power (ll base,ll exponent)
{
    ll ans=1;
    //base%=MOD;
    //exponent%=(MOD-1);
    while(exponent!=0)
    {
      if(exponent&1) ans=(1LL*ans*base);
      base=(1LL*base*base);
      exponent>>=1;
    }
    return ans;
}

int32_t main()
{   
     IOS;
     
     string s,t;
     cin>>s>>t;
     string x=t.substr(0,t.length()-1);
     if(s==x) cout<<"Yes";
     else cout<<"No";
     
     cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';             
}

Measured memory_bytes: 3792
NM=input().split()

N=int(NM[0])
M=int(NM[1])

s=[]
a=[]

for i in range(N-1):
    s.append(int(input()))

Sum=0
TotalS=[0]

for i in range(N-1):
    Sum+=s[i]
    TotalS.append(Sum)

position=0
TD=0#TraveledDistance

for i in range(M):
    a=int(input())
    TD+=abs(TotalS[position]-TotalS[position+a])
    position+=a

TD%=100000
print(TD)




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

char n[1000005];
long long dp[1000005][2];

int main(){
	scanf("%s",n);
	int l=strlen(n);
	long long ans=0;
	long long cur=0; bool b=0;
	/*for(int i=l-1;i>=0;i--){
		int x=n[i]-'0';
		if(b){
			if(x<=4){
				ans+=x;
				ans+=cur+2;
				cur=0;
				b=0;
			}else{
				cur+=9-x;
				b=1;
			}
		}else{
			if(x<=5){
				ans+=x;
				cur=0;
				b=0;
			}else{
				cur+=9-x;
				b=1;
			}
		}
	}
	for(int i=0;i<l;i++){
		int x=n[i]-'0';
		if(x<=5){
			ans+=x;
			if(cur==0)continue;
			ans+=cur+2;cur=0;
		}else{
			cur+=9-x;
		}
	}
	printf("%lld\n",ans);*/
	
	dp[0][0]=0;dp[0][1]=1;
	for(int i=1;i<=l;i++){
		int y=n[i-1]-'0';
		dp[i][0]=min(dp[i-1][0]+y,dp[i-1][1]+y+1);
		dp[i][1]=min(dp[i-1][1]+9-y,dp[i-1][0]+10-y);
		/*
		dp[i][0]=min(dp[i-1][0]+y,dp[i-1][1]+10-y);
		dp[i][1]=min(dp[i-1][0]+y+1,dp[i-1][1]+10-y+1);
		/*
		if(x==9){
			dp[i][0]=(i>1?min(dp[i-2][0],dp[i-2][1]):0)+min(x+y,x+2-y);
		}else{
			dp[i][0]=(i>1?min(dp[i-2][0],dp[i-2][1]):0)+min(x+y,x+11-y);
		}
		dp[i][1]=min(dp[i-1][0],dp[i-1][1])+y;*/
		//printf("%lld %lld\n",dp[i][0],dp[i][1]);
	}
	printf("%lld",min(dp[l][0],dp[l][1]+1));
}


Measured memory_bytes: 16896
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;




int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin>>n;
  vector<ll>a(n);
  rep(i,n)cin>>a[i];
  int r=0;
  ll x=0;
  ll sum=0;
  ll res=0;
  rep(l,n)
  {
    while(r<n && (a[r]^x)==sum+a[r])
    {
      sum+=a[r];
      x=x^a[r++];
    }
    res+=r-l;
    if(l==r)
    {
      sum+=a[r];
      x^=a[r++];
    }
    sum-=a[l];
    x^=a[l];

  }
  cout<<res<<endl;
  return 0;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

LL n, x;
vector<LL> thick, num;

LL solve(LL a, LL b) {
  if (b == 0) return 0;
  else if (a == 0) return 1;
  else if (b <= thick[a - 1] + 1) return solve(a - 1, b - 1);
  else return num[a - 1] + 1 + solve(a - 1, b - thick[a - 1] - 2);
}

int main() {
  cin >> n >> x;
  thick = vector<LL>(n + 1);
  num = vector<LL>(n + 1);
  thick[0] = 1, num[0] = 1;
  for (int i = 1; i <= n; i ++) {
    thick[i] = thick[i - 1] * 2 + 3;
    num[i] = num[i - 1] * 2 + 1;
  }

  cout << solve(n, x) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main(){
  int n, k;
  cin >> n >> k;
  combination cb(n);
  mint ans = 0;
  rep(i, min(k+1, n+1)){
    mint add = cb(n, i);
    add *= cb(n-1, n-i-1);
    ans += add;
  }
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 6408
def main():
    n = int(input())
    ans = 0

    fac = 2
    e = 1
    while True:
        if n % (div := pow(fac, e)) == 0:
            n //= div
            ans += 1
            e += 1
            continue

        while n % fac == 0:
            n //= fac

        if fac == 2:
            fac += 1
        else:
            fac += 2

        if fac * fac > n:
            break
        e = 1

    if n != 1:
        ans += 1

    print(ans)


if __name__ == '__main__':
    main()


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

using namespace std;

#define ll long long
#define ull unsigned long long
#define PI acos(-1.0)
#define eps 1e-12
#define fi first
#define se second
#define MEM(a,b) memset((a),(b),sizeof(a))
#define mod(x) ((x)%MOD)
#define pii pair<int,int>
#define wz cout<<"-----"<<endl;

const int N = 1e5 + 10, INF = 0x3f3f3f3f , MOD = 1e9 + 7;
const int Move[4][2] = {-1,0,1,0,0,1,0,-1};
const int Move_[8][2] = {-1,-1,-1,0,-1,1,0,-1,0,1,1,-1,1,0,1,1};

inline int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

int main(){
//    freopen("C:\\Users\\Administrator\\Desktop\\in.txt","r",stdin);
//    freopen("C:\\Users\\Administrator\\Desktop\\out.txt","w",stdout);
    ios_base::sync_with_stdio(0);
    string s;
    cin>>s;
    int a = 0;
    if(s[0] == '1') a++;
    if(s[1] == '1') a++;
    if(s[2] == '1') a++;
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main
{
    private static int solve(Set<int[]> nodes, Set<Integer> vertexes, int pos)
    {
        /*
        System.out.println(
                String.format(
                        "pos=%d, vertexes=%s, nodes=%s",
                        pos,
                        Arrays.toString(vertexes.stream().toArray()),
                        Arrays.toString(nodes.stream()
                                .map(node -> String.format("(%d->%d)", node[0], node[1]))
                                .toArray())
                )
        );
         */

        if (vertexes.contains(pos)) {
            if (vertexes.size() == 1) {
                return 1;
            }
        }
        else {
            return 0;
        }

        int count = 0;
        for (int[] node : nodes) {
            if (node[0] == pos) {
                count += solve(nodes,
                        vertexes.stream()
                                .filter(x -> x != pos)
                                .collect(Collectors.toSet()),
                        node[1]);
            }
            else if (node[1] == pos) {
                count += solve(nodes,
                        vertexes.stream()
                                .filter(x -> x != pos)
                                .collect(Collectors.toSet()),
                        node[0]);
            }
        }

        return count;
    }

    public static void main(String[] args)
    {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        Set<int[]> xs = new HashSet<>();
        for (int i = 0; i < m; i++) {
            int[] node = new int[2];
            node[0] = scanner.nextInt();
            node[1] = scanner.nextInt();
            xs.add(node);
        }

        Set<Integer> vertexes = IntStream.rangeClosed(1, n).boxed().collect(Collectors.toSet());

        System.out.println(solve(xs, vertexes, 1));
    }
}



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

int w, h;
char s[30][31], b[30][31];
map<char, int>d{ {'N',0},{'E',1},{'S',2},{'W',3} };
char rd[] = "NESW";
int dx[]{ -1,0,1,0 }, dy[]{ 0,1,0,-1 }, a[]{ 1,0,3,2 };
int main() {
	while (scanf("%d%d", &w, &h), h) {
		rep(i, h)scanf("%s", s[i]);
		for (int i = 0; i <= 180; i++) {
			bool ok = true;
			rep(i, h)rep(j, w)for (auto p : d) {
				if (s[i][j] == p.first) { ok = false; break; }
			}
			if (ok) { printf("%d\n", i); goto g; }
			rep(i, h)rep(j, w) {
				if (d.find(s[i][j]) == d.end())continue;
				int b = d[s[i][j]];
				rep(k, 4) {
					int nx = i + dx[(b + a[k]) % 4], ny = j + dy[(b + a[k]) % 4];
					if (0 <= nx&&nx < h && 0 <= ny&&ny < w && (s[nx][ny] == '.' || s[nx][ny] == 'X')) {
						s[i][j] = rd[(b + a[k]) % 4]; break;
					}
				}
			}
			rep(i, h)rep(j, w)b[i][j] = s[i][j];
			rep(i, h)rep(j, w) {
				if (s[i][j] != 'X'&&s[i][j] != '.')continue;
				rep(k, 4) {
					int nx = i + dx[a[k]], ny = j + dy[a[k]];
					if (0 <= nx&&nx < h && 0 <= ny&&ny < w&&d.find(s[nx][ny]) != d.end() && nx + dx[d[s[nx][ny]]] == i&&ny + dy[d[s[nx][ny]]] == j) {
						if (s[i][j] == 'X')b[nx][ny] = '.';
						else swap(b[i][j], b[nx][ny]);
						break;
					}
				}
			}
			rep(i, h)rep(j, w)s[i][j] = b[i][j];
		}
		puts("NA");
	g:;
	}
}

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

int main(){
  int n,m,k;
  cin >> n >> m >> k;
  for(int i = 0; i <= n; i++){
    for(int j = 0; j <= m; j++){
      if(i * (m - j) + j * (n - i) == k){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3612
S=input()
ans=0
indf=0
indl=len(S)-1
while indf<indl:
  if S[indf]==S[indl]:
    indf+=1
    indl-=1
    continue
  if S[indf]=="x":
    indf+=1
    ans+=1
  elif S[indl]=="x":
    indl-=1
    ans+=1
  else:
    print(-1)
    break
else:
  print(ans)

Measured memory_bytes: 3316
use std::io::*;
use std::cmp::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let a: usize = itr.next().unwrap().parse().unwrap();
    let b: usize = itr.next().unwrap().parse().unwrap();
    println!("{} {}", min(a, b), (a + b).saturating_sub(n));
}



Measured memory_bytes: 2048
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		String[] d = str.split(" ");
		int a = Integer.parseInt(d[0]) - 1;
		int b = Integer.parseInt(d[1]) - 1;
		System.out.println(a * b);
	}
}


Measured memory_bytes: 20948
import java.io.*;
import java.util.*;

public class Main {
	FastScanner in;
	PrintWriter out;

	int[] a;
	long[][] dp;
	long[] sum;

	long getAns(int pos, int value) {
		if (pos == 1) {
			return value;
		}
		if (value <= a[pos]) {
			return dp[pos][value];
		}
		int l = 1, r = pos;
		while (r - l > 1) {
			int mid = (l + r) >> 1;
			long su = sum[pos] - sum[mid - 1];
			if (su < value) {
				r = mid;
			} else {
				l = mid;
			}
		}
		return getAns(l, (int) (value - (sum[pos] - sum[l])));
	}

	void solve() {
		int n = in.nextInt();
		a = new int[n];
		for (int i = 0; i + 1 < n; i++) {
			a[i] = in.nextInt();
		}
		sum = new long[n];
		sum[0] = a[0];
		for (int i = 1; i < n; i++) {
			sum[i] = sum[i - 1] + a[i];
		}
		int m = in.nextInt();
		dp = new long[n][];
		for (int x = 2; x + 1 < n; x++) {
			dp[x] = new long[a[x] + 1];
			for (int y = 0; y <= a[x]; y++) {
				dp[x][y] = getAns(x - 1, a[x] - y);
			}
		}
		for (int i = 0; i < m; i++) {
			int value = in.nextInt();
			out.println(getAns(n - 2, value) + a[0] - a[1]);
		}
	}

	void run() {
		try {
			in = new FastScanner(new File("object.in"));
			out = new PrintWriter(new File("object.out"));

			solve();

			out.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

	void runIO() {

		in = new FastScanner(System.in);
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return null;
				st = new StringTokenizer(s);
			}
			return st.nextToken();
		}

		boolean hasMoreTokens() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return false;
				st = new StringTokenizer(s);
			}
			return true;
		}

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

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

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

	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			public void run() {
				new Main().runIO();
			}
		}, "1", 1 << 26).start();
	}
}

Measured memory_bytes: 62672
cards = [[False for i in range(13)] for j in range(4)]
pattern = ["S", "H", "C", "D"]
n = int(input())
for i in range(n):
  ch, rank = input().split()
  rank = int(rank)
  cards[pattern.index(ch)][rank-1] = True
for i in range(4):
  for j in range(13):
    if cards[i][j] == False:
      print(pattern[i], j+1)


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int a,b,x;
    cin>>a>>b>>x;
    if(a<=x && x<=a+b) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
 
    return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

type Toukou struct {
	i int
	t int
}
type SortBy []Toukou

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i].t < a[j].t }

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code ---*/
	N := nextInt()
	A := make([]Toukou, N)
	for i := 0; i < N; i++ {
		A[i] = Toukou{i + 1, nextInt()}
	}
	sort.Sort(SortBy(A))
	for i := 0; i < N; i++ {
		if i != 0 {
			fmt.Fprintf(out, " %v", A[i].i)
		} else {
			fmt.Fprintf(out, "%v", A[i].i)
		}
	}
	fmt.Fprintln(out)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// Genericsがないので筋肉で...
// interfaceでの取扱がようわからんし
func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}

// mapからkeysとvaluesを返す感じのやつ
// なんかしらんけどmap[interface{}]interface{}しか受け付けない。なんのためのinterface{}やねん
// なので呼ぶときのmapはmap[int]stringとかじゃダメ
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
	return
}


Measured memory_bytes: 4224
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int n,m,x,y,d,k;

int main() {
	cout<<setprecision(10);
	cin>>k>>x;
	if(500*k>=x){cout<<"Yes"<<endl;}
	else{cout<<"No"<<endl;}
} 


Measured memory_bytes: 256
"""
prd_xxxさんの解答に自分向けにコメントを付けただけ
https://atcoder.jp/contests/aising2019/submissions/3986546
"""

from collections import Counter
 
H,W = map(int, input().split())
S = [input() for _ in range(H)]

class UnionFind:
    def __init__(self,N):
        self.parent = [i for i in range(N)]
        self.rank = [0] * N
        self.count = 0
    def root(self,a):
        if self.parent[a] == a:
            return a
        else:
            self.parent[a] = self.root(self.parent[a])
            return self.parent[a]
    def is_same(self,a,b):
        return self.root(a) == self.root(b)
    def unite(self,a,b):
        ra = self.root(a)
        rb = self.root(b)
        if ra == rb: return
        if self.rank[ra] < self.rank[rb]:
            self.parent[ra] = rb
        else:
            self.parent[rb] = ra
            if self.rank[ra] == self.rank[rb]: self.rank[ra] += 1
        self.count += 1

# マス目分のUnionFind木を用意
uf = UnionFind(H*W)


for i in range(H):
    for j in range(W):
        if j < W-1 and S[i][j] != S[i][j+1]:
            uf.unite(i*W+j, i*W+j+1) # 右へ移動可能のときつなぐ
        if i < H-1 and S[i][j] != S[i+1][j]:
            uf.unite(i*W+j, (i+1)*W+j) # 下へ移動可能のときつなぐ

# 親をたどって大本につなぎなおす
for i in range(H*W):
    uf.root(i)

c1 = Counter()
c2 = Counter()

for i in range(H):
    for j in range(W):
        k = i*W + j
        # uf.root(k)は連結成分の番号（ユニオンの番号）を表していて、それらにつながっている黒と白の個数を求める
        if S[i][j] == ".":
            c1[uf.root(k)] += 1
        else:
            c2[uf.root(k)] += 1

ans = 0
for k in c1.keys():
    # それぞれの連結成分について、出発地点となる黒とゴールとなる白の組み合わせの分だけ足していく
    ans += c1[k] * c2[k]

print(ans)

Measured memory_bytes: 22248
#pragma GCC optimize "-O3"
#include <bits/stdc++.h>
using namespace std;
#define LSOne(S) (S & (-S))
#define ll long long
#define two pair<int,int>
#define four pair<two,two>
#define pb push_back
#define mk make_pair
#define INF 1000000000000000000
#define P 1000000007
#define lmax 1000000000
#define nn 1000003
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define vi vector<int>
#define vll vector<ll>
#define vtwo vector<two>
#define ALL(container) (container).begin(), (container).end()
#define sz(container) (int)(container.size())
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define mid(a,b) (a+b>>1)
#define minN 0
#define maxN 10000000
#define na(x) ((x)<P?(x):(x)-P)
#define ab(a) (-(a)<(a)?(a):-(a))
int in(){
	int x=0,w=1;char ch=getchar();
	while ((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if (ch=='-') w=0,ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
int n,k;
int main(){std::ios::sync_with_stdio(false);
cin>>n>>k;
if((n+1)/2>=k){
	cout<<"YES"<<endl;
	
}else{
	cout<<"NO"<<endl;
}
}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
                 *   *   * *   *
                  *   *   *   *
                   *   * *   *
                     *  *   *
					   *  *


*/





Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;

int main(void){
    
    int n;
    
    // First input, determines how many values there are
    cin >> n;

    // Initialise max value
    int maxv = -2000000000;
    
    // Initialise min value to first element
    int minv;
    cin >> minv;
    
    // Max value always after min value because of R[i] - minv
    for(int i = 1; i < n; i++){
        int number;
        cin >> number;
        maxv = max(maxv, number - minv);
        minv = min(minv, number);
    }
    
    cout << maxv << endl;
    
    return 0;
    
}

Measured memory_bytes: 1160
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
  int n,d,i,j,k,t,count=0;
  cin >> n>>d;
  vector<vector<int> >a(n,vector<int>(d));
  vector<int>ans;
  for(i=0;i<n;i++)for(j=0;j<d;j++)cin>>a[i][j];
  for(i=0;i<n-1;i++)for(j=i+1;j<n;j++){
    t=0;
    for(k=0;k<d;k++){
      t+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
    }
    ans.push_back(t);
  }
  for(i=0;i<n*(n-1)/2;i++){
    int c=sqrt(ans[i]);
    if(c*c==ans[i])count++;
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
class Node
  attr_accessor :state, :depth
  attr_reader :parent

  def initialize(state, parent)
    @state = state
    @parent = parent
    @depth = parent.nil? ? 0 : parent.depth + 1
  end

  def goal?(limit, max)
    nums.size == limit && sum == max
  end

  def bad_end?(limit, max)
    nums.length > limit || sum > max
  end

  def nums
    parent.nil? ? [state] : parent.nums << state
  end

  def sum
    nums.inject(:+)
  end
end

def bfs
  while gets
    limit, max = $_.split.map(&:to_i)

    next if limit == 0 && max == 0

    goals = []
    10.times do |i|
      break if max < i
      init_node = Node.new(i, nil)
      queue = [init_node]
      black_list = [init_node.nums.sort]

      loop do
        break if queue.empty?

        elem = queue.shift

        goals << elem if elem.goal?(limit, max)

        next if elem.bad_end?(limit, max)

        10.times do |j|
          next if elem.nums.include?(j)
          new_node = Node.new(j, elem)
          new_nums = new_node.nums.sort
          next if black_list.include?(new_nums)
          black_list << new_nums
          queue.unshift new_node
        end
      end
    end

    puts goals.map { |e| e.nums.sort }.uniq.size
  end
end

bfs

Measured memory_bytes: 10716
#include<bits/stdc++.h>
#define m 1000000007
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int h,w;

    cin>>h>>w;
    vector<vector<char>> g(h,vector<char>(w));
    vector<vector<int>> dp(h,vector<int>(w,0));
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>g[i][j];
        }
    }
    for(int i=0;i<h;i++){
        if(g[i][0]=='#')
            break;
        else 
            dp[i][0]=1;
    }
    for(int i=0;i<w;i++){
        if(g[0][i]=='#')
            break;
        else 
            dp[0][i]=1;
    }
    for(int i=1;i<h;i++){
        for(int j=1;j<w;j++){
            if(g[i][j]=='#'){
                dp[i][j] = 0;
            }else{
                dp[i][j] = (dp[i-1][j]+dp[i][j-1])%m;
            }
        }
    }
    cout<<dp[h-1][w-1]<<"\n";
    return 0;
}

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


using namespace std;

using ll   = long long;
using ii   = pair < int , int >;
using i3   = pair < int , ii >;
using li   = pair < ll , int >;
using lii  = pair <  ll,  ii >;
using vi   = vector < int >;
using vl   = vector < ll >;
using vli  = vector < li >;
using vii  = vector < ii >;
using vi3  = vector < i3 >;
using vlii = vector < lii >;

const int N = 2e5 + 5;
const ll INF = 1e17;
const double eps = 1e-12 , PI = acos(-1);

int n;
ll k;

ll a[N] , f[N];

bool ok(ll x){

    ll sum = 0;
    for(int i = 0 ; i < n ; i ++){
            sum += max(0ll , a[i] - x/f[i]);
    }

    return sum <= k;
}

void solve(int cs){
    scanf("%d %lld" , &n , &k);

    for(int i = 0 ; i < n ; i ++){
            scanf("%lld" , &a[i]);
    }

    for(int i = 0 ; i < n ; i ++){
            scanf("%lld" , &f[i]);
    }

    sort(a , a + n);
    sort(f , f + n);
    reverse(f , f + n);

    ll high = INF , low = 0;
    ll ans = INF;
    while(low < high){
            ll mid = (low + high) / (1ll * 2);

            if(ok(mid)){
                    ans = mid;
                    high = mid;
            }
            else {
                    low = mid + 1;
            }
    }

    printf("%lld\n" , ans);
}

main(){

    int t = 1;
    //scanf("%d" , &t);

    for(int cs = 1 ; t -- ; cs ++){
        solve(cs);
    }

    return 0;
}


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

using namespace std;

#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
using ll = long long;
using pi = pair<int, int>;
const int INF = 0x3f3f3f3f;
const ll LINF = 1ll * INF * INF;

int main() {
	string S; cin >> S;
	reverse(ALL(S));
	int ix = 0, N = SZ(S);
	string ss[4] = {
		"remaerd",
		"maerd",
		"esare",
		"resare",
	};
	while(ix < N) {
		int before = ix;
		for(int k=0; k<4; k++) {
			int len = SZ(ss[k]);
			if(ix+len <= N && S.substr(ix, len) == ss[k])
				ix += len;
		}
		if(before == ix) {
			return puts("NO") < 0;
		}
	}
	puts("YES");
	return 0;
}


Measured memory_bytes: 512