akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int L = sc.nextInt();
        DJSet road = new DJSet(N+1);
        DJSet rail = new DJSet(N+1);
        for (int i = 0; i < K; i++) {
            int p = sc.nextInt();
            int q = sc.nextInt();
            road.union(p, q);
        }
        for (int i = 0; i < L; i++) {
            int r = sc.nextInt();
            int s = sc.nextInt();
            rail.union(r, s);
        }
        HashMap<Long, Integer> map = new HashMap<Long, Integer>();
        long[] keys = new long[N+1];
        for (int i = 1; i <= N; i++) {
            long key = (long)road.root(i) * (N+1) + rail.root(i);
            keys[i] = key;
            if(map.containsKey(key)) map.replace(key, map.get(key) + 1);
            else map.put(key, 1);
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 1; i <= N; i++) {
            sb.append(map.get(keys[i]));
            if(i < N) sb.append(" ");
        }

        System.out.println(sb.toString());
        sc.close();
    }

}

class DJSet {
    /**
     * 各要素の親を保持する配列。
     * 自信が根である要素は負の数を持つ。
     * （負の数の場合、絶対値がその集合の要素数）
     */
    public int[] upper;

    /**
     * コンストラクタ。
     * @param n 対象となる要素数
     */
    public DJSet(int n){
        upper = new int[n];
        Arrays.fill(upper, -1);
    }

    /**
     * 要素xが含まれる集合のrootを求める。
     * rootを求める過程で経路圧縮しrootが親になるようにする。
     * @param x 要素x
     * @return 要素xが含まれる集合のroot
     */
    public int root(int x){
        return upper[x] < 0 ? x : (upper[x] = root(upper[x]));
    }

    /**
     * 要素xと要素yが同じ集合か判定する。
     * @param x 要素x
     * @param y 要素y
     * @return 要素xと要素yが同じ集合であればtrue、そうでなければfalseを返す。
     */
    public boolean same(int x, int y){
        return root(x) == root(y);
    }

    /**
     * 要素xと要素yを含むそれぞれの集合を合併する。
     * 要素数の多い集合のrootを残し、少ないほうのrootをその下に合併する。
     * @param x 要素x
     * @param y 要素y
     * @return 要素xと要素yを含むそれぞれの集合を合併できたらtrue、もともと同じ集合で合併しなかったらfalseを返す。
     */
    public boolean union(int x, int y){
        x = root(x);
        y = root(y);
        if(x != y){
            if(upper[y] < upper[x]){
                int t = x;
                x = y;
                y = t;
            }
            upper[x] += upper[y];
            upper[y] = x;
        }
        return x != y;
    }

    /**
     * 集合の数を数える。
     * @return 集合の数
     */
    public int countSet(){
        int c = 0;
        for(int u :upper){
            if(u < 0) c++;
        }
        return c;
    }

    /**
     * 要素ｘが含まれる集合の要素数を数える。
     * @param x 要素ｘ
     * @return 要素ｘが含まれる集合の要素数
     */
    public int countElement(int x){
        return root(x) * -1;
    }
}


Measured memory_bytes: 116736
//00
#include<iostream>

using namespace std;

int main(){
  static bool cmp[1000001]={true,true};
  for(int i=2;i<1000001;i++){
    if(!cmp[i]){
      for(int j=2;i*j<1000001;j++){
	cmp[i*j]=true;
      }
    }
  }
  for(int n;cin>>n,n;){
    int ans=0;
    for(int i=0;i+i<=n;i++){
      ans+=!cmp[i]&&!cmp[n-i];
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
// #include <stdio.h>
#include <iostream>

using namespace std;

// int hug = 0;
void print(string s){
    cout << s << " " << s.length() << "\n";
}
int palindrome(string s){
    
    const int len = s.length();
    if(len <= 1){
        return 0;
    }else{
        string s_;
        for (int i = 1; i < len - 1; i++){
            s_ += s[i];
        }
        
        // print(s);
        // print(s_);
        

        if(s[0] != s[len - 1]){      
            return palindrome(s_) + 1;
        
        }else{
            return palindrome(s_);
        }
    }
    
}
int main(){
    string s;
    cin >> s;
    int hug = palindrome(s);
    cout << hug << "\n";
}

Measured memory_bytes: 256
s=input()

sl=list(s)

kisu=["R","U","D"]
gusu=["L","U","D"]
flag=True

for i in range(1,len(sl)+1):
  st=sl[i-1]
  if i % 2 ==0 :
    if not st in gusu :
      flag=False
      break
  else :
    if not st in kisu :
      flag=False
      break
if flag :
  print("Yes")
else :
  print("No")

Measured memory_bytes: 3064
A,B,C,D = map(int, input().split())
t_ta=0
t_aa=0

tatk = C//B
tss = C % B

aatk = A//D
ass = A % D

if tss == 0:
    t_ta = tatk
else: 
    t_ta = tatk+1
    
if ass ==0:
    t_aa = aatk
else:
    t_aa = aatk+1
    
if t_ta -t_aa >0:
    print("No")
else:
    print("Yes")

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

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  string A, B, C;
  cin >> A >> B >> C;
  if(A.back() == B.front() && B.back() == C.front()){
	cout << "YES" << endl;
  }else{
	cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 764
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt();
        int t = sc.nextInt();
        int s = sc.nextInt();
        if(d <= t * s) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 35644
#include<iostream>
#include<algorithm>
using namespace std;
#define MAX 101

int main() {
	int N, alice=0, bob=0;
	int a[MAX];
	cin >> N;

	int aid = N-1, bid = N-2;
	for (int i = 0; i < N; i++) cin >> a[i];
	sort(a, a + N);

	if (N % 2 == 1) alice += a[0];

	while (aid>=0 && bid>=0) {
		alice += a[aid];
		bob += a[bid];
		aid -= 2;
		bid -= 2;
	}

	cout << alice - bob << endl;

	return 0;
}

Measured memory_bytes: 256
/*     ####   ####  #               ####  #        ##   #    # #    # ###### #####
      #      #    # #              #      #       #  #  ##  ## ##  ## #      #    #
       ####  #    # #               ####  #      #    # # ## # # ## # #####  #    #
           # #  # # #                   # #      ###### #    # #    # #      #####
      #    # #   #  #              #    # #      #    # #    # #    # #      #   #
       ####   ### # ###### #######  ####  ###### #    # #    # #    # ###### #    #
*/
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef vector<long long> VLL;
typedef vector<string> VS;
typedef vector<pair<LL, LL> > VP;
 
 
#define For(in) for (LLi i = 0; i < (n); i++)
#define FOR(in) for(LLi i=1; i <= (n); i++)
#define pb push_back
#define sr(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define uniq(v) v.erase(unique(v.begin(), v.end()), v.end());
#define exit(); return 0;
#define no "NO"
#define yes "YES"
#define con continue;
 

 
 
int main()
{
	
	long long a,b,c,d;
	cin>>a;
	string s;
	cin>>s;
	long long x=0, m=0;
	for(int i=0; i<s.size(); i++)
	{
		if(s[i]=='I')x++;
		else --x;
		
		m = max(m, x);
	}
	cout<<m<<endl;
		
			
	
			
    exit()
 
 
}


Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <list>
#include <deque>
using namespace std;
typedef pair<int, int> P;

#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;
int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    
    int n; cin >> n;
    for(int i=0; i<(1<<n); ++i){
        
        vector<int> S;
        for(int j=0; j<n; ++j){
            if(i & (1<<j)){
                S.push_back(j);
            }
        }
        
        cout << i << ":";
        for(int j=0; j<S.size(); ++j){
            cout << " " << S[j];
        }
        cout << endl;
    }
	return 0;
}


Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
 ll n,k,ans;
 cin>>n>>k;
 if(n>k){
  ans=min((n%k),(k-(n%k)));
 }
 else{
  while(abs(n-k)<n){
   n=abs(n-k);
  }
  ans=n;
 }
 cout<<ans;
}

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int dig(int n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  int ans = 0;
  for(int i=1;i<=n;++i) {
    ans += dig(i) % 2;
  }
  cout << ans << endl;
}


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

using namespace std;

template <class T> using V = vector<T>;

const int INF = 2e9;
const int MN = 233;
int h, w;
struct E {
    int to, rev, cap;
    E(int _to, int _rev, int _cap) : to(_to), rev(_rev), cap(_cap) {}
};
V<E> g[MN];
int level[MN], iter[MN];
int n, sv, tv;

void add_edge(int a, int b, int c) {
    g[a].push_back(E(b, int(g[b].size()), c));
    g[b].push_back(E(a, int(g[a].size())-1, 0));
//    cerr << "(" << a << ", " << b << ", " << c << ")\n";
}

int dfs(int v, int f) {
    if (v == tv) return f;
    for (int &i = iter[v]; i < int(g[v].size()); i++) {
        E &e = g[v][i];
        if (!e.cap || level[e.to] <= level[v]) continue;
        int d = dfs(e.to, min(f, e.cap));
        if (!d) continue;
        e.cap -= d;
        g[e.to][e.rev].cap += d;
        return d;
    }
    return 0;
}

int exec() {
    int flow = 0;
    while (true) {
        queue<int> que;
        que.push(sv);
        fill(level, level + n, -1);
        level[sv] = 0;
        while (!que.empty()) {
            int v = que.front();
            que.pop();
            for (int i = 0; i < int(g[v].size()); i++) {
                E &e = g[v][i];
                if (!e.cap || level[e.to] != -1) continue;
                level[e.to] = level[v] + 1;
                que.push(e.to);
            }
        }
        if (level[tv] == -1) break;
        fill(iter, iter + n, 0);
        while (true) {
            int d = dfs(sv, INF);
            if (!d) break;
            flow += d;
        }
    }
    return flow;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> h >> w;
    n = h + w + 2;
    sv = n - 2;
    tv = n - 1;
    int si = -1, sj = -1, ti = -1, tj = -1;

    for (int i = 0; i < h; i++) {
        string mp;
        cin >> mp;
        assert(w == int(mp.size()));
        for (int j = 0; j < w; j++) {
            if (mp[j] == 'S') {
                add_edge(sv, i, INF);
                add_edge(sv, j+h, INF);
                si = i; sj = j;
            } else if (mp[j] == 'T') {
                add_edge(i, tv, INF);
                add_edge(j+h, tv, INF);
                ti = i; tj = j;
            } else if (mp[j] == 'o') {
                add_edge(i, j+h, 1);
                add_edge(j+h, i, 1);
            }
        }
    }
    assert(si >= 0 && sj >= 0 && ti >= 0 && tj >= 0);
    if (si == ti || sj == tj) cout << "-1\n";
    else cout << exec() << endl;
    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <cassert>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> p(N+1);
    for(int i=1; i<=N; i++) cin >> p[i];
    int cnt = 0;
    for(int i=1; i<=N; i++)
        if(p[i] != i)
            cnt++;
    cout << (cnt <= 2 ? "YES" : "NO") << endl;
    return 0;
}

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

typedef  long long int ll;
typedef  vector<int> vi;
#define  fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define  pb push_back
#define  fn for(int i=0;i<n;i++)
#define  rep(i,a,b) for(ll i=a;i<b;i++)
#define  all(x) x.begin(), x.end()
#define  endl "\n"

void solve()
{
	string s = "ACL";
	int n;
	cin>> n;
	fn cout << s;
}

int main()
{
   	fast
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    //int t; cin>>t; while(t--)
    solve();
}

Measured memory_bytes: 3496
#include <queue>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int N, Q;
string S;
int l[100010], r[100010];

int a[100010];

int main()
{
	cin >> N >> Q;
	cin >> S;
	for (int i = 0; i < Q; i++)
	{
		cin >> l[i] >> r[i];
	}
	int k = 0;
	a[0] = k;

	for (int i = 1; i < N; i++)
	{
		if (S[i - 1] == 'A' && S[i] == 'C')
		{
			k++;
		}
		a[i] = k;
	}
	//部分和でた
	for (int i = 0; i < Q; i++)
	{
		int ans = a[r[i] - 1] - a[l[i] - 1];
		cout << ans << endl;
	}
}

Measured memory_bytes: 2176
N = int(input())
 
reds = []
for _ in range(N):
    reds.append(tuple(map(int, input().split())))
    
blues = []
for _ in range(N):
    blues.append(tuple(map(int, input().split())))

reds.sort()
blues.sort()
 
ans = 0
for blue in blues:
    c, d = blue
 
    # 条件に当てはまる赤を抽出
    targets = [red for red in reds if red[0] < c and red[1] < d]
    targets.sort(key=lambda x:x[1])
 
    # 赤のうち一番y座標が大きいものを抽出
    if targets:
        target = targets.pop()
        reds.remove(target)
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<queue>
#include<vector>
#include<map>
#include<set>
using namespace std;
const int MAX = 5005;

#define ll long long
set<string> a;
string s;
int main(){
	cin>>s;
	int k;
	cin>>k;
	int len = s.length();
	for(int i=0;i<len;i++){
		for(int j = 1;j + i <= len && j <= 5;j++){
			a.insert(s.substr(i,j));
		}
	}
	set<string>::iterator p = a.begin();
	for(int i=1;i<k;i++) p++;
	cout<<*p<<endl;
	return 0;
}


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

int main(){
    int A[3];
    cin >> A[0] >> A[1] >> A[2];
    long long cnt = 0;
    if(A[0] == A[1] and A[1] == A[2]){
        cout << 0 << endl;
    }else{
        sort(A, A + 3);
        if(A[0] % 2 and A[1] % 2 and A[2] % 2){
            cnt += (A[2] - A[1]) / 2;
            cnt += (A[2] - A[0]) / 2;
        }else if(!(A[0] % 2) and !(A[1] % 2) and !(A[2] % 2)){
            cnt += (A[2] - A[1]) / 2;
            cnt += (A[2] - A[0]) / 2;
        }else if(A[0] % 2 and !(A[1] % 2) and A[2] % 2){
            cnt += 1;
            A[0]++;
            A[2]++;
            cnt += (A[2] - A[1]) / 2;
            cnt += (A[2] - A[0]) / 2;
        }else if(!(A[0] % 2) and A[1] % 2 and A[2] % 2){
            cnt += 1;
            A[1]++;
            A[2]++;
            cnt += (A[2] - A[1]) / 2;
            cnt += (A[2] - A[0]) / 2;
        }else if(A[0] % 2 and A[1] % 2 and !(A[2] % 2)){
            cnt += 1;
            A[0]++;
            A[1]++;
            cnt += (A[2] - A[1]) / 2;
            cnt += (A[2] - A[0]) / 2;
        }else if(!(A[0] % 2) and !(A[1] % 2) and A[2] % 2){
            cnt += 1;
            A[0]++;
            A[1]++;
            cnt += (A[2] - A[1]) / 2;
            cnt += (A[2] - A[0]) / 2;
        }else if(!(A[0] % 2) and A[1] % 2 and !(A[2] % 2)){
            cnt += 1;
            A[0]++;
            A[2]++;
            cnt += (A[2] - A[1]) / 2;
            cnt += (A[2] - A[0]) / 2;
        }else if(A[0] % 2 and !(A[1] % 2) and !(A[2] % 2)){
            cnt += 1;
            A[1]++;
            A[2]++;
            cnt += (A[2] - A[1]) / 2;
            cnt += (A[2] - A[0]) / 2;
        }
        cout << cnt << endl;
    }


    return 0;
}

Measured memory_bytes: 256
diff = 1000
total = 0

for i in range(5) :
    time = int(input())
    if time % 10 > 0 :
        diff = min(diff,time % 10)
    total += int((time + 9) / 10) * 10

if diff == 1000 :
    print(total)
else :
    print(total - 10 + diff)

Measured memory_bytes: 2940
N = int(input())
strings = []
for i in range(N):
    strings.append(input())


strings = [''.join(sorted(s)) for s in strings]
strings.sort()


hashMap = {}
for string in strings:
    if string not in hashMap:
        hashMap[str(string)] = 1
    else:
        hashMap[str(string)] += 1


sum = 0

for key in hashMap:
    v = hashMap[key]
    sum += v * (v - 1) / 2
print(int(sum))

Measured memory_bytes: 19852
package main

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

func main() {
	S := nextString()

	if S == "Sunny" {
		fmt.Println("Cloudy")
	} else if S == "Cloudy" {
		fmt.Println("Rainy")
	} else {
		fmt.Println("Sunny")
	}
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}


Measured memory_bytes: 640
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//参考http://hadrori.hateblo.jp/entry/aoj0037 
const int dx[] ={-1,0,1,0};
const int dy[] ={0,-1,0,1};
int path[16][16][4];//0:L,1:U,2:R,3:D
int main()
{
  char c;
  for(int i = 0;i <9;i++){
    if(i%2){
      for(int j = 0;j < 5;j++){
	cin >>c;
	if(c =='1'){
	  path[i/2][j][3] = 1;
	  path[i/2+1][j][1] = 1;
	}
      }
    }else{
      for(int j = 0;j < 4;j++){
	cin >>c;
	if(c =='1'){
	  path[i/2][j][2] = 1;
	  path[i/2][j+1][0] = 1;
	}
      }
    }
  }
  int x = 0,y = 0,d = 2;
  /*
(前の方向：右 の場合)
進む方向の優先順位は、上、右、下、左となる。

(前の方向：左 の場合)
進む方向の優先順位は、下、左、上、右となる。

(前の方向：上 の場合)
進む方向の優先順位は、左、上、右、下となる。

(前の方向：下 の場合)
  進む方向の優先順位は、右、下、左、上となる。*/
  string dir ="LURD";
  do{
    for(int i = 0;i < 4;i++){
      int dd =(d+i+3)%4;
      if(path[y][x][dd]==1){
	path[y][x][dd] -=1;
	x +=dx[dd];
	y +=dy[dd];
	d = dd;
	cout <<dir[dd];
	break;
      }
    }
  }while(x||y);
  cout <<endl;
 
  return 0;
}

Measured memory_bytes: 1180
list = 1000000 *[1]

list[0] = 0
list[1] = 0

for i in range(1,1000000):
    if list[i] == 1:
        for j in range(i*i,1000000,i):
            list[j] = 0

for i in range(2,1000000):
    list[i] += list[i-1]

while True:
    try:
        n = int(input())
        print int(list[n])
    except EOFError:
        break

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

int main() {
  string n;
  cin >> n;
  string ans = (
    (n[0] == n[1] && n[1] == n[2]) ||
    (n[1] == n[2] && n[2] == n[3])
  ) ? "Yes" : "No";
  cout << ans << endl;
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> p(n),q(n);
  rep(i,0,n) cin >> p[i];
  rep(i,0,n) cin >> q[i];
  vector<int> array(n,0);
  rep(i,0,n) array[i] = i+1;
  int cnt = 0;
  int a,b;
  do {
    if (array == p) a = cnt;
    if (array == q) b = cnt;
    cnt++;
  } while (next_permutation(array.begin(), array.end()));
  cout << abs(a - b) << endl;
  return 0;
}


Measured memory_bytes: 3600
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

int main(void)
{
	int x, a;
	cin >> x >> a;
	if (x < a) { cout << 0 << endl; }
	else { cout << 10 << endl; }
	return 0;
}


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

int main(){
  int N,a[100050];
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  int k=0;
  for(int j=0;j<100010;j++){
    k = a[k]-1;
    if(k==1){
      cout<<j+1<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
  return 0;
}


Measured memory_bytes: 640
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int cnt[] = new int[n] ;
		long ans = 1;
		for(int i = 0; i < n; i++)cnt[i] = 0; 
		int work;
		for(int i = 0; i < n; i++) {
			work = sc.nextInt();
			cnt[work]++; 
		}
		boolean key = true;
		int idx = 2;
		if(n % 2 == 0)idx--;
		while(idx < n) {
			if(cnt[idx] != 2) {
				key = false;
				break;
			}
			idx += 2;
		}
		if(key) {
			for(int i = 0; i < n / 2; i++) {
				ans = ans *  2 % 1000000007;
			}
		}
		else ans = 0;
		System.out.println(ans);
	}
}


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;

    if(e-a > k) cout << ":(" << endl;
    else cout << "Yay!" << endl;    

    return 0;
}


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

int main() {
  int a,b,c,d,e;
  int k;
  cin >> a >> b >> c >> d >> e;
  cin >> k;

  string ans;
  if ((e-a) <= k) ans = "Yay!";
  else ans = ":(";

  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	static Scanner sc = new Scanner(System.in);
	static int num = 0;
	static String[] str;

	public static void main(String[] args) {
		read();
		solve();
	}

	public static void read(){
		num = sc.nextInt();
		str = new String[num];
		sc.nextLine();

		for(int i=0; i<num; i++){
			str[i] = sc.nextLine();
		}
	}


	public static void solve(){

		for(int i=0; i<num; i++){
			System.out.println(str[i].replaceAll("Hoshino", "Hoshina"));
		}
	}

}

Measured memory_bytes: 0
function Main(input) {
    input = input.trim().split("\n");
    tmp = input[0].split(" ");
    var N = parseInt(tmp[0],10);
    var M = parseInt(tmp[1],10);
    var a = [];
    var isFirstBreak = false;
    var isSecondBreak = false;
    for(var i = 0; i < M; i++){
        a[i] = parseInt(input[i+1],10);
        if(a[i] == 1){
            isFirstBreak = true;
        }
        else if(a[i] == 2){
            isSecondBreak = true;
        }
    }
    var step = [];
    var j = 0;
    if(isFirstBreak){
        step[0] = 0;
        j++;
    }
    else{
        step[0] = 1;
    }
    if(isSecondBreak){
        step[1] = 0;
        j++;
    }
    else{
        step[1] = 1 + step[0];
    }
    for(var i = 2; i < N; i++){
        var isBreak = false;
        if(a[j] == i+1){
            if(j < M-1){
                j++;
            }
            isBreak = true;
        }
        if(isBreak){
            step[i] = 0;
        }
        else{
            step[i] = (step[i-1] + step[i-2])%1000000007;
        }
    }
    var output = step[N-1];
    console.log(output);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 27096
#include <stdio.h>

int main(void)
{
        int a, b, c, n[100]={}, k, i, j=0;

        scanf("%d%d%d", &a, &b, &k);
        if(a<b) c=b;
        else c=a;
        for(i=c;i>0;i--)
                if((a%i==0)&&(b%i==0)) {
                        n[j] = i;
                        j++;
        }
        printf("%d\n",n[k-1]);
        return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<int, int> pi;
const int MAXN = 100005;

int cnt[122];

int solve(){
	int ans = 1e9;
	for(int i=0; i<24; i++){
		for(int j=0; j<i; j++){
			if(cnt[i] && cnt[j]) ans = min({ans, 24 - i + j, i - j});
		}
	}
	ans = min(ans, 24 - ans);
	return ans;
}

int main(){
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		int x;
		cin >> x;
		cnt[x]++;
	}
	cnt[0]++;
	for(int i=1; i<12; i++){
		if(cnt[i] == 2){
			cnt[24-i] = 1;
			cnt[i] = 1;
		}
	}
	for(int i=0; i<=12; i++){
		if(cnt[i] >= 2){
			cout << 0 << endl;
			return 0;
		}
	}
	vector<int> v;
	for(int i=1; i<12; i++){
		if(cnt[i] && !cnt[24-i]){
			v.push_back(i);
		}
	}
	int ans = 0;
	for(int i=0; i<(1<<v.size()); i++){
		for(int j=0; j<v.size(); j++){
			if((i >> j) & 1) swap(cnt[v[j]], cnt[24-v[j]]);
		}
		ans = max(ans, solve());
		for(int j=0; j<v.size(); j++){
			if((i >> j) & 1) swap(cnt[v[j]], cnt[24-v[j]]);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
// C - 100 to 105
#include <bits/stdc++.h>
using namespace std;

int main(){
	int X; cin>>X;
	if(X>=2000) puts("1");
	else{
		for(int a=0; a<=100*19; a+=100)
		for(int b=0; b<=101*19; b+=101)
		for(int c=0; c<=102*19; c+=102)
		for(int d=0; d<=103*19; d+=103)
		for(int e=0; e<=104*19; e+=104)
		for(int f=0; f<=105*19; f+=105)
			if(X==a+b+c+d+e+f){ puts("1"); return 0; }
		puts("0");
	}
}

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

int main() {
  while (true) {
    int t, d, l;
    cin >> t >> d >> l;
    if (t + d + l == 0) return 0;
    
    vector<int> x(t);
    for (int i = 0; i < t; i++) cin >> x.at(i);
    
    vector<int> imos(210000);
    for (int i = 0; i < t; i++) {
      if (x[i] >= l) {
        imos[i + 1]++;
        imos[i + 1 + d]--;
      }
    }
    
    for (int i = 1; i < 209999; i++) imos[i] += imos[i - 1];
    
    int ans = 0;
    for (int i = 1; i <= t - 1; i++) {
      if (imos[i] > 0) ans++;
    }
    
    cout << ans << '\n';
  }
}


Measured memory_bytes: 4248
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int a[100];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, s = 0;
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i], s += a[i];

    int z = 0, sol = 1e9;
    for (int t = 1; t < n; ++t)
    {
        z += a[t - 1];
        sol = min(sol, abs(z - (s - z)));
    }
    cout << sol;
}


Measured memory_bytes: 256
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
from datetime import datetime as dt

def main():
  x, y = map(int, readline().split())
  print(x+y//2)
  
  
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 233;
set<int> s;
int a[maxn];
bool ok[maxn];
int main()
{
	int n,cnt=0,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=2;i<=k;i++)
		if(a[i]>a[i-1])cnt++;
	for(int i=1;i<=n-k+1;i++){
		if(cnt==k-1)ok[i] = 1;
		if(a[i]<a[i+1])cnt--;
		if(a[i+k]>a[i+k-1])cnt++;
	}
//	for(int i=1;i<=n-k+1;i++)cout<<ok[i]<<" ";cout<<endl;
	int ans = 1,first = ok[1];
	for(int i=2;i<=k;i++)s.insert(a[i]);
	for(int i=1;i<n-k+1;i++){
		int l = (*s.begin()),r = *s.rbegin();
//		cout<<i<<" "<<l<<" " << r << endl;
		if(a[i]<l&&r<a[i+k]){
			
		}
		else{
			if(ok[i+1]){
				if(!first){
					first = 1;
					ans++;
				}
			}
			else{
				ans++;
			}
		}
		s.erase(a[i+1]);
		s.insert(a[i+k]);
	}
	cout << ans << endl; 
	return 0;
} 

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

public class Main {
    public static void main(String[] args) {
        try (BufferedReader in = new BufferedReader(new InputStreamReader(System.in))){
            int n = 0;

            String W = in.readLine();

            while (true) {
                String s = in.readLine();
                if (s.equals("END_OF_TEXT")) break;

                String[] arr = s.toLowerCase().split(" ");
                for (int i = 0; i < arr.length; i++) {
                    if (W.equals(arr[i])) n++;
                }
            }
            System.out.println(n);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}



Measured memory_bytes: 24428
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {
    
    int N;
    string S;
    cin >> N >> S;

    int maximum = 0;

    rep(i,N) {
        vector<bool> check1(26, false), check2(26, false);
        rep(j,i) check1[S[j] - 'a'] = true;
        for (int j = i; j < N; j++) check2[S[j] - 'a'] = true;

        int count = 0;
        rep(j,26) if (check1[j] && check2[j]) count++;
        maximum = max(maximum, count);
    }

    cout << maximum << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N, K, Q;
int A[2011];

bool ok(const int low, const int high) {
    int sum = 0;
    int cnt_mid = 0, cnt_hi = 0;
    REP (i, N) {
	if (A[i] < low) {
	    int cnt = cnt_mid + cnt_hi;
	    if (cnt >= K) {
		sum += min(cnt_mid, cnt - (K-1));
	    }

	    cnt_mid = 0;
	    cnt_hi = 0;
	} else if (A[i] > high) {
	    cnt_hi++;
	} else {
	    cnt_mid++;
	}
    }

    {
	int cnt = cnt_mid + cnt_hi;
	if (cnt >= K) {
	    sum += min(cnt_mid, cnt - (K-1));
	}
    }

//    eprintf("%d %d : %d\n", low, high, sum);
    return sum >= Q;
}

VI unq;

void MAIN() {
    scanf("%d%d%d", &N, &K, &Q);
    REP (i, N) scanf("%d", A+i);
    
    unq = VI(A, A+N);
    sort(unq.begin(), unq.end());
    unq.erase(unique(unq.begin(), unq.end()), unq.end());

    int ans = unq.back() - unq[0];
    for (int i=0, left=0; i<N; i++) {
	while (left <= i) {
	    bool tmp = ok(unq[left], unq[i]);
	    if (tmp) amin(ans, unq[i] - unq[left]);
	    else break;
	    left++;
	}
    }

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

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 256
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)


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

    n = Base_10_to_n(N, K)
    print(len(n))

if __name__ == "__main__":
    main()


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

 
using namespace std;

int main(){
	int n,k;
	int x[100];
	int sum=0;
	cin>>n>>k;
	for (int i = 0; i < n; ++i)
	{
		cin>>x[i];
	}

	for (int i = 0; i < n; ++i)
	{
		if (x[i]<=k-x[i])
		{
			sum+=x[i];
		}
		else
			sum+=k-x[i];
	}

	cout<<sum*2<<endl;





return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int a[100];
    int n, i,flag=1;
    scanf("%d", &n);
    for (i = 0;i < n;i++)
    {
        scanf("%d", &a[i]);
    }
    for (i = 0;i < n;i++)
    {
        if (a[i] % 2 == 0)
        {
            if (a[i] % 3 != 0 && a[i] % 5 != 0)
            {
                flag = 0;break;
            }
        }
    }
    if (flag == 0)
    {
        printf("DENIED");
    }
    else
    {
        printf("APPROVED");
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
using namespace std;
long long a[200005];
int main() {
	int m;
	string s;
	cin >> s;
	m = s.size();
	a[0] = 0;
	a[1] = 1;
	if (s.at(1) == s.at(0)) {
		a[2] = 1;
	}
	else
		a[2] = 2;
	for (int i = 3; i <= m; i++) {
		if (s.at(i - 1) != s.at(i - 2))
			a[i] = a[i - 1] + 1;
		else
			a[i] = a[i - 3] + 2;
	}
	cout << a[m] << endl;
	return 0;
}

Measured memory_bytes: 2180
#include<bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<=(b);++i)
using namespace std;
inline int read(){
	int w=0;bool p=0;char c;
	while(!isdigit(c=getchar()))if(c=='-')p=1;
	while(isdigit(c))w=w*10+c-48,c=getchar();
	return p?-w:w;
}
const int N=2e5+7;
int n,a[N],b[N],c[N],d[N];
int main(){
	n=read();
	int k=0;
	REP(i,1,n)k=max(k,(int)log2(a[i]=read()));
	REP(i,1,n)k=max(k,(int)log2(b[i]=read()));
	int ans=0;
	for(int i=1+k;~i;--i){
		int t=1<<i;
		REP(j,1,n)c[j]=a[j]%(t<<1),d[j]=b[j]%(t<<1);
		sort(d+1,d+1+n);
		int h=0;
		REP(j,1,n){
			h+=lower_bound(d+1,d+1+n,2*t-c[j])-lower_bound(d+1,d+1+n,t-c[j]);	
			h+=lower_bound(d+1,d+1+n,4*t-c[j])-lower_bound(d+1,d+1+n,3*t-c[j]);	
		}
		ans<<=1;if(h&1)ans|=1;
	}
	cout<<ans<<endl;
	return 0;
}


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

int main(){
  int x,y;
  cin >> x >> y;
  int a = 0;
  for (int i = 0; i <= 1; i++){
    if (x == 2){
      a += 0;
    }
    else if (x == 4 || x == 6 || x == 9 || x == 11) {
      a += 1;
    }
    else {
      a += 3;
    }
    x = y;
  }
  if (a == 0 || a == 2 || a == 6){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

int main(){
    string s;
    cin >> s;
    int count = 0;    
    int maxCount = 0;
    for(auto &i : s){
        if(i == 'R'){
            count++;
        }
        else{
            count = 0;
        }
        if(count > maxCount){
            maxCount = count;
        }
    }
    cout << maxCount;
    return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;
constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;

    if(n & 1)
        rep(i, m) cout << i + 1 << " " << m * 2 - i << endl;
    else {
        if(n % 4) {
            int x = min(m, n / 4);
            rep(i, x) cout << i + 1 << " " << n / 2 - i << endl;
            x = m - x;
            rep(i, x) cout << n / 2 + 1 + i << " " << m * 2 + 1 - i << endl;
        } else {
            int x = min(m, n / 4);
            rep(i, x) cout << i + 1 << " " << n / 2 - i << endl;
            x = m - x;
            rep(i, x) cout << n / 2 + 1 + i << " " << m * 2 + 1 - i << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  int r=0;
  int b=0;
  REP(i,N){
    char c;
    cin>>c;
    if(c=='R')r++;
    else b++;
  }
  cout<<(r>b?"Yes":"No")<<endl;
  return 0;
}


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

int main() {

    int n, k, l, a;
    scanf("%d %d", &n, &k);
    int arr[n];

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

    }

    for (int j = 0; j < n - 1; j++) {
        for (int k = j + 1; k < n; k++) {
            if (arr[j] < arr[k]) {
                int temp = arr[j];
                arr[j] = arr[k];
                arr[k] = temp;
            }
        }
    }


    int mysum = 0;
    for (int j = 0; j < k; j++) {
        mysum += arr[j];
    }
    printf("%d", mysum);


    return 0;
}


Measured memory_bytes: 128
#include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<algorithm>
    #include<string>
    #include<cmath>
    #include<ctime>
    #include<queue>
    #include<map>
    #include<set>
    #include<vector>
    #include<bitset>
    #include<cassert>
    #define rint register int
    #define debug(x) cerr<<#x<<"="<<x<<endl
    #define fgx cerr<<"-------------"<<endl
    using namespace std;
    typedef long long ll;
    typedef pair<int,int> pii;
    int d[100],a[100];
    int main()
    {	int n,maxn=0,mn=100; scanf("%d",&n);
    	if(n>=24){cout<<"0\n"; return 0;}
    	for(rint i=1;i<=n;i++) scanf("%d",&d[i]),mn=min(mn,d[i]);
    	if(mn==0){cout<<"0\n"; return 0;}
    	if(n==23){cout<<"1\n"; return 0;}
    	for(rint i=0;i<(1<<n);i++)
    	{	for(rint j=1;j<=n;j++) if(i&(1<<j-1)) a[j]=24-d[j]; else a[j]=d[j];
    		int minn=1000;
    		for(rint j=1;j<=n;j++)
    		{	for(rint k=1;k<j;k++)
    			{	int now=max(a[j]-a[k],a[k]-a[j]);
    				minn=min(minn,min(now,24-now));
    			}
    			minn=min(minn,min(a[j],24-a[j]));
    		}
    		maxn=max(maxn,minn);
    	}
    	cout<<maxn<<endl;
     	return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
using pii = pair<int, int>;
int main() {
  int n, m;
  cin >> n >> m;
  priority_queue<int, vector<int>, less<int>> q;

  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    q.push(temp);
  }

  for (int i = 0; i < m; i++) {
    int a = q.top();
    q.pop();
    q.push(a / 2);
  }

  ll ans = 0;

  while (!q.empty()) {
    ans += q.top();
    q.pop();
  }
  cout << ans << endl;
}

Measured memory_bytes: 3924
/**
 *    author: gxfireball       
**/
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
using namespace std;

void solve(){
   ll n, inp;
   unordered_map<ll,ll> temp;
   cin >> n;
   for(ll i=1; i<n; ++i){
	   cin >> inp;
	   temp[inp]++;
   }
   for(ll i = 1; i <=n; ++i){
	   cout << temp[i] << endl;
   }
}

int main(){
    fastio;
    int t;
    t = 1;
    //cin>>t;
    while(t--){
    	solve();
    }
    return 0;
}


Measured memory_bytes: 11496
import java.util.Scanner;
public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a=new int[n];
    for(int i=0;i<a.length;i++){
      a[i]=sc.nextInt();
    }
    for(int j=0;j<n;j++){
      if(j==n-1){
        System.out.printf("%d",a[n-1-j]);
      }else{
        System.out.printf("%d ",a[n-1-j]);
      }
    }
    System.out.println("");
  }
}


Measured memory_bytes: 26512
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr



n = int(input())
l = factorization(n)
ans = 0



if n == 1:
    ans = 0
elif l[0][0] == n:
    ans = 1

else:
    l2 = []
    s = set()

    for i in l:

        for j in range(1,9999999999):
            if i[1]*2 < j*(j+1):
                ans += j-1
                break

    
print(ans)



Measured memory_bytes: 9468
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();

      int[] up = new int[n];
      up[0] = sc.nextInt();
      for(int i = 1; i < n; i++)
        up[i] = up[i-1] + sc.nextInt();

      int[] down = new int[n];
      for(int i = 0; i < n; i++)
        down[i] = sc.nextInt();
      for(int i = n - 2; i >= 0; i--)
        down[i] += down[i+1];

      int max = 0;
      for(int i = 0; i < n; i++)
        max = Math.max(max, up[i] + down[i]);
      System.out.println(max);
  }
}

Measured memory_bytes: 21716
#include<stdio.h>
#include<string.h>
int main()
{
	char s[20];
	//for(int i=0;i<4;i++) scanf("%d",&s[i]);
	scanf("%s",s);
	if(strlen(s)<4)
	{
		printf("No");
		return 0;
	}
	char check[]="YAKI";
	if(strncmp(s,check,4)==0)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String[] sl = s.split("");
		Arrays.sort(sl);
		s = String.join("", sl);
		if (s.equals("abc")) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}
}

Measured memory_bytes: 20948
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int n;
	int a[114514];
	cin>>n;
	rep(i,n){
		cin>>a[i];
		if(a[i]%2){
			puts("first");
			return 0;
		}
	}
	
	puts("second");
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5 {
    class Program {
        //スタートから(x, y)までの最短距離
        static int[,] cost;

        static int H;
        static int W;

        static int[,] s;

        static void Main(string[] args) {
            var S = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            H = S[0];
            W = S[1];
            
            cost = new int[H, W];

            //全ての白マスの数の合計
            int white = 0;
            //解答
            int ans = -1;

            //全ての要素を-1にする
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    cost[i, j] = -1;
                }
            }

            //全ての点の情報を記憶しておく
            s = new int[H, W];
            for (int i = 0; i < H; i++) {
                string X = Console.ReadLine();
                for (int j = 0; j < W; j++) {
                    s[i, j] = X[j];
                    if (X[j] == '.') {
                        white++;  //ここで白マスをカウント
                    }
                }
            }

            //最短距離
            int min_cost = bfs();

            //出力
            if (min_cost == -1) {
                ans = -1;
            } else {
                ans = white - (min_cost + 1);
            }
            Console.WriteLine(ans);
        }

        static int bfs() {
            //座標をpair(y, x)でもってqueueに入れる
            Queue<Tuple<int, int>> que = new Queue<Tuple<int, int>>();
            //スタートは(0, 0)
            Tuple<int, int> inQueue = Tuple.Create(0, 0);
            que.Enqueue(inQueue);
            cost[0, 0] = 0;

            //移動可能なマスをループで簡単に列挙
            int[] dx = { 0, 1, 0, -1 };
            int[] dy = { 1, 0, -1, 0 };

            //キューが空になるまで繰り返す
            while (que.Count != 0) {
                Tuple<int, int> p = que.Dequeue();  //キューの先端を取得しつつ削除

                //ゴールに到達したらcostを返す
                if (p.Item1 == H - 1 && p.Item2 == W - 1) {
                    return cost[p.Item1, p.Item2];
                }

                //今の地点から、上下左右に向かって調査する
                for (int i = 0; i < 4; i++) {
                    //次のx座標とy座標
                    int ny = p.Item1 + dy[i];
                    int nx = p.Item2 + dx[i];

                    //エリア外に行ったら、次のループに入る
                    if (nx < 0 || ny < 0 || nx >= W || ny >= H) continue;
                    //壁にぶち当たったら、次のループに入る
                    if (s[ny, nx] == '#') continue;
                    //すでに探索済みだったら、次のループに入る
                    if (cost[ny, nx] != -1) continue;

                    cost[ny, nx] = cost[p.Item1, p.Item2] + 1;
                    Tuple<int, int> inQ = Tuple.Create(ny, nx);
                    que.Enqueue(inQ);
                }
            }
            return -1;
        }
    }
}

Measured memory_bytes: 13524
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<int,int>;
using PP=pair<int,P>;
using Pl=pair<ll,ll>;
using PPl=pair<ll,Pl>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n,m,x,y;
    cin>>n>>m>>x>>y;
    vi a(n),b(m);
    REP(i,n){
        cin>>a[i];
    }
    REP(i,m){
        cin>>b[i];
    }
    int p=x;
    REP(i,n){
        chmax(p,a[i]);
    }
    int q=y;
    REP(i,m){
        chmin(q,b[i]);
    }
    if(p<q){
        cout<<"No ";
    }
    cout<<"War"<<endl;
    return 0;
}


Measured memory_bytes: 256