akhauriyash/Code-Regression huggingface dataset:
def main():
    import heapq
    inf = 10**8
    h, w = map(int, input().split())
    start = list(map(int, input().split()))
    goal = list(map(int, input().split()))
    start = (start[0]-1, start[1]-1)
    goal = (goal[0]-1, goal[1]-1)
    grid = [input() for _ in [0]*h]
    dist = [[inf]*w for _ in [0]*h]
    q = [(0, start)]
    dist[start[0]][start[1]] = 0
    heapq.heapify(q)
    while q:
        d, (nowx, nowy) = heapq.heappop(q)
        for i, j in [(nowx-1, nowy), (nowx+1, nowy), (nowx, nowy-1), (nowx, nowy+1)]:
            if i < 0 or i >= h or j < 0 or j >= w:
                continue
            if grid[i][j] == "#":
                continue
            if dist[i][j] > d:
                dist[i][j] = d
                heapq.heappush(q, (d, (i, j)))
        for i in range(nowx-2, nowx+3):
            for j in range(nowy-2, nowy+3):
                if i < 0 or i >= h or j < 0 or j >= w:
                    continue
                if grid[i][j] == "#":
                    continue
                if dist[i][j] > d+1:
                    dist[i][j] = d+1
                    heapq.heappush(q, (d+1, (i, j)))
    if dist[goal[0]][goal[1]] == inf:
        print(-1)
        return
    print(dist[goal[0]][goal[1]])


main()


Measured memory_bytes: 113576
#include <stdio.h>
#define N 100000
#define Q 50000

int main() {
    
    int S[N],T[Q],i,n,q,count=0,left,right,mid;
    
    scanf("%d",&n);
    for(i=0; i<n; i++) scanf("%d",&S[i]);
    
    scanf("%d",&q);
    for(i=0; i<q; i++) scanf("%d",&T[i]);
    
    for(i=0; i<q; i++) {
        left = 0;
        right = n;
        
        while(left<right) {
            mid = (left+right)/2;
            
            if(S[mid]==T[i]) {
                count++;
                break;
            }
            else if(T[i]<S[mid]) right = mid;
            else left = mid+1;
        }
    }
    
    printf("%d\n",count);
    
    return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

int main() {
	string s;
	cin >> s;
	int n = s.size();
	long ans = 0;
	for (int i = 0; i < (1 << (n - 1)); i++) {
		long tmp = s[0] - '0';
		for (int j = 0; j < n - 1; j++) {
			if (i & (1 << j)) {
				ans += tmp;
				tmp = s[j + 1] - '0';
			} else {
				tmp = tmp * 10 + (s[j + 1] - '0');
			}
		}
		ans += tmp;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3572
#include <iostream>
using namespace std;
int main(){
  int a, b;
  cin >> a >> b;
  int group[] = {0,1,3,1,2,1,2,1,1,2,1,2,1};
  if(group[a] == group[b]) cout << "Yes" << endl;
  else cout << "No" << endl;
}

  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  vector<int> al(26);
  bool ans = true;
  for (int i = 0; i < S.size(); i++) {
    al[S[i] - 97]++; 
  }
  for (int i = 0; i < 26; i++) {
    if (al[i] >= 2) ans = false;
  }
  if(ans) cout << "yes" << endl;
  else cout << "no" << endl;
  return 0;
}

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

using namespace std;

int g1[81][81];
int g2[81][81];
bool dp[81][81][10000];


int main() {
	int H, W;
	cin>>H>>W;
	for (int i = 0;i < H;++i) {
		for (int j = 0;j < W;++j) {
			cin>>g1[i][j];
		}
	}
	
	for (int i = 0;i < H;++i) {
		for (int j = 0;j < W;++j) {
			cin>>g2[i][j];
		}
	}
	
	dp[0][0][abs(g1[0][0] - g2[0][0])] = true;

	for (int i = 0;i < H;++i) {
		for (int j = 0;j < W;++j) {
			for (int k = 0;k < 6400;++k) {
				if (dp[i][j][k]) {
					dp[i][j+1][abs(k - abs(g1[i][j+1] - g2[i][j+1]))] = true;
					dp[i][j+1][abs(k + abs(g1[i][j+1] - g2[i][j+1]))] = true;
					dp[i+1][j][abs(k - abs(g1[i+1][j] - g2[i+1][j]))] = true;
					dp[i+1][j][abs(k + abs(g1[i+1][j] - g2[i+1][j]))] = true;
				}
			}
		}
	}
	
	for (int i = 0;i < 6400;++i) {
		if (dp[H-1][W-1][i]) {
			cout<<i<<endl;
			break;
		}
	}
	
	return 0;
}


Measured memory_bytes: 63744
import java.util.Scanner;

//Poker Hand
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			String[] ss = sc.next().split(",");
			int[] c = new int[14];
			int max = 0;
			for(String s:ss){
				max = Math.max(max, ++c[Integer.parseInt(s)]);
			}
			if(max==4){
				System.out.println("four card");
			}
			else if(max==3){
				boolean f = false;
				for(int i=1;i<=13;i++){
					if(c[i]==2){
						f = true;
						break;
					}
				}
				System.out.println(f?"full house":"three card");
			}
			else if(max==2){
				int k = 0;
				for(int i=1;i<=13;i++){
					if(c[i]==2)k++;
				}
				System.out.println(k==2?"two pair":"one pair");
			}
			else{
				boolean f = false;
				for(int i=1;i<=10;i++){
					if(c[i]==1){
						boolean ff = true;
						for(int j=i+1;j<=i+4;j++){
							if(c[(j-1)%13+1]!=1){
								ff = false;
								break;
							}
						}
						f |= ff;
					}
				}
				System.out.println(f?"straight":"null");
			}
		}
	}
}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


signed main(){
    int N;
    cin >> N;
    vector<string> s(N);
    vector<int> t(N);
    rep(i,N) cin >> s[i] >> t[i];
    string X;
    cin >> X;
    
    int ans = 0;
    bool sleep = false;
    rep(i,N){
        if(s[i]==X){ sleep = true; continue;}
        if(sleep) ans += t[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<stdio.h>
#include<stdlib.h>



using namespace std;
typedef long long ll;
int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}
int abs(int x){
  if(x>=0){
    return x;
  }else{
    return -x;
  }
}

int moji(char in)
{
    int ans = (int)in-(int)'a'+1;
    if((in < 1) || (in > 26)){
        ans = 100;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}









int main() {
  int N;
  cin>>N;
  int A[N];
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  int sum=0;
  bool ok=true;
  while(ok){
    for(int i=0;i<N;i++){
      if(A[i]%2==1){
        ok=false;
        break;
      }
      A[i]/=2;
      if(i==N-1){
        sum++;
      }
    }
  }
  cout<<sum<<endl;
  

  




    




  

  


  

    


  

  
  
  
  
}


  

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

unsigned long long int sum[100 + 10][21 + 10] = {0};  //unsigned???+??????????????\????????????

int main()
{
	int n;

	int a;
	//int suu[100 + 10];

	int i,j;

	cin >> n;

	cin >> a;
	sum[0][a] = 1;
	for (i = 0; i < n-2; i++)
	{
		cin >> a;
		for (j = 0; j <= 20; j++)
		{
			if (sum[i][j] > 0)
			{
				if (j + a <= 20)
				{
					sum[i + 1][j + a] += sum[i][j];
				}

				if (j - a >= 0)
				{
					sum[i + 1][j - a] += sum[i][j];
				}
			}
		}

	}

	cin >> a;

	cout << sum[n-2][a] << endl;

	return 0;
}

Measured memory_bytes: 3100
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	map<string, int> x;
	for (int i = 0; i < n; i++)
	{
		string s;
		cin >> s;

		x[s]++;
	}

	int m;
	cin >> m;
	for (int i = 0; i < m; i++)
	{
		string s;
		cin >> s;

		x[s]--;
	}

	int res = 0;
	for (auto p : x)
	{
		res = max(res, p.second);
	}

	println(res);
}

Measured memory_bytes: 256
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;
const ll MOD = 1000000000000000001;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b){
  ll r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


ll LCM(ll a,ll b){
  ll c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

vector<pair<char,ll>> runlength(string s,vector<pair<char,ll>> p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
    return p;
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
  return p;
}



/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  string s;
  cin>>s;
  reverse(ALL(s));
  vector<string> v{"maerd","remaerd","esare","resare"};
  while(s.size()>0){
    bool flag=false;
    rep(i,4){
      if(v[i]==s.substr(0,v[i].size())){
        s.erase(0,v[i].size());
        flag=true;
      }
    }
    if(!flag){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
}




Measured memory_bytes: 512
import java.util.*;
class Main{
	static Scanner sc;
	static int n,num;
	public static void main(String[]args){
		sc=new Scanner(System.in);
		
		while(sc.hasNext()){
			n=sc.nextInt();
			num=0;
			for(int j=0;j<10;j++){
				for(int k=0;k<10;k++){
					for(int l=0;l<10;l++){
						for(int m=0;m<10;m++){
							if(j+k+l+m==n){num++;}
						}
					}
				}
			}
			System.out.println(num);
		}
	}
}

Measured memory_bytes: 18816
/* Simplicity and Goodness */
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int N = 1e7+2;

int fac[N], inv[N];

int mi(int x, int n) 
{
   int res = 1;
   while(n) {
      if(n & 1) 
         res = (1LL * res * x) % mod;
      x = (1LL * x * x) % mod;
      n >>= 1;
   }
   return res;
}

void fact() 
{
   fac[0] = 1;
   rep(i, 1, N) {
      fac[i] = (1LL * fac[i-1] * i) % mod;
   }

   inv[N-1] = mi(fac[N-1], mod-2);
   for(int i=N-1; i>0; i--) {
      inv[i-1] = (1LL * inv[i] * i) % mod;
   }
}

int nCr(int n, int k) 
{
   if(k > n)
      return 0;

   int ans = (1LL * fac[n] * inv[k]) % mod;
   ans = (1LL * ans * inv[n-k]) % mod;
   return ans;
}

void solve()
{
    fact();

    int x, y;
    scn(x); scn(y);

    if((x+y) % 3 != 0) {
        prin(0);
        exit(0);
    }

    int m = (2 * x - y) / 3;
    int n = (y - m) / 2;

    if(m < 0 or n < 0) {
        prin(0);
        exit(0);
    }

    int ans = nCr(n+m, m);

    prin(ans);
}

int main()
{
    int t = 1;
    // scn(t);

    while(t --) {
        solve();
    }
    return 0;
}

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

using namespace std;

#define int long long
#define double long double
#define mod 1000000007ll
#define INF 1000000000000000000ll

#define MAX_N 1000010

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int s = 999999999ll * 999999999ll + 1;
    cin >> s;

    int du = 1000000000;
    int a = s / du;
    while (a * du < s) {
        a++;
    }

    int x1 = a, y2 = du;
    int ss = a * du - s;

    int y1 = 1, x2 = ss;

    cout << "0 0 " << x1 << " " << y1 << " " << x2 << " " << y2;
    //cout << endl << x1 * y2 - x2 * y1;
    return 0;
}
/*

*/


Measured memory_bytes: 384
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>
#include <numeric>

using namespace std;
typedef long long int ll;
typedef long double ld;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define MOD 1e9 + 7
#define pb push_back
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repn(i, n) for (ll i = 1; i <= n; i++)
#define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265359

void Main()
{
    double n, m;
    cin >> n >> m;
    vector<double> a(n);
    rep(i, n) cin >> a[i];

    double sum = accumulate(all(a), 0);
    sort(all(a), greater<double>());

    rep(i, m)
    {
        if (a[i] < sum / (4 * m))
        {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
    return;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3688
//---------- begin union_find ----------
#[allow(dead_code)]
mod union_find {
    pub struct UF {
        p: Vec<i32>,
    }
    impl UF {
        pub fn new(n: usize) -> UF {
            UF {p: vec![-1; n] }
        }
        pub fn init(&mut self) {
            for p in self.p.iter_mut() {
                *p = -1;
            }
        }
        pub fn root(&self, mut x: usize) -> usize {
            while self.p[x] >= 0 {
                x = self.p[x] as usize;
            }
            x
        }
        pub fn same(&self, x: usize, y: usize) -> bool {
            self.root(x) == self.root(y)
        }
        pub fn unite(&mut self, x: usize, y: usize) -> Option<(usize, usize)> {
            let mut x = self.root(x);
            let mut y = self.root(y);
            if x == y {
                return None;
            }
            if self.p[x] > self.p[y] {
                std::mem::swap(&mut x, &mut y);
            }
            self.p[x] += self.p[y];
            self.p[y] = x as i32;
            Some((x, y))
        }
        pub fn parent(&self, x: usize) -> Option<usize> {
            let p = self.p[x];
            if p >= 0 {
                Some(p as usize)
            } else {
                None
            }
        }
        pub fn get_size(&self, x: usize) -> usize {
            let r = self.root(x);
            (-self.p[r]) as usize
        }
    }
}
//---------- end union_find ----------

use proconio::*;
use proconio::marker::*;

fn run() {
    input! {
        n: usize,
        m: usize,
        e: [(Usize1, Usize1); m],
    }
    let mut u = union_find::UF::new(n);
    for (a, b) in e {
        u.unite(a, b);
    }
    let mut ans = 0;
    for i in 0..n {
        if i == u.root(i) {
            ans = std::cmp::max(ans, u.get_size(i));
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}


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

int main(){
  int H,W,N;
  cin >> H >> W >> N;
  vector<int> a(N);
  for (int i=0;i<N;i++){
    cin >> a[i];
  }
  vector<vector<int>> field(H,vector<int>(W));
  int cur=0;
  for (int i=0;i<H;i++){
    if (i%2==0){
      for (int j=0;j<W;j++){
        field[i][j]=cur+1;
        a[cur]--;
        if (a[cur]==0){
          cur++;
        }
      }
    }
    else {
      for (int j=W-1;j>=0;j--){
        field[i][j]=cur+1;
        a[cur]--;
        if (a[cur]==0){
          cur++;
        }
      }
    }
  }
  for (int i=0;i<H;i++){
    for (int j=0;j<W;j++){
      cout << field[i][j];
      if (j!=W-1){
        cout << ' ';
      }
      else {
        cout << endl;
      }
    }
  }
}

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

int main (){
    int A,B;
    cin >> A;
    cin >> B;

    vector <int>option = {1 , 2, 3};
    for (int i = 0; i < 3; i++){
        if (option.at(i) == A || option.at(i) == B)
            option.at(i) = -1;
    }
    for (int i = 0; i < 3; i++){
        if (option.at(i) != -1)
            cout << option.at(i) << endl;
    }
}

Measured memory_bytes: 3564
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <climits>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <bitset>
using namespace std;

string words[]={"dream", "dreamer", "erase", "eraser"};
int main() {
    string s;
    cin>>s;
    list<int> q;
    q.push_back(0);
    while (!q.empty()) {
        int v=q.front(); q.pop_front();
        if (v>=s.length()) {
            cout<<"YES"<<endl;
            return 0;
        }
        for (int i=0; i<4; ++i) {
            if (s.substr(v, words[i].length())==words[i])
                q.push_back(v+words[i].length());
        }
    }
    cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 640
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        mut a: [i64; n],
    }
    let mut v = vec![];
    for (i, a_) in a.iter().enumerate() {
        v.push(*a_ - (i as i64 + 1));
    }
    v.sort();
    let b = if n % 2 != 0 {
        v[n / 2]
    } else {
        (v[n / 2 - 1] + v[n / 2]) / 2
    };
    println!(
        "{}",
        a.iter()
            .enumerate()
            .map(|(i, x)| (x - (b + (i as i64 + 1))).abs())
            .sum::<i64>()
    );
}


Measured memory_bytes: 8444
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    string s;cin>>s;
    string t;
    REP(i,s.size()){
        if(i+1<s.size()&&s[i]=='B'&&s[i+1]=='C'){
            t.push_back('D');
            i++;
        }
        else t.push_back(s[i]);
    }
    ll cnt=0,ans=0;
    REP(i,t.size()){
        if(t[i]=='A'){
            cnt++;
        }
        else if(t[i]=='D'){
            ans+=cnt;
        }
        else cnt=0;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 776
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define ff first
#define ar array
#define ss second
#define ll long long int
#define mem(x) memset(x,0,sizeof(x))
#define setbits(x)  __builtin_popcount(x)
#define ull unsigned long long int
#define all(c) (c).begin(),(c).end()
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define db double
#define endl "\n"
#define  fbo(x) find_by_order(x)
#define  ook(x) order_of_key(x)
 
using namespace __gnu_pbds;
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair<ll,ll > iil;
typedef pair<ll,int> li;
typedef pair<int,int> ii;
typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    os1;
typedef tree<int, null_type, greater<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    os2;

inline void fast()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
const ll pi=31;
const ll MOD[2] = {1187278649, 1149736019};//for double hashing
const ll mod=(ll)(1e9)+7;
ll pmod(ll x,ll n){
  ll r=1;
  while(n>0)
  {
    if(n&1LL)
      r=(r*x)%mod;
    x=(x*x)%mod;
    n=n/2;
    n%=mod;
  }
  return r;
}
ll pMod(ll x,ll n,ll mod)
{ ll r=1;
  while(n>0)
  {
    if(n&1LL)
      r=(r*x)%mod;
    x=(x*x)%mod;
    n=n/2;
    n%=mod;
  }
  return r;
 
}
 
//think recursively also;
const int mxn=1e5;
ll a[mxn+1];
ll dp[mxn+1];
ll n,k;
void solve()
{ 
  cin>>n>>k;
  for(int i=1;i<=n;i++)
  {
    cin>>a[i];
  }
  dp[1]=0;
  for(int i=2;i<=n;i++)
  {
    dp[i]=LLONG_MAX;
    for(int j=1;j<=k;j++)
    {
       if(i-j>0)
        dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
    }
  }
  cout<<dp[n]<<endl;
  
}
int main()
{
  fast();
   // int t;
   // cin>>t;
   // for(int casee=1;casee<=t;casee++)
  {//cout<<"Case #"<<casee<<": ";
    solve();
  }
 
 
 
}

Measured memory_bytes: 5172
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cstring>
#include<queue>
using namespace std;
 
int main(void)
{
	int n,i,a,cnt[200001];
	scanf("%d",&n);
	for(i=1;i<=n;i++)	cnt[i]=0;
	for(i=2;i<=n;i++)	{
		scanf("%d",&a);
		cnt[a]++;
	}
	for(i=1;i<=n;i++)	printf("%d\n",cnt[i]);
	return 0;
}

Measured memory_bytes: 2456
#include<bits/stdc++.h>
using namespace std;
int n;
map<int,int> mp;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        int x;scanf("%d",&x);
        mp[x]++;
    }
    vector<int> v;
    for(auto x:mp){
        if(x.second>=4)v.push_back(x.first);
        if(x.second>=2)v.push_back(x.first);
    }
    if(v.size()<=1)printf("0\n");
    else printf("%lld\n",v[v.size()-1]*1ll*v[v.size()-2]);
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<long double> A(N);
    for(int i = 0; i < N; i++) {
        cin >> A.at(i);
    }

    long double ans = 0.0;

    for(int i = 0; i < N; i++) {
        ans += 1.0 / A.at(i);
    }

    cout << 1.0 / ans << endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class EMaxGCD {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N, K;
        cin >> N >> K;
        vector<int> A(N);

        int sum = 0;
        REP(i, N) {
            cin >> A[i];
            sum += A[i];
        }

        vector<int> cand;
        for (int i = 1; i * i <= sum; i++) {
            cand.push_back(i);
            cand.push_back(sum / i);
        }
        sort(cand.begin(), cand.end());

        int res = 1;
        for (int n: cand) {
            if (sum % n != 0) continue;
            vector<int> r;
            REP(i, N) {
                r.push_back(A[i] % n);
            }
            sort(r.begin(), r.end());
            int s = 0;
            REP(i, r.size()) s += n - r[i];
            int x = 0;
            bool ok = true;
            REP(i, r.size()) {
                x += r[i];
                s -= n - r[i];
                if (x == s) {
                    if (x > K) {
                        ok = false;
                    }
                    break;
                }
            }
            if (ok) {
                res = n;
            }
        }
        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    EMaxGCD solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 892
#include<iostream>
using namespace std;
int main() {
    int N, M;
    cin >> N >> M;
    int vec_a[N][M] = {}, vec_b[M] = {}, vec_sum[N] = {};
    for(int i=0; i<N; i++) {
      for(int j=0;j<M; j++) {
        cin >> vec_a[i][j];
      }
    }
    for(int i=0; i<M; i++) {
      cin >> vec_b[i];
    }

    for(int i=0; i<N; i++) {
      for(int j=0; j<M; j++) {
        vec_sum[i] +=vec_a[i][j]*vec_b[j];
      }
    }
    for(int i=0; i<N; i++) {
      cout << vec_sum[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 3120
h,w= map(int, input().split())

if h==1 or w==1:
    print(1)
    exit()

if w%2==0:
    print((w//2)*h)

else:
    if h%2==0:
        print((h//2)*w)
    else:
        print((h//2)*w+(w//2)+1)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    int N, M;
    string s[110], t[110];
    //青いカード
    cin >> N;
    for(int i=0;i<N;i++)
        cin >> s[i];
    //赤いカード
    cin >> M;
    for(int i=0;i<M;i++)
        cin >> t[i];

    string w; //高橋君の言った文字列
    int b = 0, r = 0; //青、赤の一致枚数
    int point[110]; //差し引き貰える金額
    for(int i=0;i<N;i++){
        w = s[i];
        b = 0;
        r = 0;
        for(int j=0;j<N;j++){
            if(w == s[j])
                b++;
        }
        for(int k=0;k<M;k++){
            if(w == t[k])
                r++;
        }
        point[i] = (b - r);
    }

    int max;
    max = point[0];
    for(int i=0;i<N;i++){
        if(point[i] >= max)
            max = point[i];
    }

    if(max < 0)
        max = 0;

    cout << max << '\n';
    return 0;
}

Measured memory_bytes: 256
def f(x, y):
    if (x + y) % 3 != 0: return 0
    n = (x + y) // 3
    k = (2 * x - y) // 3
    if k < 0 or k > n: return 0
    ret = 1
    for i in range(k):
        ret = ret * (n - i) % MOD * pow(i + 1, MOD-2, MOD) % MOD
    return ret

MOD = 10**9 + 7
x, y = map(int, input().split())
print(f(x, y))


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

// 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 = 998244353
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 { return mint(*this) += a; }
	mint operator-(const mint a) const { return mint(*this) -= a; }
	mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
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];
	}
}c(200005);


//m^n
mint f(int m, int n) {
	if (0 == n) {
		return 1;
	}
	mint x = f(m, n / 2);
	x *= x;
	if (1 == n % 2) {
		x *= (mint)m;
	}
	return x;
}
// nCa
mint choose(int n, int a) {
	mint x = 1;
	mint y = 1;
	for (int m = 0; m < a; ++m) {
		x *= (mint)(n - m);
		y *= (mint)(a - m);
	}
	return x / y;
}
// nPk
mint nPk(int n, int a) {
	mint ret = choose(n, a);
	for (int n = 1; n <= a; ++n) {
		ret *= n;
	}
	return ret;
}


int main() {
	int S;
	cin >> S;
	int count = S / 3;
	mint ans = 0;
	for (int i = 1; i <= count; ++i) {
		int tmpS = S;
		tmpS -= i * 3;
		ans += choose(tmpS + i - 1, i - 1);
	}
	cout << ans << endl;
	return 0;
}

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

bool A[100];

int main() {
  int N, K;
  cin >> N >> K;

  int d[K];

  for (int i = 0; i < 100; i++) {
    A[i] = false;
  }

  for (int i = 0; i < K; i++) {
    cin >> d[i];
    for (int j = 0; j < d[i]; j++) {
      int tmp;
      cin >> tmp;
      A[tmp-1] = true;
    }
  }

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

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


Measured memory_bytes: 3596
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int R;
	std::cin >> R;
	
	if (R < 1200) {
		std::cout << "ABC\n";
	} else if (R < 2800) {
		std::cout << "ARC\n";
	} else {
		std::cout << "AGC\n";
	}
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
const double pi =  3.14159265358979323846264338327950;
int main(){
	double a,b,h,m;
	cin >> a >> b >> h >> m;
	double nowh = h * pi / 6 + m * pi / 360;
	double nowm = m * pi / 30;
	//cout << nowh << ' ' <<  nowm << endl;
	double now = fabs(nowh - nowm);
	//cout << now << endl;
	double c = sqrt(a*a+b*b-2*a*b*cos(now));
	printf("%.20lf\n",c);
	return 0;
}

Measured memory_bytes: 4192
n = int(input())
H = list(map(int, input().split()))

count = 0
count_max = 0

for i in range(n - 1):
    if H[i] >= H[i + 1]:
        count = count + 1
        # print(count)
    else:
        if count_max <= count:
            count_max = count
            count = 0
        else:
            count = 0
if count_max <= count:
    print(count)
else:
    print(count_max)


Measured memory_bytes: 14252
n=int(input())
a=list(map(int,input().split()))
ki=[]
gu=[]
for i in range(n):
  if i%2:
    ki.append(a[i])
  else:
    gu.append(a[i])
#print(ki,gu)
if n%2==0:
  ki.reverse()
  ki.extend(gu)
  print(*ki)
else:
  gu.reverse()
  gu.extend(ki)
  print(*gu)

Measured memory_bytes: 26020
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,k,a[200010],ans;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		a[x]++;
	}
	sort(a+1,a+n+1);
//	for(int i=1;i<=n;i++)
//		cout<<a[i]<<' ';
//	cout<<endl;	
	for(int i=1;i<=n-k;i++)
		ans+=a[i];
	printf("%d",ans);	
	return 0;	
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define vi vector<int>
#define printv(v) for(int i = 0;i < v.size();i++)P(v[i]);
#define printt(a,b) cout << a << " " << b << endl; 
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0};
int dy[] = { 0,  0,  1, -1};
int MOD = 1e9 + 7;

void solve() {
    int n;
    cin >> n;
    n -= 2;
    P(180*n);
}

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


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;
typedef pair<int,int> PII;

vector<PII> pairs;

bool isPositive(int num){
	return num >= 0;
}

int removeNums(vector<int> nums,int a,int b){
	if(a>=0&&b>=0){
		nums[a] = -1;
		nums[b] = -1;
		stable_partition(nums.begin(),nums.end(),isPositive);
	}
	if(nums[0] == -1) return 0;
	int min_num = 20-count(nums.begin(),nums.end(),-1);
	for(int i=0;i<pairs.size();i++){
		if(nums[pairs[i].first] != -1 && nums[pairs[i].first] == nums[pairs[i].second]){
			int r = removeNums(nums,pairs[i].first,pairs[i].second);
			if(r<min_num) min_num = r;
			if(min_num==0)break;
		}
	}
	return min_num;
}

void genPairs(){
	for(int i=0;i<20;i++) if(i%4!=3) pairs.push_back(PII(i,i+1));
	for(int i=0;i<16;i++) pairs.push_back(PII(i,i+4));
	for(int i=0;i<16;i++) if(i%4!=3) pairs.push_back(PII(i,i+5));
	for(int i=0;i<16;i++)	if(i%4!=0) pairs.push_back(PII(i,i+3));
}

int main(){
  int datacase,n;
	genPairs();
	for(cin>>datacase;datacase>0;datacase--){
		vector<int> nums;
		for(int i=0;i<20;i++){
			cin>>n;
			nums.push_back(n);
		}
		cout<<removeNums(nums,-1,-1)<<endl;
	}
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	stack<int>S1;
	stack<pair<int,int> >S2;
	char ch;
	int sum=0;
	for(int i=0;cin>>ch;i++){
		if(ch=='\\') S1.push(i);
		else if(ch=='/' && S1.size()>0){
			int j=S1.top();S1.pop();
			sum+=i-j;
			int a=i-j;
			while(S2.size()>0 && S2.top().first>j){
				a+=S2.top().second;S2.pop();
			}
			S2.push(make_pair(j,a));
		}
	}
	vector<int>ans;
	while(S2.size()>0){ans.push_back(S2.top().second);S2.pop();}
	reverse(ans.begin(),ans.end());
	cout<<sum<<endl;
	cout<<ans.size();
	for(int i=0;i<ans.size();i++){
       cout<<" ";
       cout<<ans[i];
	}
	cout<<endl;
	return 0;
}

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

int main() {
    string S;
    int K, ans = 1;
    cin >> S >> K;

    for (int i = 0; i < K; i++){
        if (S[i] != '1'){
            ans = S[i] - '0';
            break;
        }
    }
    cout << ans << endl;
}


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

#define ll long long

using namespace std;

string pass[2];
int length_sum;

int main()
{
    cin >> pass[0] >> pass[1];
    length_sum = pass[0].size() + pass[1].size();

    for (int i = 1; i <= length_sum; i++) {
        cout << pass[i % 2 == 0][(i - 1) / 2];
    }
    cout << endl;
    return 0;
}

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

using namespace std;

#define ll long long
#define rep(cnt,a,n) for(ll cnt=a;cnt<n+a;cnt++) //aから始めてn回ループ
#define vector2(type,name,a,b) vector<vector<type>> name(a, vector<type>(b))



int main()
{   
    ll n;
    cin >> n;
    ll x=100;
    ll cnt=0;
    while (x < n) {
        x = 1.01 * x;
        cnt++;
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <queue>
#include<iomanip>
#include <cmath>

#define ABS(x) ((x)>0?(x):-(x))
#define MIN(x,y) ((x)>(y)?(y):(x))

using namespace std;
unsigned long long int newton(long long int a, long long int  b)
{
	if(a==b)
		return a;
	while(a != 0 && b != 0)
	{
		if(a > b)
		{
			b += a;
			a = b-a;
			b -= a;
		}
		b %= a;
	}
	return a;
}

struct UnionFind {
	vector<int> p;
	UnionFind(int N):p(N)
	{
		for(int i=0; i< N; i++)
		{
			p[i] = i;
		}
	}
	int root(int x)
	{
		if(p[x] == x)
			return x;
		return p[x] = root(p[x]);
	}
	void unite(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		if(rx == ry) return;
		p[rx] = ry;
	}
	bool issame(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

int main()
{
	int N,M;
	int x,y,z;
	int mp[100010] = {0};
	cin >> N >> M;
	UnionFind t(N);
	for(int i=0; i< M; ++i)
	{
		cin >> x >> y >> z;
		t.unite(x-1,y-1);
	}
	for(int i=0; i<N; ++i)
	{
		mp[t.root(i)] = 1;
	}
	int ans = 0;

	for(int i=0; i<N; ++i)
	{
		if(mp[i])
			ans ++;
	}
	cout << ans << endl;
	return 0;
}









Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main() {
    ll W, H, X, Y; cin >> W >> H >> X >> Y;
    cout << fixed << setprecision(20) << W * H / 2.0 << " ";
    
    if(X*2 == W && Y*2 == H) cout << 1 << endl;
    else cout << 0 << endl;
    
    return 0;
}



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

int main(){
  string s1,s2;
  cin >> s1 >> s2;
  
  int flag = 1;
  
  if(s1[2] != s2[0] || s1[1] != s2[1] || s1[0] != s2[2]){
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>  // ver1.9.4
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define mp make_pair
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define Vout(a) rep(i,0,a.size()-1)cout<<a[i]<<' ';cout<<a[a.size()-1]<<endl;
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;

signed main() {
  cout << fixed << setprecision(15);
  int n;
  cin >> n;
  vector<pair<int,int>> a(n);
  int qw,er;
  rep(i,0,n){
    cin >> qw >> er;
    a[i] = mp(er,qw);
  }
  sort(ALL(a));
  int now=0;
  rep(i,0,n){
    now += a[i].second;
    if(now>a[i].first) {cNo;return 0;}
  }
  cYes;
  return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<climits>
#include<unordered_map>
#define ll long long int
using namespace std;

int main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int k;
	string s;
	cin >> k;
	cin >> s;
	int n = s.size();
	if (n <= k)
		cout << s;
	else
	{
		int i = 0;
		string t = "";
		while (i < k)
		{
			t += s[i];
			i++;
		}
		t += "...";
		cout << t;

	}

	return 0;
}




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

int main() {
int n;
string s;
cin>>n>>s;
int w=0;
int ans=0;
for (int i = 0; i < n; i++)
{
    
    
    if(s[i]=='W'){
        w++;
    }
}
 for (int i = 0; i < n; i++)
{
    
    if(i<n-w){
    if(s[i]=='W'){
        ans++;
    }
    }
}
cout<<ans<<endl;

}

Measured memory_bytes: 3744
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
using namespace std;

int main()
{
    int n;
    while(~scanf("%d", &n))
    {
        int x, a = 1e9, b = 0;
        while(n--)
        {
            scanf("%d", &x);
            a = min(x, a);
            b = max(x, b);
        }
        printf("%d\n", b - a);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < n; i++)
#define inf 1000000000
typedef long long ll;
typedef unsigned long long ull;

int main(){
    int a;
    cin >> a;
    ll ans = a + a * a + a * a * a;
    cout << ans << endl;
    return 0;
}

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


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

  vector<ll> A(n), B(n), C(n);
  rep(i, n) cin >> A[i];
  rep(i, n) cin >> B[i];
  rep(i, n) cin >> C[i];

  sort(A.begin(), A.end());
  sort(C.begin(), C.end());
  
  ll ans = 0;
  rep(i, n) {
    ll num_a = lower_bound(A.begin(), A.end(), B[i]) - A.begin();
    ll num_c = C.end() - upper_bound(C.begin(), C.end(), B[i]);
    // cout << num_a << ' ' << num_c << endl;
    ans += num_a * num_c;
  }

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


Measured memory_bytes: 5640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
ll factorial(int i) {       //階乗
    if (i == 0) return 1;
    return (factorial(i - 1)) * i;
}

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int count;
    int ans = -1;
    string t, u;
    // vector<bool> a(26), b(26);
    bool a[30], b[30];
    for(int i = 1; i < n; i++) {
        fill(a, a + 26, false);
        fill(b, b + 26, false);
        count = 0;
        string t = s.substr(0, i), u = s.substr(i, n - i);
        for(auto p : t) a[p - 'a'] = true;
        for(auto p : u) b[p - 'a'] = true;
        rep(j, 26) if(a[j] && b[j]) count++;
        ans = max(ans, count);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620