akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 
 
	public static void main(String[] args) { 
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		int R = I.nextInt();
		int C = I.nextInt();
		int K = I.nextInt();
		int Bl = 0;
		int ans = 0;
		char[][] grid = new char[R][C];
		for (int r = 0; r < R; r++) {
			grid[r] = I.next().toCharArray();
			for (int i = 0; i < C; i++) if (grid[r][i]=='#') Bl++;
		}
		for (int rnum = 0; rnum < (1<<R); rnum++) {
			for (int cnum = 0; cnum < (1<<C); cnum++) {
				boolean[] vis = new boolean[R];
				int cur = 0;
				for (int row = 0; row < R; row++) {
					if ((rnum>>row)%2==1) {
						vis[row]=true;
						for (int c = 0; c < C; c++) {
							if (grid[row][c]=='#') cur++;
						}
					} 
				}
				for (int col = 0; col < C; col++) {
					if ((cnum>>col)%2==1) {
						for (int r = 0; r < R; r++) {
							if (grid[r][col]=='#'&&!vis[r]) {
								cur++;
							}
						}
					} 
				}
				if (cur==Bl-K) ans++;
			}	
		}
		O.pln(ans);
	}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
	}
}

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

#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;

struct tacka
{
    int b, x;
};
tacka niz[4010];
int seg[2][40010];
int br[2][4010][4010];
int inv[2][4010];
int dp[4010][4010];

void update(int boja, int t, int start, int end, int ind, int val)
{
    if(start == end)
    {
        seg[boja][t] += val;
        return;
    }
    int mid = (start + end) / 2;
    if(ind <= mid) update(boja, 2*t, start, mid, ind, val);
    else update(boja, 2*t+1, mid+1, end, ind, val);
    seg[boja][t] = seg[boja][2*t] + seg[boja][2*t + 1];
}

int query(int boja, int t, int start, int end, int l, int r)
{
    //if(start == end) return seg[boja][t];
    if(start > r || end < l) return 0;
    if(start >= l && end <= r) return seg[boja][t];
    int mid = (start + end) / 2;
    int x1 = query(boja, 2*t, start, mid, l, r);
    int x2 = query(boja, 2*t+1, mid+1, end, l, r);
    return x1 + x2;
}


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

    int n;
    cin >> n;
    for(int i = 1; i <= 2*n; i++)
    {
        tacka t;
        char c;
        cin >> c;
        cin >> t.x;
        if(c == 'W') t.b = 0;
        else t.b = 1;
        niz[i] = t;
    }

    for(int i = 1; i <= 2*n; i++)
    {
        inv[niz[i].b][niz[i].x] = query(niz[i].b, 1, 1, n, niz[i].x + 1, n);
        for(int k = 0; k < n; k++)
            br[niz[i].b][niz[i].x][k] = query((niz[i].b + 1)%2, 1, 1, n, k + 1, n);
        update(niz[i].b, 1, 1, n, niz[i].x, 1);
    }

    dp[0][0] = 0;
    for(int i = 1; i <= n; i++) dp[0][i] = dp[0][i-1] + inv[1][i] + br[1][i][0];
    for(int i = 1; i <= n; i++) dp[i][0] = dp[i-1][0] + inv[0][i] + br[0][i][0];

    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
            dp[i][j] = min(dp[i-1][j] + br[0][i][j] + inv[0][i], dp[i][j-1] + br[1][j][i] + inv[1][j]);
    cout << dp[n][n];

    return 0;
}


Measured memory_bytes: 98304
#include<bits/stdc++.h>
#include <chrono> 
#define int long long
#define ll long long
#define vb  vector <bool>
#define pb push_back
#define mpr make_pair
#define Senky_Bansal ios_base::sync_with_stdio(false);
#define IIIT_ALLAHABAD    cin.tie(NULL);cout.tie(NULL);
using namespace std;
signed main()
{
    Senky_Bansal
    IIIT_ALLAHABAD
    ll n;
    cin>>n;
    string a,b,c;
    cin>>a>>b>>c;
    ll ans=0;
    for(int i=0;i<n;i++)
    {
       // cout<<a[i]<<" "<<b[i]<<" "<<c[i]<<endl;
        if(a[i]!=b[i] && a[i]!=c[i] && b[i]!=c[i])
        ans+=2;
        else if(a[i]==b[i] && a[i]!=c[i])
        ans+=1;
        else if(a[i]==c[i] && b[i]!=c[i])
        ans+=1;
        else if(b[i]==c[i] && b[i]!=a[i])
        ans+=1;
    }
    cout<<ans<<endl;
}

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

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;

using namespace std;

int main(){
    ll N, K;
    ll ans = 0;
    cin >> N >> K;
    if(K % 2){
        ans = pow(N / K, 3);
    }else{
        ll k = K / 2;
        ll x = N / K;
        ll y = (N + (K -k)) / K;
        ans = x * x * x + y * y * y;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
h=[]
s=[]
d=[]
c=[]
13.times do |i|
  h<<i+1
  s<<i+1
  d<<i+1
  c<<i+1
end
n=gets.to_i
n.times do
  a,b=gets.split
  if a=="S"
    s.delete(b.to_i)
  elsif a=="H"
    h.delete(b.to_i)
  elsif a=="D"
    d.delete(b.to_i)
  elsif a=="C"
    c.delete(b.to_i)
  end
end

  s.each do |i|
    puts "S #{i}"
  end
  h.each do |i|
    puts "H #{i}"
  end
  c.each do |i|
    puts "C #{i}"
  end
  d.each do |i|
    puts "D #{i}"
  end


Measured memory_bytes: 6880
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	S := nextString()
	box := map[rune]bool{}
	for _, s := range S {
		box[s] = true
	}
	for i := 'a'; i <= 'z'; i++ {
		if !box[i] {
			fmt.Println(string(i))
			return
		}
	}
	fmt.Println("None")
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

// ---------- Util.


Measured memory_bytes: 896
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#define INF 1000000000000000000LL
using namespace std;

const double PI=acos(-1.0);

int main()
{
	long long int x1, y1, x2, y2;
	scanf("%lld %lld %lld %lld", &x1, &y1, &x2, &y2);
	int n;
	scanf("%d", &n);
	if(x1==x2){
		double ans=(double)(abs(y1-y2)*100);
		long long int X, Y;
		for(int i=0; i<n; i++){
			scanf("%lld %lld", &X, &Y);
			if(X==x1){
				if((y1<Y && Y<y2) || (y1>Y && Y>y2)){
					ans=ans-20.0+10.0*PI;
				}
			}
		}
		printf("%.12lf", ans);
	}else if(y1==y2){
		double ans=(double)(abs(x1-x2)*100);
		long long int X, Y;
		for(int i=0; i<n; i++){
			scanf("%lld %lld", &X, &Y);
			if(Y==y1){
				if((x1<X && X<x2) || (x1>X && X>x2)){
					ans=ans-20.0+10.0*PI;
				}
			}
		}
		printf("%.12lf\n", ans);
	}else{
		int e=0;
		if(abs(x1-x2)<abs(y1-y2)){
			e=1;
			swap(x1, y1);
			swap(x2, y2);
		}
		int e1=1;
		if(x2-x1<0 && y2-y1>0){
			e1=2;
			x2=2*x1-x2;
		}else if(x2-x1<0 && y2-y1<0){
			e1=3;
			y2=2*y1-y2;
			x2=2*x1-x2;
		}else if(x2-x1>0 && y2-y1<0){
			e1=4;
			y2=2*y1-y2;
		}
		map<long long int, long long int> mp;
		for(int i=0; i<n; i++){
			long long int X, Y;
			scanf("%lld %lld", &X, &Y);
			if(e==1){
				swap(X, Y);
			}
			if(e1==2){
				X=2*x1-X;
			}else if(e1==3){
				X=2*x1-X;
				Y=2*y1-Y;
			}else if(e1==4){
				Y=2*y1-Y;
			}
			if(x1<=X && X<=x2 && y1<=Y && Y<=y2) mp[X]=Y;
		}
		int m=mp.size();
		double ans=(double)((y2-y1+x2-x1)*100);
		if(m==0){
			printf("%.12lf\n", ans);
			return 0;
		}
		long long int yin[200000];
		auto itr=mp.begin();
		for(int i=0; i<m; i++){
			yin[i]=itr->second;
			itr++;
		}
		long long int dp[200000];
		fill(dp, dp+m, INF);
		for(int i=0; i<m; i++){
			*lower_bound(dp, dp+m, yin[i])=yin[i];
		}
		int l=lower_bound(dp, dp+m, INF)-dp;

		if(l<y2-y1+1){
			ans=ans-(double)l*(20.0-5.0*PI);
		}else{
			ans=ans-(double)(l-1)*(20.0-5.0*PI)-20.0+10.0*PI;
		}
		printf("%.12lf\n", ans);
	}
	return 0;
}

Measured memory_bytes: 15872
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        for (int i = 360; true; i += 360)
        {
            if (i % n == 0)
            {
                Console.WriteLine(i / n);
                return;
            }
        }
    }
}


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

const long long MaxNum = 1000000000000000001;

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

    vector<long long> inputNumVec;

    for (int i = 0; i < n; ++i)
    {
        long long input;
        cin >> input;

        inputNumVec.push_back(input);
    }

    sort(inputNumVec.begin(), inputNumVec.end());

    long long ans = 1, nextLim = MaxNum;

    if (inputNumVec.at(0) == 0)
    {
        ans = 0;
    }
    else
    {
        for (const long long singleNum : inputNumVec)
        {
            if (singleNum >= nextLim)
            {
                ans = -1;
                break;
            }

            ans *= singleNum;

            nextLim = (MaxNum + ans - 1) / ans;
        }
    }

    cout << ans << endl;
}

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

int main() {
	int h,w;
	cin>>h>>w;
	char square[h][w];
	
	for(int i=0;i<h;i++)
		scanf("%s",&square[i]);
	
	bool tmp=1;
	for(int i=0;i<h;i++) {
		tmp=1;
		for(int j=0;j<w;j++)
			if(square[i][j]=='#')
				tmp=0;
		if(tmp==1) {
			square[i][0]='1';
			for(int j=1;j<w;j++)
				square[i][j]=='0';
		}
	}
	
	for(int j=0;j<w;j++) {
		tmp=1;
		for(int i=0;i<h;i++)
			if(square[i][j]=='#')
				tmp=0;
		
		if(tmp==1) for(int i=0;i<h;i++) {
			if(square[i][j]!='1')
				square[i][j]='0';
		}	
	}
	
	for(int i=0;i<h;i++) {
		if(square[i][0]=='1') continue;
		for(int j=0;j<w;j++) {
			if(square[i][j]=='0') continue;
			cout<<square[i][j];
		}
		cout<<endl;
	}
	return 0;
}


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

int main()
{
  string a,b;
  cin>>a>>b;
  a = a+b;
  stringstream d(a);
  int n;
  d>>n;
  int k = sqrt(n);
  if(k*k==n)
    cout<<"Yes\n";
  else
    cout<<"No\n";
  
  
  return 0;
}

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N,M;
    Scd2(N,M);
    int B = 1<<N;

    vi dp(B,INF);

    vii key(M,pii(0,0));

    int a,b;
    int c;
    Rep(i,M){
        Scd2(a,b);
        key[i].first = a;
        Rep(j,b){
            Scd(c);
            c--;
            key[i].second |= (1<<c);
        }
    }

    dp[0] = 0;
    Rep(bi,B){
        Rep(mi,M){
            int bbi = bi|key[mi].second;
            dp[bbi] = min( dp[bi]+key[mi].first , dp[bbi] );
        }
    }

    printf ("%d\n", dp[B-1] == INF ? -1 : dp[B-1] );

    return 0;
}





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

// x番の組織が親組織に提出する枚数を返す
// childrenは組織の関係を表す2次元配列(参照渡し)
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  vector<int> C(N-1);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = 0; i < N; i++) {
    cin >> B.at(i);
  }
  for (int i = 0; i < N-1; i++) {
    cin >> C.at(i);
  }
  
  int sum = 0;
  for (int i = 0; i < N-1; i++) {
    sum += B.at(A.at(i)-1);
    if (A.at(i+1) == (A.at(i)+1))
      sum += C.at(A.at(i)-1);
  }
  
  sum += B.at(A.at(N-1)-1);
  
  cout << sum << endl;
}




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

using namespace std;

typedef pair<long, int> p;

int main(){
    long N, P;
    int divs = 0;
    long ans = 1;
    vector<p> d;
    cin >> N >> P;
    for(long i = 2; i*i <= P; i++){
        if(P == 1) break;
        if(P%i == 0){
            long cnt = 0;
            while(P%i == 0){
                cnt++;
                P = P/i;
            }
            if(cnt >= N){
                d.push_back(p(i, cnt));
            }
            cnt = 0;
            //divs++;
        }
    }
    if(P != 1) d.push_back(p(P, 1));
    
    for(long i = 0; i < d.size(); i++){
        //if(d[i].second >= N) ans *= d[i].first;
        long n = d[i].second;
        long m = d[i].first;
        while(n >= N){
            ans *= m;
            n -= N;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
K = int(input())

que = [1, 2, 3, 4, 5, 6, 7, 8, 9]

for i in range(K):
    temp = que[i]
    if i == K-1:
        print(que[i])
        break
    mod = temp % 10
    if mod == 0:
        que += [temp*10+(mod), temp*10+(mod)+1]
    elif temp % 10 == 9:
        que += [temp*10+(mod)-1, temp*10+(mod)]
    else:
        que += [temp*10+(mod)-1, temp*10+(mod), temp*10+(mod)+1]


Measured memory_bytes: 15740
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
#define vecmin(A) *min_element(A.begin(),A.end())
#define vecmax(A) *max_element(A.begin(),A.end())
typedef long long ll;

int main(){
  int n;
  cin >> n;
  int m = 0;
  while(m*(m+1)/2 < n){
    m ++;
  }
  while(n > 0){
    if(m <= n){
      n -= m;
      cout << m << endl;
    }
    m --;
  }
}

Measured memory_bytes: 3628
#include <stdio.h>

int main(void)
{
    double W;

    while (scanf("%lf", &W) != EOF)
    {
        if (W <= 48.00){
            printf("light fly\n");
        }else if (48.00 < W && W <= 51.00){
            printf("fly\n");
        }else if (51.00 < W && W <= 54.00){
            printf("bantam\n");
        }else if (54.00 < W && W <= 57.00){
            printf("feather\n");
        }else if (57.00 < W && W <= 60.00){
            printf("light\n");
        }else if (60.00 < W && W <= 64.00){
            printf("light welter\n");
        }else if (64.00 < W && W <= 69.00){
            printf("welter\n");
        }else if (69.00 < W && W <= 75.00){
            printf("light middle\n");
        }else if (75.00 < W && W <= 81.00){
            printf("middle\n");
        }else if (81.00 < W && W <= 91.00){
            printf("light heavy\n");
        }else if (91.00 < W){
            printf("heavy\n");
        }
    }
    return (0);
}


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

#define ll long long
#define maxn 5000
#define mod 1000000007
ll ans[maxn],n;
void task()
{
    for(int i = 0; i <= 2; i++)
    {
        ans[i] = 0;
    }
    ans[3] = 1;
    for(int i = 4; i <= 2005; i++)
    {
        ans[i] = (ans[i-1] + ans[i-3]) % mod;
    }
}
int main()
{
    cin >> n;
    task();
    cout << ans[n];
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 998244353, M = 1e6 + 10;

ll powll(ll x, ll y){
    x %= mod;
    ll res = 1LL;
    while(y){
        if (y & 1LL)
            res *= x;
        res %= mod;
        x = (x*x) % mod;
        y >>= 1LL;
    }
    return res;
}

ll divll(ll x, ll y){
    x %= mod;
    return (x * powll(y,mod-2)) % mod;
}

int main() {
    int n;
    cin >> n;
    VL a(n), cnt(M);
    REP(i,n){
        a[i] = in();
        cnt[a[i]]++;
    }
    VL s(M);
    FOR(d,1,M-1){
        for (ll e = d; e < M; e += d) (s[d] += cnt[e] * e) %= mod;
    }
    VL dp(M);
    FORR(d,M-1,1){
        ll x = s[d];
        x = (x * x) % mod;
        for (int y = 2 * d; y < M; y += d){
            x = (x - dp[y] + mod) % mod;
        }
        dp[d] = x;
    }
    ll ans = 0;
    FOR(d,1,M-1) ans = (ans + divll(dp[d], d)) % mod;
    REP(i,n) ans = (ans - a[i] + mod) % mod;
    ans = divll(ans, 2);
    cout << ans << endl;

    return 0;
}


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

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

int main()
{
    canhazfast();

    int a, b, c, k;

    cin >> a >> b >> c >> k;
    while (a >= b) b *= 2, --k;
    while (b >= c) c *= 2, --k;
    cout << (k < 0 ? "No\n" : "Yes\n");

    return 0;
}


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

int func(int n){
   if(n%2==0){ return n/2; }
   else{ return 3*n+1; }
}

int main() {
  
  int s;
  cin >> s;
  
  int a = s;
  vector<int> lis;
  lis.push_back(a);
  bool flag=true;
  int m = 0;
  int not1=0;
  while(flag){
    a = func(a);
    lis.push_back(a);
    if(not1){
      for(int i=0; i<lis.size(); ++i){
        if(i==lis.size()-1){ continue; }
        else if(lis.at(i)==lis.at(lis.size()-1)){
          m = lis.size();
          flag = false;
          break;
        }
      }
    }
    not1+=1;
  }
  cout << m << endl;
}



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

public class Main {


	public static void main(String[] args) {
		Main ans = new Main();
		System.out.println(ans.solve());
	}

	private long solve() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();

		Map<Integer, List<Integer>> graph = new HashMap<>();
		for(int i=1;i<=M;i++){
			int u = sc.nextInt();
			int w = sc.nextInt();
			List<Integer> children = graph.getOrDefault(u, new ArrayList<Integer>());
			children.add(w);
			graph.put(u, children);
		}
		long [] dp = new long[N+1];
		long ans=0;
		for(int i=1;i<=N;i++){
			ans = Math.max(solve(i, graph, dp), ans);
		}

		return ans;
	}

	private long solve(int u, Map<Integer, List<Integer>> graph, long[] dp) {

		if (!graph.containsKey(u)) return 0;
		if (dp[u]!=0) return dp[u];
		long bestChild = 0;
		for(int child: graph.get(u)) {
			bestChild = Math.max(bestChild, solve(child, graph, dp));
		}

		dp[u] = 1+bestChild;
		return dp[u];
	}
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define VEC(TYPE, A, NAME, INIT) vector<TYPE> NAME(A, INIT)
#define VEC2(TYPE, A, B, NAME, INIT) vector<vector<TYPE>> NAME(A, vector<TYPE>(B, (INIT)))

struct St{
    ll a,b, sum;
};
bool operator>(const St& l, const St& r)
{ if( l.sum == r.sum ) { return l.a > r.a; }
return l.sum > r.sum; }

int main()
{
    ll n;
    cin >> n;
    VEC( St, n, st, St() );
    REP( i,n ) { cin >> st[i].a >> st[i].b; st[i].sum = st[i].a + st[i].b; }
    sort( st.begin(), st.end(), greater<St>() );

    ll ans = 0;
    bool isT = true;
    REP(i,n)
    {
        ll summ = st[i].sum;
        int j = i + 1;
        for( ; j < n; ++j )
        {
            if( st[j].sum != summ ) break;
        }

        int to = ( j - i ) / 2 + i;
        if( ( j - i ) % 2 == 0 )
        {
            for( int k = i; k < j; ++k )
            {
                if( k < to ) ans += st[k].a;
                else ans -= st[k].b;
            }
        }
        else
        {
            for( int k = i; k < j; ++k )
            {
                if( k < to ) ans += st[k].a;
                else if( k == to )
                {
                     if( isT ) ans += st[k].a;
                     else ans -= st[k].b;
                }
                else ans -= st[k].b;
            }
            isT = !isT;
        }
        i = j - 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main(){
    ll n;
    cin >> n;
    ll a[n + 2] = {}, sum = 0;
    for(ll i = 0; i < n; i++){
        cin >> a[i + 1];
        sum += (ll)abs(a[i + 1] - a[i]);
    }
    sum += (ll)abs(a[n]);   
    for(ll i = 1; i <= n; i++) cout << sum - (ll)abs(a[i] - a[i + 1]) - (ll)abs(a[i - 1] - a[i]) + (ll)abs(a[i - 1] - a[i + 1]) << endl;
    return 0;
}

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

int main()
{
  int n;
  std::string s;
  std::cin >> n >> s;
  int n_west[n+1] = {};
  
  for ( int i = 0; i < n; i++ ) {
    if (s[i] == 'W') {
      n_west[i+1] = n_west[i] + 1;
    } else {
      n_west[i+1] = n_west[i];
    }
  }

  int ans = 300000;
  for ( int i = 0; i < n; i++ ) {
    int tmp = 0;
    tmp += (n-i-1) - (n_west[n] - n_west[i+1]);
    tmp += n_west[i];
    if ( ans > tmp ) {
      ans = tmp;
    }
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 1796
//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define dl          double
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define lb lower_bound
#define ub upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main(){
	ll n,k;cin>>n>>k;
	ll a[n+1];
	for(ll i=1;i<=n;i++)cin>>a[i];
	ll dp[n+1];
	for(ll i=0;i<=n;i++)dp[i]=1e15;
	dp[0]=0;
	dp[1]=0;
	for(ll i=2;i<=n;i++){
		for(ll j=1;j<=k and i-j>=1;j++){
			dp[i]=min(abs(a[i]-a[i-j])+dp[i-j],dp[i]);
		}
	}
	//for(int i=1;i<=n;i++)cout<<dp[i]<<" ";cout<<endl;
	cout<<dp[n]<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
	string s;
  cin>>s;
  if(n&1) {
    cout<<"No";
    return 0;
    }
  for(int i=0;i<n/2;i++){
  	if(s[i]!=s[n/2+i]){
      cout<<"No";
      return 0;
    }
   }
  cout<<"Yes";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
long long int a[MAXN], b[MAXN];
int main()
{
	int n;
	cin>>n;
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i]>>b[i];
	}
	long long int ans = 0;
	for (int i = n - 1; i >= 0; --i)
	{
		a[i]+=ans;
		ans+=(b[i] - a[i]%b[i])%b[i];
	}
	cout<<ans<<"\n";
	return 0;
}

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

int main() {
    int64_t N;
    cin >> N;
    int64_t sum = 0;
    rep(i, N+1) {
        if ((i % 3 == 0) || (i % 5 == 0))
        {
            continue;
        } else {
            sum += i;
        }
    }
    cout << sum;

}

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

using namespace std;
int main(){
  string x;
   cin >> x;
  
   stack<char> s;
  
  for(int i=0;i<x.length();i++){
   if(x[i]=='S'||s.empty()||s.top()=='T') s.push(x[i]);
   else s.pop(); 
  }
  
  cout << s.size() << endl;
  
}

Measured memory_bytes: 644
#include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
#include<cmath>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    double x1, y1, x2, y2, x3, y3;
    double a1, a2, b1, b2, c1, c2;
    double xans, yans, r;
    int n;

    cin >> n;
    rep(i,n){
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        a1 = 2 * (x2 - x1);
        b1 = 2 * (y2 - y1);
        c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;
        a2 = 2 * (x3 - x1);
        b2 = 2 * (y3 - y1);
        c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;
        xans = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
        yans = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
        r = sqrt( (x1 - xans) * (x1 - xans) + (y1 - yans) * (y1 - yans) );
        cout << fixed;
        cout << setprecision(3) << xans << " " << yans << " " << r << endl;
    }
}

Measured memory_bytes: 1288
#include <bits/stdc++.h>
const int maxn = 2007, maxk = int(2e4) + 7, inf = 0x3f3f3f3f;
char str[maxn][maxk], ans[maxk];
bool f[maxn][maxk];
int len_str[maxn], len_set, n, k;
struct { int index, pos; } set[3][maxn << 1];
bool judge() {
    int ch_cnt[128] = {0}, tot_cnt = 0;
    char ch_cur = 'a';
    for (int i = 1; i <= n; i++) for (int j = 1; j <= len_str[i]; j++) ch_cnt[str[i][j]]++;
    for (char ch = 'a'; ch <= 'z'; ch++) if (ch_cnt[ch]) tot_cnt++, ch_cur = ch;
    if (tot_cnt == 1) {
        for (int i = 1; i <= k; i++) printf("%c%s", ch_cur, i == k ? "\n" : "");
        return true;
    }
    return false;
}
int main() {
//    freopen("in.txt", "r", stdin);
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; i++) {
        scanf("%s", str[i] + 1);
        len_str[i] = int(strlen(str[i] + 1));
    }
    if (judge()) return 0;
    f[n + 1][0] = true;
    for (int i = n, suf_sum = 0, upper; i >= 1; i--) {
        suf_sum += len_str[i], upper = std::min(suf_sum, k);
        for (int j = 0; j <= upper; j++) {
            f[i][j] = f[i + 1][j];
            if (j >= len_str[i]) f[i][j] |= f[i + 1][j - len_str[i]];
        }
    }
    for (int i = 1; i <= n; i++) if (f[i + 1][k - len_str[i]]) set[0][++len_set] = {i, 1};
    for (int i = 1, cur = 0, new_len_set, min_index; i <= k; i++) {
        char min_ch = 127;
        for (int j = 1, index, pos; j <= len_set; j++) {
            index = set[cur][j].index, pos = set[cur][j].pos;
            if (min_ch > str[index][pos]) min_ch = str[index][pos];
        }
        ans[i] = min_ch, new_len_set = 0, min_index = inf;
        for (int j = 1, index, pos; j <= len_set; j++) {
            index = set[cur][j].index, pos = set[cur][j].pos;
            if (str[index][pos] > min_ch) continue;
            if (pos < len_str[index]) set[cur ^ 1][++new_len_set] = {index, pos + 1};
            else if (index < min_index) min_index = index;
        }
        for (int j = min_index + 1; j <= n; j++) if (len_str[j] <= k - i && f[j + 1][k - i - len_str[j]])
                set[cur ^ 1][++new_len_set] = {j, 1};
        len_set = new_len_set, cur ^= 1;
    }
    for (int i = 1; i <= k; i++) printf("%c%s", ans[i], i == k ? "\n" : "");
    return 0;
}


Measured memory_bytes: 77568
#include<bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define acc_io cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define vvl vector<vector<ll>>
#define vl  vector<ll>
#define rep(i,sta,end) for(ll i=sta;i<end;i++)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
typedef long long ll;
const ll MOD = 1000000007;
const double PI = acos(-1);
//name[i]   -> vl  name(i)
//name[i][j]-> vvl name(i,vl(j))
//or-> ||
int k;
signed main(){
	acc_io;
	cin>>k;
	ll sum=0;
	rep(i,1,k+1){
		rep(j,1,k+1){
			rep(m,1,k+1){
				sum+=__gcd(i,__gcd(j,m));
			}
		}
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 3660
N = int(input())
a = list(map(int, input().split()))

prev = 1
crash = 0

if not 1 in a:
  print("-1")
else:
  for i in range(N):
    if a[i] == prev:
      prev += 1
    else:
      crash += 1
  else:
    print(crash)

Measured memory_bytes: 26704
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
#include <map>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define ll long long
#define rn(i,n) for(int i=1;i<=n;i++)

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

  int f = -1;
  for(int i=s.size()-t.size(); i>=0;i--){
    bool ok = true;
    r(j,t.size()){
      if(s[i+j] != t[j] && s[i+j] != '?'){
	       ok = false;
        }
      }
    if(ok){
      f = i;
      break;
    }
  }
  if(f == -1) cout << "UNRESTORABLE" << endl;
  else{
    r(i,t.size()){
      s[f+i] = t[i];
    }
    r(i,s.size()){
      if(s[i] == '?') s[i] = 'a';
    }
    cout << s << endl;
  }
  return 0;
}


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

#define ALL(v) (v).begin(),(v).end()

using namespace std ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;




int main()
{
  int a, b, c ;
  cin >> a >> b >> c ;
  
  if(a%2==0 || b%2==0){
    cout <<"No"<<endl ;
  }
  else{
    cout <<"Yes"<<endl ;
  }
    return 0 ;
}

/*　吾輩はやれば出来る子である。 
　　　　∩∩ 
　　　（´･ω･） 
　　 ＿|　⊃／(＿＿_ 
　／　└-(＿＿＿_／ 
　￣￣￣￣￣￣￣ 
　やる気はまだない 

　　 ⊂⌒／ヽ-、＿_ 
　／⊂_/＿＿＿＿ ／ 
　￣￣￣￣￣￣￣　　*/


Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.Scanner;

/**
 * @author kawakami
 *
 */
class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		StringBuilder sb = new StringBuilder();
		Scanner as = new Scanner(System.in);
		LinkedList<Integer> list = new LinkedList<Integer>();
		
		int a,b;
		int top = -1;
		String st = "";
		
		while(as.hasNext()){
			
			st = as.next();
			switch (st){
			case "+":
				a = list.remove(top);
				top--;
				b = list.remove(top);
				list.add(b+a);
				break;
				
			case "-":
				a = list.remove(top);
				top--;
				b = list.remove(top);
				list.add(b-a);
				break;
				
			case "*":
				a = list.remove(top);
				top--;
				b = list.remove(top);
				list.add(b*a);
				break;
				
			default :
				list.add(Integer.parseInt(st));
				top++;
			
			}
			
		}
		
		System.out.println(list.get(0).toString());

	}

}

Measured memory_bytes: 26196
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int arr[n];
  for(int i=0;i<n;i++)
  {
    cin>>arr[i];
  }
  int dp[n]={0};
  for(int i=1;i<n;i++)
  {
    if(i==1)
    {
      dp[i]=abs(arr[i]-arr[i-1]);
    }
    else
    {
      dp[i]=min(abs(abs(arr[i]-arr[i-2])+dp[i-2]),(abs(arr[i]-arr[i-1])+dp[i-1]));
    }
  }
  cout<<dp[n-1];
}


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

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

    return 0;
}

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

int main() {
  int A, B, fa, fb, cnt, i;
  cin >> A >> B;
  cnt = 0;
  for (i=1;i<1251;i++) {
    fa = int(i*0.08);
    fb = int(i*0.1);
    if (fa == A && fb == B) {
      cout << i << endl;
      cnt += 1;
      break;
    }
  }
  if (cnt == 0) {
    cout << -1 << endl;
  }
}


Measured memory_bytes: 256
s=input()
t=["AKIHABARA","AKIHABAR","AKIHABRA","AKIHBARA","KIHABARA",\
  "AKIHABR","AKIHBAR","KIHABAR","AKIHBRA","KIHABRA","KIHBARA",\
  "AKIHBR","KIHABR","KIHBAR","KIHBRA","KIHBR"]
if s in t:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 2940
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	long long n, m;
	cin >> n >> m;
	if (n > m) swap(n, m);
	if (m - n > 1) {
		cout << "0" << endl;
		return 0;
	}
	long long ans = 1;
	for (int i = 1;i <= n;++i) {
		ans *= i;
		ans %= MAX_MOD;
	}
	for (int q = 1;q <= m;++q) {
		ans *= q;
		ans %= MAX_MOD;
	}
	if (m - n == 0) {
		ans *= 2;
		ans %= MAX_MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int> m[100005];
int deg[100005];// 出度 
int pa[100005];
int t[100005];
int d[100005];// 深度
int h[100005];// 高度 
int sib[100005];
int dfs(int i,int dep){
	d[i]=dep;
	for(int j=0;j<m[i].size();j++)h[i]=max(dfs(m[i][j],dep+1),h[i]);
	return h[i]+1;
}
int main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int n;cin>>n;
	memset(pa,-1,sizeof(pa));
	memset(sib,-1,sizeof(sib));
	for(int tu,tv;cin>>tu;){
		cin>>tv;
		if(tv!=-1){
			m[tu].push_back(tv);
			pa[tv]=tu;deg[tu]++;
			m[tv].size()>0?(t[tv]=1):(t[tv]=2);
			pa[tu]!=-1?(t[tu]=1):0;
		}
		int tv2=tv;
		cin>>tv;tv==-1?0:(m[tu].push_back(tv),0);
		if(tv!=-1){
			m[tu].push_back(tv);
			pa[tv]=tu;deg[tu]++;
			m[tv].size()>0?(t[tv]=1):(t[tv]=2);
			pa[tu]!=-1?(t[tu]=1):0;
		}
		tv2==-1?0:(sib[tv2]=tv);
		tv==-1?0:(sib[tv]=tv2);
	}
	for(int i=0;i<n;i++)if(t[i]==0)dfs(i,0);
	for(int i=0;i<n;i++){
		printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n",
		i,pa[i],sib[i],deg[i],d[i],h[i],t[i]==0?"root":(t[i]==1?"internal node":"leaf"));
	}
	return 0;
}


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

#define SWAP(type, a, b){type tmp=a;a=b;b=tmp;}

int main(){
    long A, B;
    cin >> A >> B;
    if(A < B){
        SWAP(long, A, B);
    }
    if((A-B) % 2 == 0){
        long forK = (A-B)/2;
        long K = A - forK;
        cout << K << endl;
    }
    else{
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
/* HARDWORK IS THE KEY TO SUCCESS.
       RATING IS TEMPORARY , KNOWLEDGE IS PERMANENT.!!!*/
    #include <bits/stdc++.h>
    #define pragma
    using namespace std;
    #define ll long long
    #define ld long double
    #define T ll t = 1; cin>>t; while(t--)
    #define vin ll n; cin>>n; vector<ll>x(n); for(ll i=0; i<n; i++) cin>>x[i]
    #define vout for(ll i=0; i<n; i++) cout<<x[i]<<" "
    #define ain ll n,k,i; cin>>n; ll a[n]; for( i=0; i<n; i++) cin>>a[i]
    #define aout for(ll i=0; i<n; i++) cout<<a[i]<<" "
    #define matin ll m,n; cin >> n >> m; ll a[n + 1][m + 1] ; for(ll i=1;i<=n;i++) for(ll j=1;j<=m;j++) cin>>a[i][j];
    #define matout for(ll i=0;i<m;i++){for(ll j=0;j<n;j++) cout<<a[i][j]<<" "; cout<<"\n";}
    #define sin set<ll>s; ll n; cin>>n; ll tmp; for(ll i=0;i<n;i++){cin>>tmp; s.I(tmp);}
    #define sout for(auto it=s.begin();it!=s.end();++it) cout<<*it<<" "
    #define F first
    #define S second
    #define I insert
    #define pb push_back
    #define ppb pop_back
    #define AISORT sort(a,a+n)
    #define ADSORT sort(a,a+n,greater<ll>())
    #define VISORT sort(x.begin(),x.end())
    #define VDSORT sort(x.begin(),x.end(),greater<ll>())

    const ll maxs = 1e5+3;
    const ll maxs1 = 1e3+4;
    const ll mod = 1e9 + 7;

    //MODULO OPEARTIONS
    inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
    inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
    inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

    //POWER
    ll fastpow(ll x,ll y)
    {ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

    //MODULAR INVERSE
    ll inv(ll x){ return fastpow(x , mod - 2);}

//     ll n;
//     ll a[maxs];
//     ll tree[maxs];
    bool vis[maxs];
    vector<ll>graph[maxs];
    //ALWAYS CLEAR THEM WHEN TESTCASES ARE GIVEN
    //ALWAYS RETURN WHEN ST == ED CONDITION IN SEGMENT TREES


    int main()
    {
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
       ld r;
        cin >> r;
        ld pi = 3.141592653589793238;
        ld res = 2 * pi * r;
        cout << fixed << setprecision(20) << res;
    }

Measured memory_bytes: 6148
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] d = new int[N];
    for(int i=0;i<N;i++){
      d[i] = sc.nextInt();
    }
    Arrays.sort(d);
    int x = d[0];
    int ans = 1;
    for(int i=0;i<d.length;i++){
      if(x!=d[i]){
        ans++;
        x = d[i];
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 35900
while True:
    H, W = map(int,input().split())
    if (H,W) == (0,0):
        break
    print("#"*W)
    for j in range(1,H-1):
        line = []
        line = "#"
        for i in range(1,W-1):
            line+="."
        line+="#"
        print("".join(line))
    print("#"*W)
    print("")


Measured memory_bytes: 5612
import sys
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if V <= W:
    print('NO')
    sys.exit()    

kyori = abs(A-B)
speed = abs(W-V)
ans = kyori / speed
if ans <= T:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 9176
#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>

using namespace std;

int main(int argc, char* argv[]) {

	int a,b,c;

	cin >> a >> b >> c;

	if(a+b==c || b+c==a || a+c==b){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;

}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;

int main()
{
  cin.tie(0);
  int H, W, h, w;
  cin >> H >> W;
  cin >> h >> w;
  cout << H * W - (h * W) - (w * H) + h * w << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define w(t) int t;cin>>t;while(t--)
#define pb push_back
#define mk make_pair
#define ascSort(v) sort(v.begin(), v.end())
#define descSort(v) sort(v.begin(), v.end(), greater<int>())
#define ff first
#define ss second
#define pi pair<int,int>
#define vi vector<int>
#define umapi unordered_map<int,int>
#define INF 1000000007
#define PI 3.14159265
const int mod=998244353;
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>PBDS;

void FIO(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
}
bool cmp(int a, int b){
	return a>b;
}
int32_t main(){
	
	FIO();
	
		int k,a,b;cin>>k>>a>>b;
		if(b/k-(a-1)/k)
			cout<<"OK";
		else
			cout<<"NG";
	return 0;
	
		
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll n, k, q;
    cin >> n >> k >> q;
    vector<ll> v(q);
    vector<ll> p(n, k - q);

    for (ll i = 0; i < q; i++)
    {
        ll temp;
        cin >> temp;
        p[temp - 1]++;
    }

    for (auto t : p)
    {
        if (t > 0)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 2176
#include<cstdio>
long long N;
int a[410];
int main(){
	scanf("%lld",&N);N++;
	int*h=a+201,*t=h,n=0;
	int i=44;while(!(N>>i))i--;
	while(i--){
		*t++=++n;
		if(N>>i&1)*--h=++n;
	}
	printf("%d\n",n*2);
	for(int i=0;i<n*2;i++)printf("%d%c",i<n?h[i]:i-n+1," \n"[i==n*2-1]);
}

Measured memory_bytes: 128
#include <stdio.h>

int divisor(int,int);
int main(){
    int x,y,dMax;
    
    scanf("%d %d",&x,&y);
    
    if(x>y){
        dMax = divisor(x,y);
    }else{
        dMax = divisor(y,x);
    }
    
    printf("%d\n",dMax);
    return 0;
}

int divisor(int x,int y){
    int a,dMax;
    
    while(y>0){
        a = x%y;
        x = y;
        y = a;
    }
    
    return x;
}



Measured memory_bytes: 2108
N=int(input())
a=list(map(int, input().split()))
b=[0]*N
for i in range(N):
  if i%2==0: # 前から
    b[i//2]=str(a[N-1-i])
  else:
    b[N-1-i//2]=str(a[N-1-i])
print(" ".join(b))
  

Measured memory_bytes: 31940
S = input()

ss = []
ans = 0
for i in range(len(S)): ss.append(S[i])

zeros = 0
ones = 0

for i in range(len(ss)):
    if ss[i] == "0":
        zeros += 1
    elif ss[i] == "1":
        ones += 1

ans = 2*min(zeros, ones)
print(ans)


Measured memory_bytes: 3956
//Code by Mukul Totla
#include<bits/stdc++.h>
using namespace std;
#define ll long long

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

  ll n,k,i;
  cin>>n>>k;
  ll arr[n+1];
  for(i=1; i<=n; i++)
    cin>>arr[i];
  deque<ll>d;
  for(i=1; i<=k; i++)
    d.push_back(arr[i]);
  for(i=k+1; i<=n; i++)
  {
    ll front=d.front();
    if(arr[i]>front)
    {
      cout<<"Yes\n";
      d.push_back(arr[i]);
      d.pop_front();
    }
    else
    {
      cout<<"No\n";
      d.push_back(arr[i]);
      d.pop_front();
    }
  }

  return 0;
}

Measured memory_bytes: 6328
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int H, W;
char S[12][12];
bool used[12];
vector<int> seq;

char buf[13];

inline pair<long long, long long> encode() {
  pair<long long, long long> ret;
  rep(i, W) ret._1 = 26LL*ret._1 + (buf[i]-'a');
  for (int i=W-1; i>=0; i--) ret._2 = 26LL*ret._2 + (buf[i]-'a');
  return ret;
}

void f(int k) {
  if (k == 0) {
    vector<pair<long long, long long> > vs;
    rep(y, H) {
      int ctr = 0;
      rep(x, seq.size()) buf[ctr++] = S[seq[x]][y];
      rep(x, W) if (!used[x]) buf[ctr++] = S[x][y];
      vs.pb(encode());
    }
    vector<bool> dead(vs.size(), false);
    rep(i, H) if (!dead[i]) {
      for (int j=i+1; j<H; j++) if (vs[i]._1 == vs[j]._2) {
        dead[i] = dead[j] = true;
        break;
      }
    }
    vector<pair<long long, long long> > alive;
    rep(i, H) if (!dead[i]) alive.pb(vs[i]);
    if (H%2 == 0 && alive.empty()) {
      cout << "YES\n";
      exit(0);
    }
    if (H%2 == 1 && alive.size() == 1 && alive[0]._1 == alive[0]._2) {
      cout << "YES\n";
      exit(0);
    }
    return;
  }
  rep(i, W) if (!used[i]) {
    used[i] = true;
    seq.pb(i);
    f(k-1);
    seq.pop_back();
    used[i] = false;
  }
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> H >> W;
  rep(y, H) rep(x, W) cin >> S[x][y];
  f((W+1)/2);
  cout << "NO\n";
  return 0;
}


Measured memory_bytes: 256
import Foundation

let str: String = readLine()!

var count: Int = 0

for i in 0...2{
	if(str[str.index(str.startIndex, offsetBy: i)] == "R"){
  		count = 1
	}
}

for i in 1...2{
  if(str[str.index(str.startIndex, offsetBy: i)] == "R" && str[str.index(str.startIndex, offsetBy: i-1)] == "R"){
    count += 1
  }
}

print(count)

Measured memory_bytes: 13096
#include <stdio.h>
 
int main(){
    int card[4][13];
    int i, n, tempint, j;
    char tempstr;
    char mark[4];
    
    for(i=0;i<4;i++){
        for(j=0;j<13;j++){
            card[i][j] = 0;
        }
    }

    mark[0] = 'S';
    mark[1] = 'H';
    mark[2] = 'C';
    mark[3] = 'D';
    
    scanf("%d", &n);
    
    for(i=0;i < n;i++){
        scanf(" %c %d", &tempstr, &tempint);

        if(tempstr == 'S'){card[0][tempint-1] = 1;}
        if(tempstr == 'H'){card[1][tempint-1] = 1;}
        if(tempstr == 'C'){card[2][tempint-1] = 1;}
        if(tempstr == 'D'){card[3][tempint-1] = 1;}
    }
    
    for(i=0;i<4;i++){
        for(j=0;j<13;j++){
           if(card[i][j] == 0){printf("%c %d\n",mark[i],j+1);}            
        }
    }
    return 0;   
}

Measured memory_bytes: 596