akhauriyash/Code-Regression huggingface dataset:
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main implements Runnable {
	public static void main(String[] args) {
		new Main().run();
	}

	long MOD = (long) (1e9 + 7);

	public void run() {
		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();
		}
		boolean[][] ok = new boolean[2][1 << 24];
		ok[0][1] = true;
		for (int i = 0; i < N; ++i) {
			int idx = i % 2;
			Arrays.fill(ok[idx ^ 1], false);
			for (int j = 0; j < 1 << 24; ++j) {
				if (!ok[idx][j])
					continue;
				if ((j & (1 << D[i])) == 0)
					ok[idx ^ 1][j | 1 << D[i]] = true;
				if ((j & (1 << ((24 - D[i]) % 24))) == 0)
					ok[idx ^ 1][j | 1 << ((24 - D[i]) % 24)] = true;
			}
		}
		int cur = N % 2;
		int ans = 0;
		for (int i = 0; i < 1 << 24; ++i) {
			if (ok[cur][i]) {
				int tmp = Integer.MAX_VALUE / 3;
				for (int j = 0; j < 24; ++j) {
					if ((i >> j) % 2 == 0)
						continue;
					int k = j + 1;
					while (k < 24 && (i >> k) % 2 == 0)
						++k;
					if (k == 24) {
						k = 0;
						while ((i >> k) % 2 == 0)
							++k;
						tmp = Math.min(tmp, Math.min(j - k, 24 - (j - k)));
					} else {
						tmp = Math.min(tmp, Math.min(24 - (k - j), k - j));
						j = k - 1;
					}
				}
				ans = Math.max(ans, tmp);
			}
		}
		System.out.println(ans);
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


Measured memory_bytes: 59824
#include<bits/stdc++.h>
using namespace std;
#define maxn 200100
int n,k,x;
int cnt[maxn];
int main()
{
    scanf("%d%d",&n,&k);
    int ans=n;
    for(int i=1;i<=n;++i)
    {
        scanf("%d",&x);
        ++cnt[x];
    }
    sort(cnt+1,cnt+n+1);
    for(int i=0;i<k;++i) ans-=cnt[n-i];
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 1152
# EDPC B Frog 2
N, K = map(int, input().split())
H = list(map(int,input().split()))

cost = [float("inf")]*N
cost[0] = 0
cost[1] = abs(H[1]-H[0])

for i in range(2,N):
    for k in range(1,min(K,i)+1):
        cost[i] = min(cost[i], cost[i-k]+abs(H[i]-H[i-k]))

print(cost[N-1])


Measured memory_bytes: 84864
/*
      author  : nishi5451
      created : 15.08.2020 11:29:32
*/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;


int main(){
    int n;
    cin >> n;
    vector<int> p(n),q;
    rep(i,n) cin >> p[i];
    q = p;
    sort(q.begin(),q.end());
    if(p==q){
        cout << "YES" << endl;
        return 0;
    }
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            vector<int> r(p);
            swap(r[i],r[j]);
            /*bool check = true;
            rep(m,n){
                if(r[m]!=q[m]){
                    check = false;
                    break;
                }
            }
            if(check==true){*/
            if(r==q){
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
    return 0;
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    map<int,int> m;
    int n;
    cin>>n;
    int a[n];
    int i;
    for(i=0;i<n;i++)
    {
    	cin>>a[i];
    	m[a[i]]++;
	}
	int j;
	int ans=0;
	for(i=0;i<n;i++)
	{
		m[a[i]]--;
		for(j=1;j*j<=a[i];j++)
		{
			if(a[i]%j==0)
			{
				if(m[a[i]/j]>0 || m[j]>0)
				break;
			}
		}
		if(j*j>a[i])
		ans++;
		m[a[i]]++;
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 33244
import itertools
N=int(input())
x=[0]*N
y=[0]*N
for i in range(N):
	x[i],y[i]=map(int, input().split())
O=[i+1 for i in range(N)]
P=list(itertools.permutations(O,N))
l=0
for i in P:
	z=[int(a) for a in i]
	for b in range(len(z)-1):
		l+=((x[z[b]-1]-x[z[b+1]-1])**2+(y[z[b]-1]-y[z[b+1]-1])**2)**(1/2)
print(l/len(P))


Measured memory_bytes: 8180
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e9+9
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n, t;
vector<PS> vpi;
string s;
int h, m;
char c;
int main(){
	cin >> n >> t;
	PS p;
	REP(i, n){
		if (i == 0){
			cin >> s;
			cin >> s;
			cin >> h >> c >> m;
			cin >> s;
			p = PS(s, h * 60 + m);
		}
		else{
			cin >> h >> c >> m;
			cin >> s;
			if (h * 60 + m - p.second >= t){
				vpi.push_back(PS(p.first, h * 60 + m - p.second));
			}
			cin >> h >> c >> m;
			cin >> s;
			p = PS(s, h * 60 + m);
		}
	}
	cout << vpi.size() << endl;
	REP(i, vpi.size()){
		cout << vpi[i].first << " " << vpi[i].second << endl;
	}
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0; i < 3; i++){
        if(s.at(i) == '1'){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
using ll =long long;
#define PI 3.14159265358979
using P = pair<ll , ll>;
//using map = map<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;

int main(){
    ll x, y;
    cin >> x>>y;
    if(y <= 4*x && y >= 2*x && y%2==0) cout << "Yes" << endl;
    else cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 3600
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	static int[][] map;
	static int[][] directions8 = { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 },
			{ 1, 1 } };
	static int[][] directions4 = { { -1, 0 }, { 1, 0 }, { 0, -1 }, { 0, 1 } };
	static int ans;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		System.out.println(T + S);
	}

	// BFS用に二つの配列を足し算する
	static int[] addArrayElms(int[] a, int[] b) {
		int[] c = new int[a.length];
		for (int i = 0; i < a.length; i++) {
			c[i] = a[i] + b[i];
		}
		return c;
	}

	// //二分探索
	// k <= num となる最小の配列要素kのインデックスを返す
	static private int binarySearch(long num, long[] orderedArray) {
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while (upperBorder - lowerBorder > 1) {
			mid = (upperBorder + lowerBorder) / 2;
			if (orderedArray[mid] <= num) {
				lowerBorder = mid;
			} else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	// 二分探索
	// k <= num となる最小のList要素kのインデックスを返す
	static private int binarySearch(long num, ArrayList<Long> orderedList) {
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while (upperBorder - lowerBorder > 1) {
			mid = (upperBorder + lowerBorder) / 2;
			if (orderedList.get(mid) <= num) {
				lowerBorder = mid;
			} else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	// aとbの最小公倍数を求める
	public static int gcd(int a, int b) {
		return b == 0 ? a : gcd(b, a % b);
	}

	public static long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}
}


Measured memory_bytes: 39352
# -*- coding: utf-8 -*-

def main(A, B):
    if(A>B):
        print("GREATER")
    elif(B>A):
        print("LESS")
    else:
        print("EQUAL")

    
if __name__ == '__main__':
    A = int(input())
    B = int(input())
    
    main(A, B)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String wanted = sc.nextLine();
        int count = 0;
        while (true){
            String text = sc.nextLine();
            if (text.equals("END_OF_TEXT")){
                break;
            }
            count += count(text, wanted);
        }

        System.out.println(count);

    }



    public static String[] seperate(String text, String delimater) {
        return text.split(delimater);
    }

    public static int count(final String string, final String substring)
    {
        int count = 0;
       String[] have = string.split(" ");
       int length = have.length;
       for (int i =0; i< length; i++){
           if (have[i].toUpperCase().equals(substring.toUpperCase())){
               count++;
           }
       }

       return count;
    }
}



Measured memory_bytes: 26168
def main():
    n,k = map(int,input().split())
    v = list(map(int,input().split()))
    m = 0
    for i in range(k+1):
        if i > n:
            rem = k-n
            have = v
            while len(have)>0 and have[0]<0 and rem>0:
                    have.pop(0)
                    rem -= 1
            s = sum(have)
            if m<s:
                m = s
            break
        for j in range(i+1):
            l=j
            r=i-l
            have = v[0:l]+v[n-r:n]
            rem = k-i
            have = sorted(have)
            if len(have)==0:
                s = 0
            else:
                while len(have)>0 and have[0]<0 and rem>0:
                    have.pop(0)
                    rem -= 1
                s = sum(have)
            if m<s:
                m = s
    print(m)

        

if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include<stdio.h>

#define min(a,b) ((a)<(b)?(a):(b))
#define INF 200000000

int ru2(int a){
		int r=1,i;
		for(i=0;i<a;i++)r*=2;
		return r;
}

int dp[1001][20000];

int main(){
		int n,m,abc[1000][2],i,j;
		scanf("%d%d",&n,&m);
		for(i=0;i<m;i++){
				int b,te=0;
				scanf("%d%d",&abc[i][0],&b);
				for(j=0;j<b;j++){
						int c;
						scanf("%d",&c);
						te+=ru2(c);
				}abc[i][1]=te;
		}
		for(i=0;i<=m;i++){
				for(j=0;j<=ru2(n+1);j++){
						dp[i][j]=INF;
				}
		}
		dp[0][0]=0;
		for(i=0;i<m;i++){
				for(j=0;j<=ru2(n+1);j++)dp[i+1][j]=dp[i][j];
				for(j=0;j<=ru2(n+1);j++){
						dp[i+1][j|abc[i][1]]=min(dp[i+1][j|abc[i][1]],dp[i][j]+abc[i][0]);
				}
		}
		if(dp[m][ru2(n+1)-2]==INF)puts("-1");
		else printf("%d\n",dp[m][ru2(n+1)-2]);
		return 0;
}


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

int main(){
	
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	
	int l = 0, r = 0;
	int sum = 0;
	ll res = 0;
	
	while(true){
		if(r < n && (sum+a[r]) == (sum^a[r])){
			sum += a[r];
			res += r-l+1;
			r++;
		}
		else{
			sum -= a[l];
			l++;
			if(l == n || r == n) break;
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 1024
require 'prime'

a = gets.to_i

class Integer
  def my_divisor_list2
    return [1] if self == 1
    Prime.prime_division(self).map do |e|
      Array.new(e[1]+1).map.with_index do |element, i|
        e[0]**i
      end
    end.inject{|p,q| p.product(q)}.map do |a|
      [a].flatten.inject(&:*)
    end.sort
  end
end
b = a.my_divisor_list2
c = b.count / 2

x = b[c]
y =  b[c - 1]

unless b.count % 2 == 0
  puts x + x - 2
  exit
end

if x == 1 && y == 1
  puts x + y - 1
  exit
else
  puts x + y - 2
end


Measured memory_bytes: 3708
#include <bits/stdc++.h>
#define ll long long
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define INF = 1001001001
#define pi = acos(-1)
using namespace std;
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }

int main(){
    ll n; cin>>n;
    vector<ll> a(n);
    ll money = 1000;
    ll stock = 0;

    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    for (int j = 0; j < n-1; ++j) {
        if(a[j]<a[j+1]){
            stock = money/a[j];
            money += stock*(a[j+1] - a[j]);
        }
    }

    cout << money << endl;

    return 0;
}

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

public class Main {
	
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		
		for(int i = 0; i < n; i++) {
			// data set i
			char[] a = br.readLine().toCharArray();
			char[] b = br.readLine().toCharArray();

			System.out.println(commonSub(a, b));
		}

	}
	public static int commonSub(char[] a, char[] b){
		int n = a.length;
		int m = b.length;
		int[][] len = new int[n+1][m+1];
		for(int i = 1; i <= n; ++i){
			for(int j = 1; j <= m; ++j) {
				if(a[i-1] == b[j-1]){
					len[i][j] = len[i-1][j-1] + 1;
				}else if(len[i-1][j] > len[i][j-1]){
					len[i][j] = len[i-1][j];
				}else{
					len[i][j] = len[i][j-1];
				}
			}
		}
		return len[n][m];
	}
}

Measured memory_bytes: 63400
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  int n;
  cin >> n;
  vector<int> L(n);
  rep(i,n){
    cin >> L[i];
  }
  sort(L.begin(), L.end());
  int ans=0;
  rep(i, n){
    for(int j=i+1; j<n; j++){
      for(int k=j+1; k<n; k++){
        if(L[i]!=L[j] && L[k]!=L[j] && L[i]!=L[k] && L[i]+L[j]>L[k]){
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

struct Node{
    int parent, right, left, depth, height, sibling;
};

const int NIL = -1;

void depthSearch(vector<Node>& tree, int node, int d){
    if(node != -1){
        tree[node].depth = d;
        depthSearch(tree, tree[node].left, d+1);
        depthSearch(tree, tree[node].right, d+1);
    }
}

void heightSearch(vector<Node>& tree){
    int h, node;
    for(int i=0;i<tree.size();i++){
        node = i;
        h = 0;
        while(node != NIL){
            if(tree[node].height < h){
                tree[node].height = h++;
                node = tree[node].parent;
            }
            else break;
        }
    }
}

int main()
{
    int N, node, l, r, root;
    cin >> N;
    vector<Node> tree(N);

    for(int i=0;i<N;i++){
        tree[i].parent = tree[i].height = tree[i].sibling = NIL;
    }

    for(int i=0;i<N;i++){
        cin >> node >> l >> r;
        tree[node].left = l;
        tree[node].right = r;
        if(l != NIL){
            tree[l].parent = node;
            tree[l].sibling = r;
        }
        if(r != NIL){
            tree[r].parent = node;
            tree[r].sibling = l;
        }
    }

    root = 0;
    while(tree[root].parent != -1){
        root = tree[root].parent;
    }
    depthSearch(tree, root, 0);
    heightSearch(tree);

    int degree;
    for(int i=0;i<N;i++){
        cout << "node " << i << ": parent = " << tree[i].parent << ", sibling = " << tree[i].sibling << ", degree = ";
        degree = 0;
        if(tree[i].left != -1) ++degree;
        if(tree[i].right != -1) ++degree;
        cout << degree << ", depth = " << tree[i].depth << ", height = " << tree[i].height << ", ";
        if(tree[i].parent == -1) cout << "root";
        else if(degree == 0) cout << "leaf";
        else cout << "internal node";
        cout << endl;
    }
}


Measured memory_bytes: 3124
# coding: utf-8
# Your code here!

N,M,Q = map(int, input().split(' '))

li = [[0 for i in range(510)] for j in range(510)]

for i in range(M):
    L,R = map(int, input().split(' '))
    li[L][R] = li[L][R]+1
    
for i in range(N+1):
    for j in range(1, N+1):
        li[i][j] = li[i][j] + li[i][j-1]
        
for i in range(1,N+1):
    for j in range(N+1):
        li[i][j] = li[i][j] + li[i-1][j]
    
for i in range(Q):
    p,q = map(int,input().split(' '))
    print(li[q][q]-li[p-1][q]-li[q][p-1]+li[p-1][p-1])


Measured memory_bytes: 13528
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
  	int N, D ,X;
    cin >> N >> D >> X;

    int ans = X;
    for(int i=0;i<N;i++){
      int a;
      cin >> a;
      int k = 1;
      while(k<=D){
        ans++;
        k += a;
      }
    }

    cout << ans <<endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int A, B, C;
    cin >> A >> B >> C;

    if((A == B) && (A == C))
    {
        cout << "No";
    }
    else if( (A - B) * (B - C) * (C - A) == 0)
    {
        cout <<"Yes";
    }
    else
    {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
w = gets.to_i
n = gets.to_i
array = Array.new(n)
for i in 1..n
	set = gets.to_s
	array[i] =  set.split(",")
	array[i][0] = array[i][0].to_i
	array[i][1] = array[i][1].to_i
end 
answer = Array[0]
for i in 1..w
	answer << i
end
for i in 1..n
	temp = answer[array[i][0]]
	answer[array[i][0]] = answer[array[i][1]]
	answer[array[i][1]] = temp
end
puts answer[1..w]

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

int main()
{
  
  int A,B;
  int C;
  int answer;
  
  scanf("%d %d",&A,&B);
  
  C = 2*B;
  
  answer = A - C;
  
  if(answer<=0){
    answer = 0;
  }
    
  printf("%d\n",answer);
  
  return 0; 
}

Measured memory_bytes: 128
// Created by sz
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;

const int N = 1e5 + 5;

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int a,b,k;
    cin>>a>>b>>k;
    
    int cnt = 0;
    vector<int> di;
    int minab = min(a, b);
    for (int i = 1; i <= minab; i++){
        if(a%i==0&&b%i==0)di.push_back(i);
    }
    sort(di.rbegin(), di.rend());
    cout<<di[k-1]<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

template<class T>
inline bool chmax(T &a, T b) {
	if(a < b) {
		a = b;
		return true;
	}
	return false;
}

template<class T>
inline bool chmin(T &a, T b) {
	if(a > b) {
		a = b;
		return true;
	}
	return false;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int i,j;
	ll x;
	cin>>x;
	vector<ll> v;
	ll t=-121;
	while(1){
		if(t>0&&v.size()&&t*t*t*t*t>v[v.size()-1]+inf) break;
		v.pb(t*t*t*t*t);
		t++;
	}
	for(i=0;i<v.size();i++){
		for(j=0;j<v.size();j++){
			if(v[j]-v[i]==x){
				cout<<j-121<<" "<<i-121<<endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 3648
import java.util.NoSuchElementException;
import java.util.Scanner;

enum Figure{
	Rectangularoblong,
	Rhomboid,
	Else
}

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int numRhomboid = 0;
		int numRectangularoblong = 0;
		
		try{
			while(true){
				String str = sc.nextLine();
				String[] input = str.split(",");
				if(isFigure(Figure.Rectangularoblong, getType(Integer.valueOf(input[0]), Integer.valueOf(input[1]), Integer.valueOf(input[2])))){
					numRectangularoblong++;
				}
				else if(isFigure(Figure.Rhomboid, getType(Integer.valueOf(input[0]), Integer.valueOf(input[1]), Integer.valueOf(input[2])))){
					numRhomboid++;
				}
			}
		}catch(NoSuchElementException e){
			//何もしない
		}

		System.out.println(numRectangularoblong);
		System.out.println(numRhomboid);
	}
	
	public static Figure getType(int w, int h, int diagonal){
		double tmp = w * w + h * h;
		//長方形は2辺の二乗の和と対角線の二乗が等しい
		if(diagonal * diagonal == tmp){
			return Figure.Rectangularoblong;
		}
		//平行四辺形はとなりあう辺の長さが等しい
		if(w == h){
			return Figure.Rhomboid;
		}
		//それいがい
		return Figure.Else;
	}
	
	private static boolean isFigure(Figure type, Figure figure){
		if(type == figure){
			return true;
		}
		else{
			return false;
		}
	}
}

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

int main() {
  int N,M,X;
  cin >> N >> M >> X;
  
  vector<int> sq(N + 1);
  int A;
  
  for (int i = 0; i < M; i++) {
    cin >> A;
    sq.at(A) = 1;
  }
  
  int to0 = 0;
  int toN = 0;
  
  for (int i = 0; i <= X; i++) {
    if (sq.at(i) == 1)
      to0++;
  }
  
  for (int i = X; i <= N; i++) {
    if (sq.at(i) == 1)
      toN++;
  }
  
  cout << min(to0,toN) << endl;
}

Measured memory_bytes: 256
T = [0] * 5
N = int(input())
for i in range(5):
	t = int(input())
	T[i] = t

if N%min(T) == 0:
	rissoku = N//min(T)-1
else:
	rissoku = N//min(T)

ans = rissoku + 5
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define int long
int gcd(int m,int n){return n?gcd(n,m%n):m;}
int lcm(int m,int n){return m/gcd(m,n)*n;}
signed main(){
  int n,m,l,t=0;
  cin>>n>>m;
  vector<int> b(n);
  for(auto& i:b)cin>>i,i/=2;
  sort(b.begin(),b.end(),greater<>());
  l=b[0];
  while(l%2==0)++t,l/=2;
  for(int i=1;i<n;++i){
    int k=b[i],s=0;
    while(k%2==0)++s,k/=2;
    if(t!=s)return cout<<0,0;
  }
  l=b[0];
  for(int i=1;l<=m&&i<n;++i)l=lcm(l,b[i]);
  int res=(m/l+1)/2;
  cout<<res<<endl;
  cerr<<"L="<<l<<"\n";
}

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

int main() {
    int n;
    vector<int> a(26,0), b(26,0);
    string s, t;
    cin >> s >> t;
    n=s.size();
    bool flag=true;
    for(int i=0; i<n; i++) {
        a[(int)(s[i]-'a')]++;
        b[(int)(t[i]-'a')]++;
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    for(int i=0; i<26; i++) {
        if(a[i]!=b[i]) {
            flag=false;
            break;
        }
    }
    if(flag) cout << "Yes";
    else cout << "No";
}

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

using namespace std;

const int N=1e5+5;
typedef long long ll;
set<string> a;
int main()
{
    string s;
    cin >> s;
    int k;
    cin >> k;
    for(int i=0;s[i]!='\0';i++)
    {
        for(int j=0;s[j+i]!='\0'&&j<=5;j++)
        {
            string f(s,i,j+1);
            a.insert(f);
        }
    }
    set<string>::iterator it;
    it=a.begin();
    k--;
    while(k--) it++;
    cout << *it << endl;
}


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

int main()
{
    int ch[500000];
    char kh[1000000],arr[1000000];
    long long int a=0,b=0,c,d,e,i=0,j=0,k=0,l=0,tep,temp,m,n,x,y;

    scanf("%s%s",kh,arr);
    j=0;
    for(i=0;i<strlen(arr);i++)
     {
      if(kh[i]!=arr[i])
       j++;  
     }
     printf("%lld\n",j);
   

    return 0;
}

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

using namespace std;

int main(int argc, char * argv[])
{
	unsigned int n = 0;
	unsigned int a = 0;
	unsigned int b = 0;
	string s;

	while (cin >> n >> a >> b >> s) {
		unsigned int number_all = 0;
		unsigned int number_b = 0;
		for (unsigned int i = 0; i < s.size(); ++i) {
			if (s[i] == 'a') {
				if (number_all < (a + b)) {
					++number_all;
					cout << "Yes" << endl;
				}
				else {
					cout << "No" << endl;
				}
			}
			else if (s[i] == 'b') {
				if (number_all < (a + b) && number_b < b) {
					++number_all;
					++number_b;
					cout << "Yes" << endl;
				}
				else {
					cout << "No" << endl;
				}
			}
			else {
				cout << "No" << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1024
#include <vector>
#include <cstdio>
#include <iostream>

using namespace std;

typedef long long int li;
typedef vector<char> vc;


int main()
{
    int S, W;
    cin >> S >> W;
    if (W>=S)
        cout << "unsafe";
    else
        cout <<"safe";

    return 0;
}


Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

  public static void main(String[] args) {

    new Main().run();
  }
  public void run() {
    
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(in.readLine());
      String line = in.readLine();
      int[] ax = new int[n];
      long sum = 0;

      int m;
      int offset=0,next=0;
      char regex = ' ';
      boolean isContinue = true;
      for(int i=0; isContinue; i++) {
        if((next = line.indexOf(regex,offset)) == -1) {
          next = line.length();
          isContinue = false;
        }
        m = Integer.parseInt(line.substring(offset,next));
        ax[i] = m - (i+1);
        offset = ++next;
      }

      Arrays.parallelSort(ax);
      int b = ax[n/2];

      for (int i : ax) {
        sum += Math.abs(i-b);
      }

      System.out.println(sum);

    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
}

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

int main()
{
	int n {3}, a[n];
	for (int i=0; i!=n; ++i) std::cin >> a[i];
	std::sort(a, a+n);
	std::cout << a[0] << ' ' << a[1] << ' ' << a[2] << '\n';
}

Measured memory_bytes: 3052
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long 
#define int ll
//#define slld(t) scanf("%lld",&t)
// #define sd(t) scanf("%d",&t)
// #define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define pdd pair<double , double>
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N    105
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcountll
#define PI acos(-1)
#define s3   1.73205080757          // square root 3
const  int inf = (int)1e18+10 ;
const int MAX= 100;

 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ordered_set S;

int powmod(int x , int y){
	int res = 1;
	while(y > 0){
		if(y%2==1)
			res = (res*x)%mod;
		x = (x*x)%mod;
		y/=2;
	}
	return res;
}
int mul(int x , int y){
	return (x*y)%mod;
}



signed main(){
  fast;
  
 
	 int a , b , k;
	 cin >> a >> b >> k;
	 if(a - k >= 0)
	 	cout << a-k << " " << b << endl;
	 else  if(b + a - k >=0 )
	 	cout << 0 << " " <<  (b + a - k) << endl;
	 else
	 	cout << 0 << " " << 0 << endl;


 }

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

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)

using namespace std;

const int N = 300;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 31;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = atan2(0, -1);

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    //ll TL = 0.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    ll A, B;
    cin >> A >> B;
    if (abs(A - B) <= 1)
        cout << "Brown";
    else
        cout << "Alice";
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;

public class Main {
	
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastInput in = new FastInput(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		ABC177A solver = new ABC177A();
		solver.solve(1, in, out);
		out.close();
	}
	
	static class ABC177A {
	
		public void solve(int testNum, FastInput in, PrintWriter out) {
			
			int d = in.nextInt();
			int t = in.nextInt();
			int s = in.nextInt();
			
			if(s*t < d) {
				out.println("No");
			}
			else {
				out.println("Yes");
			}
	
		}
	
	}
	static class FastInput{
		private final BufferedReader in;
		private String[] buff;
		private int index = 0;
		
		public FastInput(InputStream is) {
			in = new BufferedReader(new InputStreamReader(is));
		}
		String nextLine() {
			try {
				return in.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return null;
		}
		String next() {
			while (buff == null || index >= buff.length) {
				buff = nextLine().split(" ");
				index = 0;
			}
			return buff[index++];
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		Double nextDouble() {
			return Double.parseDouble(next());
		}
		
		BigInteger nextBigInteger() {
			return new BigInteger(next());
		}
		
		BigDecimal nextBigDecimal() {
			return new BigDecimal(next());
		}
		
		public int[] nextIntArray(final int n) {
			final int[] res = new int [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextInt();
			}
			return res;
		}
		
		public long[] nextLongArray(final int n) {
			final long[] res= new long [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextLong();
			}
			return res;
		}
		
		public double[] nextDoubleArray(final int n ) {
			final double[] res = new double [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextDouble();
			}
			return res;
		}
		
		
		public int[][] nextInt2DArray(final int n , final int m){
			int [][]res = new int [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextInt();
				}
			}
			return res;
		}
		public long[][] nextLong2DArray(final int n , final int m){
			long [][]res = new long [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextLong();
				}
			}
			return res;
		}
		
		public char[][] nextChar2DArray(final int n){
			char [][]res = new char [n][];
			
			for(int i = 0 ; i < n ;i++) {
				String s = next();
				res[i] = s.toCharArray();
			}
			
			return res;
		}
	}

}


Measured memory_bytes: 32800
#include <iostream>

using namespace std;
int highest(int a,int b)
{
  if(b>a)
  {
    a=a+b;
  	b=a-b;
   	a=a-b;
  }
  if (b == 0) 
        return a; 
    return highest(b, a % b);  
    
}
int main()
{
  int a,b,k;
  cin>>a>>b>>k;
  int hcf=highest(a,b);
  int factors[hcf+1];
  int j=1;
  for(int i=hcf;i>0;i--)
  {
    if(hcf%i==0)
      factors[j++]=i;
  }
  cout<<factors[k];
}
  

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

//短縮
#define rep(i,n) for(int i=0;i<(n);++i)
//sort()用
#define all(v) v.begin(), v.end()

using namespace std;

int main(){
  string S;
  cin >> S;
  int count=0;
  int max=0;
  rep(i,S.size()){
    if(S.at(i)=='A'||S.at(i)=='C'||S.at(i)=='G'||S.at(i)=='T'){
      count++;
      if(max<count)max=count;
    }
    else{
      count=0;
    }
  }
  cout << max;
  return 0;
}


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

using namespace std;

void elem_swap(int& a, int& b) {
	int temp = a;
	a = b;
	b = temp;
}

inline bool isParent(int idx) { if (idx == 0) return false; else return true; }
inline bool isLeft_child(int size, int idx) { if ((idx + 1) * 2 > size) return false; else return true; }
inline bool isRight_child(int size, int idx) { if ((idx + 1) * 2 + 1 > size) return false; else return true; }

inline int get_nodekey(vector<int> & vec, int idx) { return vec.at(idx); }
inline int idx_parent(int node_num) { return node_num / 2 - 1; }
inline int get_parent(vector<int> & vec, int idx) { return vec.at(idx_parent(idx + 1)); }
inline int idx_left_child(int node_num) { return node_num * 2 - 1; }
inline int get_left_child(vector<int> & vec, int idx) { return vec.at(idx_left_child(idx + 1)); }
inline int idx_right_child(int node_num) { return node_num * 2; }
inline int get_right_child(vector<int> & vec, int idx) { return vec.at(idx_right_child(idx + 1)); }
//ヒープを操作する関数に入れる前にindexを変換する
inline int idxToheap(int index) { return index + 1; }
//実際の配列を操作するときにindexに変換
inline int heapToidx(int hnum) { return hnum - 1; }


void maxHeapify(vector<int> & vec, int idx) {
	if (isRight_child(vec.size(), idx)) {
		int left = vec.at(idx_left_child(idx + 1));
		int right = vec.at(idx_right_child(idx + 1));
		if (left <= vec.at(idx) && right <= vec.at(idx)) return;
		else if (left > vec.at(idx) && left > right) {
			elem_swap(vec.at(idx), vec.at(idx_left_child(idx + 1)));
			maxHeapify(vec, idx_left_child(idx + 1));
		}
		else {
			elem_swap(vec.at(idx), vec.at(idx_right_child(idx + 1)));
			maxHeapify(vec, idx_right_child(idx + 1));
		}
	}
	else if (isLeft_child(vec.size(), idx)) {
		if (vec.at(idx) < vec.at(idx_left_child(idx + 1))) elem_swap(vec.at(idx), vec.at(idx_left_child(idx + 1)));
	}
	else return;

}

void buildMaxHeap(vector<int> & vec) {
	for (int i = vec.size() / 2-1; i >= 0; i=(i+1)/2-1) {
		maxHeapify(vec, i);
		if (i == 0) break;
	}
	return;
}

void build_afterpop(vector<int> & vec) {
	maxHeapify(vec, 0);
}

int popMaxheap(vector<int> & vec) {
	if (vec.size() == 0) return -1;
	int pop = vec.at(0);
	vec.at(0) = vec.at(vec.size() - 1);
	vec.pop_back();
	build_afterpop(vec);
	return pop;
}

int main(void) {

	int temp;
	string cmd;
	vector<int> vec;
	while (true) {
		cin >> cmd;
		if (cmd == "insert") {
			cin >> temp;
			vec.push_back(temp);
			buildMaxHeap(vec);
		}
		else if (cmd == "extract") cout << popMaxheap(vec) << endl;
		else if (cmd == "end") break;
	}
	return 0;
}



Measured memory_bytes: 7020
#include <stdio.h>

int main(void)
{
  int n, sum, i, j;
  scanf("%d", &n);
  int dn = n / 7, flag = 0;
  for(i = 0; i <= dn; ++i) {
    if( (n - i*7)% 4 == 0) { flag = 1; break; }
  }
  
  if(flag == 1) { printf("Yes\n"); } else { printf("No\n"); }
    
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#define MAX 0x7FFFFFFF
using namespace std;

int main()
{
    int n,i,t=MAX,x,a=0;
    int s=-MAX,y=0,flag=0;
    cin >> n;
    for(i=0 ; i<n ; i++)
    {
        cin >> x;
        if(x==t) flag=1;
        if(x-t>s && x-t<0) s = x-t;
        if(x<t) t = x;
        if(x-t>a && x-t>0) a = x-t;
    }
    if( a || flag)
    cout << a << endl;
    else
        cout << s << endl;
    return 0;
}



Measured memory_bytes: 3096
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    string A, B;
    for(int i=0; i<b; i++) {
        A += to_string(a);
    }
    for(int i=0; i<a; i++) {
        B += to_string(b);
    }
    
    if(A<B) {
        cout << A << endl;
    } else {
        cout << B << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <cstdio>
using namespace std;
char a[51][51];
int x,y;
int main()
{
	cin>>x>>y;
	for (int i=0;i<x;i++)
	{
		for (int j=0;j<y;j++)
		{
			cin>>a[i][j];
		}
	}
   	bool f=true;
	for (int i=0;i<x;i++)
	{
		for (int j=0;j<y;j++)
		{
			if (a[i][j]=='#')
			{
				if (a[i-1][j]=='#' || a[i][j+1]=='#' || a[i+1][j]=='#' || a[i][j-1]=='#')
					continue;
				else
				{
					f=false;
					break;
				}
			}
		}
	}
	if (f) cout<<"Yes";
	else cout<<"No";
    return 0;
}

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

typedef long long int ll;

const int mod = 1000000007;
//const int mod = 998244353;
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, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


ll sum (int l, int r){
	return (l+r)*(r-l+1)/2;
}


int n,x,y;

int dist(int i,int j){
	int tmp = j-i;
	int tmp2 = abs(x-i) + 1 + abs(y-j);
	int tmp3 = abs(y-i) + 1 + abs(x-j);
	//cout <<" "<< tmp << " " << tmp2 << " " << tmp3 <<endl;
	return min(min(tmp,tmp2),tmp3);
}

int main(){
	cin >> n >> x >> y;
	
	vector<int> anses(n-1,0);
	for(int i=1;i<=n;++i){
		for(int j=i+1;j<=n;++j){
			int d = dist(i,j);
			//cout << i+1 << " " << j+1 << " " << d << endl;
			d--;
			anses[d]++;
		}
	}
	
	for(int i=0;i<anses.size();++i){
		cout << anses[i] << endl;
	}
	
	return 0;
}


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

using namespace std;

const int SIZE = 1e5 + 10;

vector<pair<int, int>> adj[SIZE];
vector<int> color(SIZE);

void bfs(int s) {
	vector<bool> vis(SIZE);
	queue<int> q;
	q.push(s);
	vis[s] = true;

	while(!q.empty()) {
		s = q.front();
		q.pop();
		for(auto i : adj[s]) {
			if(!vis[i.first]) {
				if(i.second & 1) color[i.first] = 1 - color[s];
				else color[i.first] = color[s];
				vis[i.first] = true;
				q.push(i.first);
			}
		}
	}
}

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

	int n;
	cin >> n;

	int u, v, w;
	for(int i = 1; i < n; i++) {
		cin >> u >> v >> w;
		adj[u].push_back({v, w});
		adj[v].push_back({u, w});
	}

	bfs(1);

	for(int i = 1; i <= n; i++) {
		cout << color[i] << '\n';
	}

	return 0;
}

Measured memory_bytes: 6912
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll bigmod(ll a,ll p,ll m)
{
    if(p==0)
        return 1%m;
    if(p%2!=0)
    {
        return (a*(bigmod(a,p-1,m)))%m;
    }
    else
    {
        ll x=(bigmod(a,p/2,m))%m;
        return (x*x)%m;
    }
}
int main()
{
    string a,b;
    cin>>a>>b;
    int res=0;
    for(int i=0;i<a.size();i++)
    {
        if(a[i]!=b[i]) res++;
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3912
#include<bits/stdc++.h>
using namespace std;
bool comp(pair<long long int,long long int>a,pair<long long int,long long int>b)
{
    if(a.first==b.first)
    {
        if(a.second<=b.second)
        return true;
        else
        return false;
    }
    if(a.first>b.first)
    return true;
    else return false;
}
long long int gcd(long long int bdda,long long int chota)
{
    if(chota==0)
        return bdda;
    return gcd(chota,bdda%chota);
}
void solve()
{
    int a,b;
    cin>>a>>b;
    string s;
    cin>>s;
    if(s[a]!='-')
    {
        cout<<"No";return;
    }
    for(int i=0;i<a+b+1;i++)
    {   
        if(i!=a && s[i]=='-')
        {
            cout<<"No";return;
        }
    }
    cout<<"Yes";
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;    
    t=1;

    //cin>>t;
    while(t--)
    {
        solve();
    }
}


Measured memory_bytes: 3536
from collections import deque
n = int(input())
A = list(map(int,input().split()))
l = deque()
for i in range(len(A)):
  if n % 2 == 0:
    if i % 2 == 0:
      l.append(A[i])
    else:
      l.appendleft(A[i])
  else:
    if i % 2 == 0:
      l.appendleft(A[i])
    else:
      l.append(A[i])
print(*l)

Measured memory_bytes: 25532
#include <cstdio>
#include <cstring>

const int N = 1e5 + 100;
const int M = N << 1;
int n, h[N], to[M], nx[M], e;

int grundy(int u, int f = -1) {
	int r = 0;
	for (int i = h[u]; i != -1; i = nx[i]) {
		if (to[i] != f) {
			r ^= 1 + grundy(to[i], u);
		}
	}
	return r;
}

int main() {
	e = 0;
	memset(h, -1, sizeof h);
	scanf("%d", &n);
	for (int i = 1; i < n; ++i) {
		int u, v;
		scanf("%d%d", &u, &v);
		to[e] = v, nx[e] = h[u], h[u] = e++;
		to[e] = u, nx[e] = h[v], h[v] = e++;
	}
	int t = grundy(1);
	if (t == 0) {
		puts("Bob");
	} else puts("Alice");
	return 0;
}

Measured memory_bytes: 6784
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int> data(N);
  int a, count = 0;
  for(int i = 0; i < N; i++) {
    cin >> a;
    if (N < a) count++;
    else data.at(a - 1)++;
  }
  for(int i = 0; i < N; i++) {
    if(data.at(i) < i + 1) count += data.at(i);
    else if (data.at(i) > i + 1) count += data.at(i) - i - 1;
  }
  cout << count << endl;
  return 0;
}

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

using namespace std;

int main(){

	long long int s, sqs, rem, xy, x2,y1;

	cin>> s;
	sqs=sqrt(s);
	if(sqs!=sqrt(s)) sqs++;

	rem=sqs*sqs-s;

	for(long long int i=1;i<1000000;i++){
		if(rem/i>1000000000) continue;
		if(rem%i==0){
			x2=i;
			y1=rem/i;
			break;
		}
	}

	cout<< "0" << " " << "0" << " " << sqs << " " << x2 << " " << y1 << " " << sqs <<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

int main() {
	int N, M; cin >> N;
	VS s(N); rep(i, 0, N) cin >> s[i];
	cin >> M;
	VS t(M); rep(i,0, M) cin >> t[i];

	int maxi = 0;
	for (string w : s) {
		int counter = 0;
		for (string x : s){
			if (w == x) ++counter;
		}
		for (string x : t) {
			if (w == x) --counter;
		}
		maxi = max(maxi, counter);
	}
	cout << maxi << "\n";
	


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <queue>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstring>
#include <cstdio>

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

int main(void){
  int n, l;

  cin >> n >> l;

  vector<string> s(n);

  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }

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

  for (int i = 0; i < n; i++) {
    cout << s[i];
  }

  cout << endl;

  return 0;
}

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

void solve() {
    ll S;
    cin >> S;
    ll m = 1e9;
    ll x1,y1,x2,y2,x3=0,y3=0;
    if ( S <= m ) {
        x1 = S;
        y2 = 1;
        x2 = y1 = 0;
    } else if ( S == (ll)1e18 ) {
        x1 = y2 = m;
        x2 = y1 = 0;
    } else {
        x1 = m;
        y2 = S / m + 1;
        x2 = x1 * y2 - S;
        y1 = 1;
    }
    cout << x3 << " " <<  y3 << " " << x1 << " " << y1 << " " << x2 << " " << y2 << "\n";
}

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

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

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

    long long ans, min, max;
    min = A * (N - 1) + B;
    max = A + (N - 1) * B;
    ans = max - min + 1;
    if(N == 1 && A != B) ans = 0;
    if(A > B) ans = 0;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

#define YES(n) cout << (n?"YES":"NO")<<endl;
#define Yes(n) cout << (n?"Yes":"No")<<endl;

int main() {
    char X, Y;
    cin >> X >> Y;
    if (X < Y)cout << '<' << endl;
    else if (X > Y)cout << '>' << endl;
    else cout << '=' << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<fstream>
#include<vector>
#include<algorithm>
using namespace std;

int base_n_dsum(int num, int n)
{
    int ans =0;
    int temp =num;
    while(temp !=0)
    {
        ans += temp %n;
        temp = temp /n;
    }
    return ans;
}

int mpow(int e, int b)
{
    int ans =1;
    for(int i=0; i<e; i++) ans*=b;
    return ans;
}

int main()
{
    int n;
    cin>>n;
    int min=n;
    int temp;
    for(int i=0; i<=n; i++)
    {
        temp= base_n_dsum(i,6) + base_n_dsum(n-i,9);
        if(temp<min) min=temp;
    }
    
    cout<<min<<endl;
    
	return 0;
}


Measured memory_bytes: 256
nm = [int(i) for i in input().split()]

tmp = [int(i) for i in input().split()]
tmp2 = tmp[1:]
list = set(tmp2)
for i in range(1,nm[0]):
  tmp = [int(i) for i in input().split()]
  tmp2 = tmp[1:]
  list = set(tmp2) & list 
print(len(list))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 29
#define MOD 1000000007
#define Yes(f) puts((f)? "Yes" : "No")
#define YES(f) puts((f)? "YES" : "NO")
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
using Graph = vector<vector<int>>;

int main(){
	int n, m; cin >> n >> m;
	int a;
	multiset<ll> s;
	rep(i, n) {
		cin >> a;
		s.insert(a);
	}

	rep(i, m){
		auto itr = s.end();
		itr--;
		int b = *itr;
		s.erase(itr);
		s.insert(b / 2);
	}
	ll ans = 0;
	for(auto itr = s.begin(); itr != s.end(); itr++){
		ans += *itr;
	}
	cout << ans << endl;
}

Measured memory_bytes: 4992
def solve():
    seq1 = raw_input()
    seq2 = raw_input()
  
    a, b = len(seq1), len(seq2)
    x1 = [0 for i in range(b+1)]
    for i in range(a):
        e1 = seq1[i]
        x2 = x1+[]
        for j in range(b):
            if e1 == seq2[j]:
                x1[j+1] = x2[j] + 1
            elif x1[j+1] < x1[j]:
                x1[j+1] = x1[j]
    return x1[-1]
  
n = input()
for i2 in range(n):
    print solve()

Measured memory_bytes: 6460
n = int(input())
a = list(map(int,input().split()))
b = [abs(i) for i in a]
b.sort()
f = 0
for i in a:
     if i<0:
          f = (f+1)%2
if f == 0:
     print(sum(b))
else:
     print(sum(b)-2*b[0])

Measured memory_bytes: 15020