akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define vi vector<int>
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define sizeOf(A) (sizeof(A))/(sizeof(A[0]))
#define odd(x) ((x) % (2))
#define fastio ios_base::sync_with_stdio(false), cin.tie(0);
const ll MOD = 1e9 + 7;

int main() {
    fastio;

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if (c < a) {
        swap(a, c);
        swap(b, d);
    }
    if ( (a <= d) && (b >= c)) {
         cout << min(b-c, d-c) << "\n";
    } else {
        cout << 0 << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <cstring>
#define FMAX 10000
#define initarr(a) memset(a, 0, sizeof(a))
using namespace std;
typedef map<short, map<short, short> > V;

short calc_x_arr[FMAX];

void add_vertex(V &vertexes, short x, short y, short t) {
  auto &xv = vertexes[y];
  auto &sum = xv[x];
  sum += t;
}

int main() {
  short n, r;
  while (cin >> n >> r, n || r) {
    // load
    short x1, y1, x2, y2;
    short min_x = FMAX, min_y = FMAX, max_x = 0, max_y = 0;
    V vertexes;
    for (short i = 0; i < n; i++) {
      cin >> x1 >> y1 >> x2 >> y2;
      add_vertex(vertexes, x1, y1, 1);
      add_vertex(vertexes, x1, y2, -1);
      add_vertex(vertexes, x2, y1, -1);
      add_vertex(vertexes, x2, y2, 1);
      min_x = min(min_x, x1);
      min_y = min(min_y, y1);
      max_x = max(max_x, x2);
      max_y = max(max_y, y2);
    }

    // calc
    int area = 0, perimeter = 0;
    short prev_y = -1;
    short prev_partial_vertical_perimeter = 0;
    short prev_partial_area = 0;
    initarr(calc_x_arr);
    for (auto yvit = vertexes.begin(); yvit != vertexes.end(); yvit++) {
      area += prev_partial_area * (yvit->first - prev_y - 1);
      prev_partial_area = 0;
      if (r == 2) {
        perimeter += prev_partial_vertical_perimeter * (yvit->first - prev_y - 1);
        prev_partial_vertical_perimeter = 0;
      }
      short left = 0;
      short xsum = 0;
      auto xvit = yvit->second.begin();
      for (short x = min_x; x <= max_x; x++) {
        if (x == xvit->first) {
          xsum += xvit->second;
          if (++xvit == yvit->second.end()) {
            xvit = yvit->second.begin();
          }
        }
        short current = xsum + calc_x_arr[x];
        if (current != 0) prev_partial_area++;
        if (r == 2) {
          bool vdelta = left == 0 ^ current == 0;
          prev_partial_vertical_perimeter += vdelta;
          perimeter += vdelta + (calc_x_arr[x] == 0 ^ current == 0);
        }
        left = calc_x_arr[x] = current;
      }
      area += prev_partial_area;
      prev_y = yvit->first;
    }

    cout << area << endl;
    if (r == 2) cout << perimeter << endl;
  }
  return 0;
}

Measured memory_bytes: 3912
import sys
input = sys.stdin.readline
from collections import *

class CHT: #傾きの単調性と最小値クエリのxの単調性を仮定
    def __init__(self):
        self.q = deque([]) #直線群
        
    def f(self, f1, x): #f1(x)
        return f1[0]*x+f1[1]
    
    def check(self, f1, f2, f3): #f2を削除しても良いかの判定
        return (f2[0]-f1[0])*(f3[1]-f2[1])>=(f2[1]-f1[1])*(f3[0]-f2[0])
    
    def add_line(self, a, b): #傾きa, 切片bの直線を追加
        while len(self.q)>=2 and self.check(self.q[-2], self.q[-1], (a, b)):
            self.q.pop()
        
        self.q.append((a, b))
    
    def get(self, x): #xでの最小値
        while len(self.q)>=2 and self.f(self.q[0], x)>=self.f(self.q[1], x):
            self.q.popleft()
        
        return self.f(self.q[0], x)
    
N, C = map(int, input().split())
h = list(map(int, input().split()))
dp = [0]*N
cht = CHT()
cht.add_line(-2*h[0], h[0]**2)

for i in range(1, N):
    dp[i] = h[i]**2+C+cht.get(h[i])
    cht.add_line(-2*h[i], dp[i]+h[i]**2)

print(dp[N-1])

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

int main(void){
  int x[4], y[4], dx, dy;
  cin >> x[0] >> y[0] >> x[1] >> y[1];
  dx = x[1] - x[0];
  dy = y[1] - y[0];

  x[2] = x[1] - dy;
  y[2] = y[1] + dx;
  x[3] = x[2] - dx;
  y[3] = y[2] - dy;
  cout << x[2] << " " 
    << y[2] << " "
    << x[3] << " "
    << y[3] << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n, d; cin >> n >> d;
	cout << (n + 2 * d) / (1 + 2 * d) << endl;
}

Measured memory_bytes: 256
while gets
  w = $_.to_i
  n = gets.to_i
  a = (1..w).to_a

  #a = Array.new
  #for i in 1..w
  #  a.push(i)
  #end

  for i in 1..n
    s = gets.split(",")
    x = s[0].to_i - 1
    y = s[1].to_i - 1
    a[x], a[y] = a[y], a[x]
  end

  puts a

  #for i in 0...w
  #  puts a[i]
  #end
end

Measured memory_bytes: 2368
#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000


struct Card{
	char suit;
	int value;
};

struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void merge(struct Card A[], int n, int left, int mid, int right){
	int i,j,k;
	int n1 = mid - left;
	int n2 = right - mid;
	for( i=0; i<n1; i++) L[i] = A[left + i];
	for( i=0; i<n2; i++) R[i] = A[mid + i];
	L[n1].value = R[n2].value = SENTINEL;
	i = j = 0;
	
	for( k=left; k<right; k++){
		if(L[i].value <= R[j].value){
			A[k] = L[i++];
		} else{
			A[k] = R[j++];
		}
	}
}

void mergeSort(struct Card A[], int n, int left, int right){
	int mid;
	if( left + 1 < right){
		mid = (left+right) / 2;
		mergeSort(A, n, left, mid);
		mergeSort(A, n, mid, right);
		merge(A, n, left, mid, right);
	}
}

int partition(struct Card A[], int n, int p, int r){
	int i, j;
	struct Card t, x;
	x = A[r];
	i = p - 1;
	for( j=p; j<r; j++){
		if( A[j].value <= x.value ){
			i++;
			t = A[i]; A[i] = A[j]; A[j]=t;
		}
	}
	t=A[i+1]; A[i+1]=A[r]; A[r]=t;
	return i+1;
}

void quickSort( struct Card A[], int n, int p, int r){
	int q;
	if( p<r ){
		q=partition(A, n, p, r);
		quickSort(A,n,p,q-1);
		quickSort(A,n,q+1,r);
	}
}

int main(){
	int n, i, v;
	struct Card A[MAX], B[MAX];
	char S[10];
	int stable=1;
	
	scanf("%d",&n);
	
	for(i=0; i<n; i++){
		scanf("%s %d",S, &v);
		A[i].suit = B[i].suit = S[0];
		A[i].value = B[i].value = v;
	}
	
	mergeSort(A, n, 0, n);
	quickSort(B, n, 0, n-1);
	
	for( i=0; i<n; i++){
		//マージソートとクイックソートの結果を比べる
		if (A[i].suit != B[i].suit) stable =0;
	}
	
	if( stable == 1 ) printf("Stable\n");
	else printf("Not stable\n");
	for( i=0; i<n; i++){
		printf("%c %d\n", B[i].suit, B[i].value);
	}
	
	return 0;
}


Measured memory_bytes: 4052
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String c = sc.next();
    sc.close();

    String result;
    if (c.equals("a") || c.equals("i") || c.equals("u") || c.equals("e") || c.equals("o")) {
      result = "vowel";
    } else {
      result = "consonant";
    }
    System.out.println(result);
  }
}


Measured memory_bytes: 21844
#include<stdio.h>

struct Process {
    char name[100];
    int time;
};

struct Que {
    int head;
    int tail;
};

Que Q;
Process P[100000];

void enqueue(Process p) {
    P[Q.tail] = p;
    Q.tail++;
    if (Q.tail==100000) Q.tail=0;
}

Process dequeue() {
    Process p = P[Q.head];
    Q.head++;
    if (Q.head==100000) Q.head=0;
    return p;
}

bool isEmpty() {
    return Q.head == Q.tail;
}

int main() {
    int t, i, n, MAX_PROCESS_TIME;

    scanf("%d %d", &n, &MAX_PROCESS_TIME);
    for (i=0; i<n; i++) scanf("%s %d", P[i].name, &P[i].time);
    Q.head = 0;
    Q.tail = n;
    t = 0;

    while (!isEmpty()) {
        Process p = dequeue();
        if (p.time > MAX_PROCESS_TIME) {
            p.time -= MAX_PROCESS_TIME;
            t += MAX_PROCESS_TIME;
            enqueue(p);
        } else {
            t += p.time;
            printf("%s %d\n", p.name, t);
        }
    }

    return 0;
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N;
int x[110], y[110], h[110];

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

    std::cin >> N;

    for(int i=0;i<N;++i){
        std::cin >> x[i] >> y[i] >> h[i];
    }

    int m = std::max_element(h, h + N) - h;

    for(int cx=0;cx<=100;++cx){
        for(int cy=0;cy<=100;++cy){
            int H = h[m] + std::abs(x[m] - cx) + std::abs(y[m] - cy);
            bool isValid = true;
            
            for(int i=0;i<N;++i){
                int he = std::max(H - std::abs(x[i] - cx) - std::abs(y[i] - cy), 0);

                if(he != h[i]){
                    isValid = false;
                    break;
                }
            }

            if(isValid){
                printf("%d %d %d\n", cx, cy, H);
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using intl = long long;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)((n) - 1); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define INF = 1e9;
#define debug(x) cout << #x << ":" << x << endl
using namespace std;
int main(){
    intl a;
    cin >> a;
    if(a%2 == 0)a /= 2;
    else a = a / 2 + 1;
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 256
from functools import reduce
from fractions import gcd
N,X = map(int,input().split())
W = list(map(int,input().split())) + [X]
W = sorted(W)
sa_w = [W[i+1] - W[i] for i in range(N)]
ans = reduce(gcd, sa_w)
print(ans)

Measured memory_bytes: 16308
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long int;using ld = long double;using P = pair<ll,ll>;const int MOD = (int)1e9+7;const string rt = "\n";const string sp = " ";/* 最大公約数 */template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}/* UnionFind */template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};/* コンビネーション */template<typename T> ll combpm(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}/* 多次元ベクター */template<class T>vector<T> mvec(size_t a){return vector<T>(a);}template<class T, class... Ts>auto mvec(size_t a, Ts... ts){return vector<decltype(mvec<T>(ts...))>(a, mvec<T>(ts...));}/* テスト関数 */void test(ll n){cout << "test" << n << endl;}/* 小数点以下 */void fixsp(ll n){cout << fixed << setprecision(n);}void defsp(ll n){cout << defaultfloat << setprecision(n);}/* 重み付きUnionFind */struct WUnionFind {vector<int> par;vector<int> rank;WUnionFind(int n = 1) {init(n);}void init(int n = 1) {par.resize(n); rank.resize(n);for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;}int root(int x) {if (par[x] == x) {return x;}else {int r = root(par[x]);return par[x] = r;}}bool issame(int x, int y) {return root(x) == root(y);}bool merge(int x, int y) {x = root(x); y = root(y);if (x == y) return false;if (rank[x] < rank[y]) swap(x, y);if (rank[x] == rank[y]) ++rank[x];par[y] = x;return true;}};/* IO高速化 */void fastio(){ios::sync_with_stdio(false);cin.tie(NULL);}
/* ここからコード開始 */

int main(){
  fastio;
  ll N, M;
  cin >> N >> M;
  rem(i, M/N, 0){
    if(M%i==0){
      cout << i << rt;
      return 0;
    }
  }
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define pb push_back
# define ll long long
# define fi first
# define se second
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define mkp make_pair
//# define time cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"

using namespace std;

ll q , w , e , z ;


int main()
{
	speed;

        ll n , k ;
        cin >> n >> k ;
        ll a[n];
            for(ll i = 0 ; i < n ; i ++ ){
                cin >> a[i] ;
            }
        sort(a,a+n);
            ll h = 0 ;
            for(ll i = 0 ; i < n - k ; i ++ ){
                h += a[i];
            }
        cout << h << endl;



	time;
}


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

int main(){
    int n;
    cin >> n;
    int i,x;
    int a[n];
    for(i=0;i<n;i++){
        cin >>x;
        a[x-1] = i+1;
    }
    for(i=0;i<n;i++){
        cout << a[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 1152
#include <bits//stdc++.h>
using namespace std;
#define rep(i,n,k) for(int i=n;i<k;i++)
#define int unsigned long long
#define F first 
#define S second
#define P make_pair 

signed main(void){
 
    
    int n,m,q,p,ans;
    string s;
    ans=0;
    vector<int> v;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5])
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
}


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

int main(){
  int m1,m2,d1,d2;
  cin >> m1>>d1>>m2>>d2;

  if(m1 == m2) cout << 0<<endl;
  else cout<<1<<endl;

  return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports, unused_variables, dead_code)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;
use std::io::Write;

trait InputValue {
    fn parse(s: &str) -> Self;
}

fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

fn readvec<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

fn readlines<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

fn main() {
    let n: usize = read();
    println!("{}", n / 3);
}

Measured memory_bytes: 4352
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace debug
{
    class main
    {
        static void Main(string[] args)
        {
            //問題クラスを展開
            ProgramA a = new ProgramA();
            a.main();//実行する

        }

    }

    //ABC096
    class ProgramA
    {
        public void main()
        {
            //入力
            string[] s = Console.ReadLine().Split(' ');
            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);


            if (a<= b)
                Console.WriteLine(a);
            else
                Console.WriteLine(a-1);

        }
    }

    class ProgramB
    {
        public void main()
        {
            //入力
            int x = int.Parse(Console.ReadLine());

            for (int i = x; i > 0; i--)
            {
                for(int j = 2; j <= Math.Sqrt(x);j++)
                {
                    if(i % j == 0)
                    {
                        int t = i;
                        while (t % j == 0)
                            t /= j;

                        if(t == 1)
                        {
                            Console.WriteLine(i);
                            return;
                        }
                    }
                }

            }


            Console.WriteLine(1);
        }

        
    }

    class ProgramC
    {
        public void main()
        {

            //入力
            string s = Console.ReadLine();
            int k = int.Parse(Console.ReadLine());

            List<string> ans = new List<string>();

            //kが5文字以下が答えの候補なので入れて考えてみる
            for(int j = 1; j <= 5;j++)
                for (int i = 0;i < s.Length + 1 - j;i++)
                {
                    if(!ans.Contains(s.Substring(i, j)))
                        ans.Add(s.Substring(i, j));
                }
            
            //ソートする
            ans.Sort();

            //答え出力
            Console.WriteLine(ans[k -1]);

        }

        
    }



    class ProgramD
    {
        public void main()
        {

            //入力
            int n = int.Parse(Console.ReadLine());

            List<int> a = new List<int>(10000);

            for (int i = 0; i < 10000; i++)
                a.Add(i + 2);

            //10000までの素数を出す
            for(int i = 2;i <= Math.Sqrt(10000);i++)
            {
                List<int> t = new List<int>(10000);
                foreach (var s in a)
                {
                    if (s % i == 0 && s / i != 1)
                        t.Add(s);
                }

                foreach (var s in t)
                {
                    a.Remove(s);
                }


            }

            //5で割ったあまりが1だけのものを出す
            int count = 0;
            foreach (var s in a)
            {
                if (s % 5 == 1)
                {
                    Console.Write(s + " ");
                    count++;
                }

                if (count == n)
                    break;
            }
            
        }
    }

    


}






Measured memory_bytes: 27496
using System;
class D_RGBTriplets
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string S = Console.ReadLine();
        if(N < 4)
        {
            Console.WriteLine(0);
            return;
        }


        int[] R = new int[N+1];
        int[] G = new int[N+1];
        int[] B = new int[N+1];
        R[N] = 0;
        G[N] = 0;
        B[N] = 0;
        for(int i = N - 1;i >= 0; i--)
        {
            if(S[i] == 'R')
            {
                R[i] = R[i + 1] + 1;
                G[i] = G[i + 1];
                B[i] = B[i + 1];
            }
            if(S[i] == 'G')
            {
                R[i] = R[i + 1];
                G[i] = G[i + 1] + 1;
                B[i] = B[i + 1];
            }
            if(S[i] == 'B')
            {
                R[i] = R[i + 1];
                G[i] = G[i + 1];
                B[i] = B[i + 1] + 1;
            }
        }


        Int64 Combination = 0;
        for(int i = 0;i < N - 3; i++)
        {
            for(int j = i + 1; j < N - 1; j++)
            {
                if (S[i] == S[j]) continue;
                if(S[i] != 'R' && S[j] != 'R')
                {
                    Combination += R[j + 1];
                    if (2 * j - i < N) {
                        if (S[2 * j - i] == 'R') Combination--;
                    }
                    continue;
                }
                if(S[i] != 'G' && S[j] != 'G')
                {
                    Combination += G[j + 1];
                    if (2 * j - i < N) {
                        if (S[2 * j - i] == 'G') Combination--;
                    }
                    continue;
                }
                if(S[i] != 'B' && S[j] != 'B')
                {
                    Combination += B[j + 1];
                    if (2 * j - i < N) {
                        if (S[2 * j - i] == 'B') Combination--;
                    }
                    continue;
                }
            }
        }
        Console.WriteLine(Combination);
    }
}

Measured memory_bytes: 27508
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const double pi = acos(-1);

int main() {
    char c;
    cin >> c;

    if(isupper(c)) {
        out("A");
    }
    else {
        out("a");
    }

    re0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);
	int a,b,c;
	cin>>a>>b>>c;
	int k;
	cin>>k;
	
		while(a>=b){
			b*=2;
			--k;
		}
		if(k<0){
			cout<<"NO";
			return 0;
		}
		while(b>=c){
			c*=2;
			--k;
		}
		if(k<0){
			cout<<"No";
			return 0;
		}
		cout<<"Yes";
	return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
int main(void){
  int n,s[1001],i,sum=0;
  double ave,a=0;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    for(i=0; i<n; i++){
      scanf("%d",&s[i]);
      sum+=s[i];
    }
    ave=(double)sum/n;
    for(i=0; i<n; i++){
      a+=((s[i]-ave)*(s[i]-ave));
    }
    printf("%f\n",sqrt((double)a/n));
    sum=0; a=0;
  }
  return 0;
}



Measured memory_bytes: 2108
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    string s,t;
    cin>>s>>t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    reverse(t.begin(),t.end());
    if(s<t) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] a = new int[N];
        int count1 = 0;
        int count2 = 0;
        
        for(int i=0; i<N; i++){
            a[i] = sc.nextInt();
            if(a[i]%4==0){
                count1++;
            }else if(a[i]%4!=0 && a[i]%2==0){
                count2++;
            }
        }
        if(count2%2==0){
            N = N-count2;
        }else{
            N = N-count2+1;
        }
        if(count1 >= N/2){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        //System.out.println(count1+":"+N);
    }
}

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


  
int main(){


  int a,b,k;
  
  cin>>a>>b>>k;
  
  
  int m=min(a,b);
  
  int check=0;
  
  
  
  
  while (check<k){
    if (a%m==0 and b%m==0){
      check++;
    }
    m--;
  }
  
  cout<<m+1<<endl;
  

    
      
      
  

  
}
  















Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  string w;
  cin >> w;
  vector<int> cnt(256);
  for (int i = 0; i < w.size(); i++) {
    cnt[w[i]]++;
  }
  for (int i = 0; i < 256; i++) {
    if (cnt[i] % 2 == 1) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

nmax = 0

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans = 0
j = M
for i in range(N + 1):
    if a[i] > K:
        break

    while b[j] + a[i] > K:
        j -= 1
    ans = max(ans, i+j)

print(ans)
exit()


Measured memory_bytes: 47092
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()

n = ni()
k = ni()
xxx = na()
ans = 0
for i in range(n):
    ans += min(2 * xxx[i], 2 * (k - xxx[i]))
print(ans)



Measured memory_bytes: 3060
#import<iostream>
using namespace std;
#define m int64_t
#define r(s,i,n) for(m i=s;i<n;i++)
m w[555][555],p[1234];
main(){m n;cin>>n;m t=0,k=555;r(2,i,1e4){bool a=1;r(2,j,i){if(i%j==0)a=false;}if(a)p[t]=i,t++;}r(0,i,k)r(0,j,k)if(i%2==j%2)w[i][j]=p[(i+j)/2]*p[(i+k*3-j)/2];r(0,i,k)r(0,j,k)if(w[i][j]==0&&i>0&&i<554)w[i][j]=w[i-1][j]*w[i+1][j]+1;r(0,i,n)r(0,j,n)cout<<w[i+1][j+1]<<" ";}

Measured memory_bytes: 6044
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main()
{
  int n,ans=1;
  cin>>n;
  int h[n];
  rep(i,n) cin>>h[i];

  for(int i=1;i<n;i++)
  {
    bool flag=true;
    for(int j=0;j<i;j++)
    {
      if(h[i]<h[j]) flag=false;
    }
    if(flag) ans++;
  }

  cout<<ans<<endl;
}

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

int H, W;
bool S[52][52];

int main() {
  cin >> H >> W;
  for(int i = 1; i <= H; ++i) for(int j = 1; j <= W; ++j) {
    char c; cin >> c; S[i][j] = c == '#';
  }
  for(int i = 1; i <= H; ++i) for(int j = 1; j <= W; ++j) {
    if(S[i][j]
      && !S[i - 1][j] && !S[i + 1][j]
      && !S[i][j - 1] && !S[i][j + 1]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>

const long long mod = 1e9 + 7;

long long ans = 0;
long long p[26];
char o[100010];

void sub(int c, long long b) {
    if(b == 0) return;
    ans += b;
    ans %= mod;
    for(int i = c; i < 26; i++) sub(i + 1, (b * p[i]) % mod);
}

int main() {
    int n;
    scanf("%d",&n);
    scanf("%s", o);
    for(int i = 0; i < n; i++) p[o[i] - 'a']++;
    ans = mod - 1;
    sub(0, 1);
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();

            int cnt = 0;
            int ans = 0;
            for (int i = 0; i < S.length(); i++) {
                cnt = 0;
                for (int j = i; j < S.length(); j++) {
                    if ('A' == S.charAt(j) || 'C' == S.charAt(j) || 'G' == S.charAt(j) || 'T' == S.charAt(j)) {
                        cnt++;
                    } else {
                        break;
                    }
                    ans = Math.max(ans, cnt);
                }
            }
            out.println(ans);
        }

    }
}



Measured memory_bytes: 21716
#include <stdio.h>

int main(void)
{
	int n, i, a[10000], max = -1000000, min = 1000000;
	long sum = 0;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		sum += a[i];
		if (max < a[i])
		max = a[i];
		if (min > a[i])
		min = a[i];
		
	}
	
	printf("%d %d %ld\n", min, max, sum);
	
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

bool Exists[26] = {false,};

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

    if(s.size() == 26){
        if(s == "zyxwvutsrqponmlkjihgfedcba"){
            cout << "-1" << endl;
            return 0;
        }
        char c;
        for(int i = 25; i > 0; i--){
            Exists[s[i]-'a'] = true;
            if(s[i-1] < s[i]){
                for(int j = 0; j < 26; j++){
                    if(Exists[j] == true && s[i-1] < j+'a'){
                        c = j+'a';
                        break;
                    }
                }
                for(int j = 0; j < i-1; j++){
                    cout << s[j];
                }
                cout << c << endl;
                return 0;
            }
        }

    }else{
        for(int i = 0; i < s.size(); i++){
            Exists[s[i]-'a'] = true;
        }
        for(int i = 0; i < 26; i++){
            if(Exists[i] == false){
                cout << s + char(i+'a') << endl;
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 256
lines = []
while line = gets
  lines << line.chomp.split(' ')
end

results = []

lines.each do |l|
  case l[1]
  when "+"
    results.push(l[0].to_i + l[2].to_i)
  when "-"
    results.push(l[0].to_i - l[2].to_i)
  when "*"
    results.push(l[0].to_i * l[2].to_i)
  when "/"
    results.push(l[0].to_i / l[2].to_i)
  end
end

results.each do |r|
  puts r
end


Measured memory_bytes: 6876
#include <iostream>
#include <iomanip>
#include <climits>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <unordered_map>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <random>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#define INF (int)1e8
#define _INF (int)-1e8
#define INFLL (long long)1e15
#define _INFLL (long long)-1e15
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> P;

/*******************************************************/

struct graph_t {
	int n;           // |V|, index begins with 0
	int m;           // |E|
	vector<P> edges; // E
	vector<ll> cost; // cost or distance
	vector<ll> cap;  // capacity
};

class Finding_Arts {
private:
	struct node {
		int id; bool done; vi to_eid; vi to; int from_eid; int from; int pre; int low;
	};
	vector<node> nodes;
	int n;
	int ord;
	vi arts;
	void lowlink_dfs(int a, bool isroot) {
		nodes[a].done = true;
		nodes[a].pre = nodes[a].low = ord;
		ord++;
		int cnt = 0;
		Loop(i, nodes[a].to.size()) {
			int b = nodes[a].to[i];
			if (b == nodes[a].from) continue;
			if (!nodes[b].done) {
				nodes[b].from = a;
				lowlink_dfs(b, false);
				nodes[a].low = min(nodes[a].low, nodes[b].low);
				if (nodes[a].pre <= nodes[b].low) cnt++;
			}
			else {
				nodes[a].low = min(nodes[a].low, nodes[b].pre);
			}
		}
		if (cnt > (isroot ? 1 : 0)) arts.push_back(a);
		return;
	}
public:
	Finding_Arts(graph_t G) {
		n = G.n;
		nodes.resize(n);
		Loop(i, n) nodes[i] = { i, false,{},{}, -1, -1, -1, -1 };
		Loop(i, G.edges.size()) {
			nodes[G.edges[i].first].to_eid.push_back(i);
			nodes[G.edges[i].first].to.push_back(G.edges[i].second);
		}
		ord = 0;
		Loop(i, nodes.size()) {
			if (!nodes[i].done) lowlink_dfs(i, true);
		}
		sort(arts.begin(), arts.end());
	}
	vi get_arts() {
		return arts;
	}
};

// finding_bridge sample
int main() {
	graph_t G;
	cin >> G.n >> G.m;
	Loop(i, G.m) {
		int s, t; cin >> s >> t;
		G.edges.push_back({ s, t });
		G.edges.push_back({ t, s });
	}
	Finding_Arts finding_arts(G);
	vi arts = finding_arts.get_arts();
	Loop(i, arts.size()) {
		cout << arts[i] << endl;
	}
	return 0;
}

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

int main()
{
    int N;
    string S;
    cin >> N >> S;
    int L = S.length();
    for(int l=0; l<L; l++){
        S[l] = (S[l] - 'A' + N) % 26 + 'A';
    }
    cout << S << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i = 0;i < (n);i++)
#define rep(i,m,n) for(int i = (m);i < (n);i++)
#define P pair<int,int>
#define pb push_back
#define mk make_pair
using namespace std;
#define Vec(a) vector <int> a
const int INF = 1 << 20;
const int MOD = 1e9+7;





int main(){
  int n;
  cin >> n;
  vector <P> a;
  REP(i,n){
    int b;
    cin >> b;
    a.pb(mk(b,i));
  }
  
  sort(a.begin(),a.end());
  int m = 0;
  int now = 1;
  if(a.size() == 1){
    cout << 0 << endl;
    return 0;
  }
  rep(i,1,a.size()){
    if(a[i].second - a[i-1].second > 0){
      now++;
    }
    else{
      m = max(now,m);
      now = 1;
    }
    if(i == a.size()-1){
      m = max(now,m);
    }
  }
  cout << n-m << endl;
    
  
  
  
  return 0;
}

Measured memory_bytes: 2420
a,b=map(int,input().split())
price=10*b
c=[]  
while(price<10*b+10):
  if int(price*0.08)==a:
    c.append(price)
    price=price+1
  else:
    price=price+1
if c==[]:
  print(-1)
else:
  print(min(c))

Measured memory_bytes: 3064
def p(A,p,r):
 x=A[r]
 i=p-1
 for j in range(p,r):
  if A[j]<=x:
   i+=1
   A[i],A[j]=A[j],A[i]
 A[i+1],A[r]=A[r],A[i+1]
 return i+1
n=int(input())
A=list(map(int,input().split()))
k=p(A,0,n-1)
A[k]='['+str(A[k])+']'
print(*A)


Measured memory_bytes: 16392
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    double a, b, c;
    cin >> a >> b >> c;
    if(sqrt(a * b) < (c-a-b)/2)cout << "Yes";
    else cout << "No";
}   

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cout<<"!"<<endl
#define SHOW(a,b) cout<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cout<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
  
#define DIV 1000000007
typedef vector<ll> Array;
typedef vector<Array> matrix;

#define MAX 1000000005

int main(){
  int t = 0, s = 0, v = 0;

  int n; cin >> n;
  rep(i,n){
    int a; cin >> a;
    if(a % 2 == 0 && a % 4 != 0){
      t++;
    }else if(a%4 == 0){
      s++;
    }else{
      v++;
    }
  }
  if(t != 0){
    v++;
  }
  if(s+1 < v)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}

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

int main() {
	int N, K, X, Y;
	cin >> N >> K >> X >> Y;
	int cost = 0;
	for (int i = 0; i < N; i++){
		if (i < K) cost += X;
		else cost += Y;
	}
	cout << cost << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reve(a) reverse(a.begin(), a.end())
#define PI 3.14159265359
typedef long long ll;
const ll MOD = 1e9+7;

ll gcd(ll a, ll b){
  if(b==0) return a;
  return gcd(b, a%b);
}
/*ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}*/

ll lcm(ll a, ll b){
  ll g = gcd(a, b);
  b /= g;
  a *= b;
  return a;
}

//素数判定 O(√n)
bool is_prime(int64_t n){
  for(int64_t i = 2; i*i<=n; i++){
    if(n%i==0) return false;
  }
  return n!=1;
}

//約数の列挙 O(√n)
vector<int64_t> dividor(int64_t n){
  vector<int64_t> res;
  for(int64_t i=1; i*i<=n; i++){
    if(n%i==0){
      res.push_back(i);
      if(i != n/i) res.push_back(i);
    }
  }
  return res;
}

//素因数分解 O(√n)
map<int64_t, int64_t> prime_factor(int64_t n){
  map<int64_t, int64_t> res;
  for(int64_t i=2; i*i<=n; i++){
    while(n%i==0){
      res[i]++;
      n /= i;
    }
  }
  if(n != 1) res[n] = 1;
  return res;
}
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

  


int main(){ 
  int64_t a,b,c, k; cin >> a >> b >> c >> k;
  if(a>=k) cout << k << endl;
  else if(a+b>=k) cout << a << endl;
  //else cout << max(0LL, a-(k-a-b)) << endl; 
  else  cout << a-(k-a-b) << endl;
}


Measured memory_bytes: 3580
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<map>
#include<set>

using namespace std;


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

	int ans = 0;
	if (a - b >= c) {
		cout << 0;
	}
	else {
		cout << c + b - a;
	}
}

Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');
 
// inputに入力データ全体が入る
function Main(input) {
  // 1行目がline1, 2行目がline2, …に入る
  var tmp = input.split("\n");
  var line0 = tmp[0].split(" ");
  //var line1 = tmp[1].split(" ");
  //var line2 = tmp[2].split(" ");
  //var line3 = tmp[3].split(" ");

  var x = Number(line0[0]);
  var a = Number(line0[1]);
  var b = Number(line0[2]);

  var ans = "hoge";

  //console.log(x +" "+ a +" "+ b + " hoge ")
  

  if (b <= a) console.log("delicious");
  else if(b - a <= x) console.log("safe");
  else console.log("dangerous");
  
  


}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7500
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#define ll long long
using namespace std;
int main()
{
    int a,b;
    int f;
    cin>>a>>b;
    int ans=0;
    for(int i=a;i<=b;i++)
    {
        int fi=i;f=0;
        while(fi!=0)
        {
            f=f*10+fi%10;
            fi/=10;
        }
        if(f==i)
        {
            ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
//	-*- mode: C++ -*-
//	Search I
//		You are given a sequence of n integers S and a sequence of different q integers T. Write a program which outputs C, the number of integers in T which are also in the set S.
//
//	Input
//		In the first line n is given. In the second line, n integers are given. In the third line q is given. Then, in the fourth line, q integers are given.
//
//	Output
//		Print C in a line.
//
//	Constraints
//		n ≤ 10000
//		q ≤ 500
//		0 ≤ an element in S ≤ 10^9
//		0 ≤ an element in T ≤ 10^9
//	Sample Input 1
//		5
//		1 2 3 4 5
//		3
//		3 4 1
//	Sample Output 1
//		3
//	Sample Input 2
//		3
//		3 1 2
//		1
//		5
//	Sample Output 2
//		0
//	Sample Input 3
//		5
//		1 1 2 2 3
//		2
//		1 2
//	Sample Output 3
//		2

#include <iostream>
#include <vector>

int	main(int	argc,
		 char*	argv[])
{
	unsigned int	n	{0};

	std::cin >> n;

	std::vector<unsigned int>	S;
	for(auto i = 0; i < n; i++){
		unsigned int	s	{0};
		std::cin >> s;
		S.push_back(s);
	}

	unsigned int	q	{0};

	std::cin >> q;

	std::vector<unsigned int>	T;
	for(auto i = 0; i < q; i++){
		unsigned int	t	{0};
		std::cin >> t;
		T.push_back(t);
	}

	unsigned int	C	{0};
	for(auto t : T){
		for(auto s : S){
			if(t == s){
				++C;
				break;
			}
		}
	}

	std::cout << C << '\n';
	return	0;
}



Measured memory_bytes: 3148
# ピース数取得
peaces = STDIN.gets.strip.split(' ')
peace_s = peaces[0].to_i
peace_c = peaces[1].to_i

# 作成個数
count = 0

if peace_s < peace_c * 0.5
  count = peace_s
  peace_c -= peace_s * 2
  count += ( peace_c / 4 ).floor
else
 count = ( peace_c * 0.5 ).floor
end

puts count

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

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(bu.readLine()),i,a[]=new int[n];
        String s[]=bu.readLine().split(" ");
        HashMap<Long,Long> hm=new HashMap<>();
        long c=0;
        for(i=0;i<n;i++)
        {
            a[i]=Integer.parseInt(s[i]);
            long v=i-a[i];
            if(hm.get(v)!=null) c+=hm.get(v);
            v=0l+i+a[i];
            if(hm.get(v)==null) hm.put(v,1l);
            else hm.put(v,hm.get(v)+1);
        }
        System.out.print(c);
    }
}


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

using namespace std;

typedef long long ll;
typedef long long unsigned int llui;
typedef long long int lli;
typedef long double float64;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;

#define INF 1000000000
#define MOD 1000000007
#define EPS 1e-9
#define DEBUG(x) cout<< '>' << #x << ':' << x << "\n";
#define all(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define UNIQUE(x) (x).erase(unique((x).begin(),(x).end()),(x).end())
#define tr(container, it) \
    for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) 

// #define sz(a) int((a).size())
// #define pb push_back
// #define fill(a,v) memset(a,v,sizeof a)


#define trace(x) cout << '>' << #x << ':' << x << endl;
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << endl;

#define trace3(x,y,z) cout<< '>' << #x << ':' << x \
        << " | " << #y << ':' << y <<" | " << #z << ':' << z << endl;

#define trace4(x,y,z,w) cout<< '>' << #x << ':' << x \
    << " | " << #y << ':' << y <<" | " << #z << ':' << z << " | " << #w << ':' << w << endl;


inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }

#define LSOne(S) (S&(-S))

const double pi = acos(-1);

int cmp(double x, double y = 0, double tol = EPS) {
    return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

/////////////////////////////////////////////////////////////////////

/*bool sortbysec(const pair<int,int> &a,const pair<int,int> &b)
{
    return (a.second < b.second);
}*/

template<class T> inline T gcd(T a,T b) //NOTES:__gcd(0,0) gives exception
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}



const int MAX_N = 200001;

ll arr[MAX_N];

int main() {
	int N;
	scanf("%d",&N);
	int ans=0;
	map<ll,int> M; 
	for(int i=0;i<N;i++){
		scanf("%lld",arr+i);
		M[arr[i]]++;
	}
	map<ll,int>::iterator it;
	tr(M,it){
		if(it->first<=it->second)
			ans+=it->second-it->first;
		else
			ans+=it->second;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 7040
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = a / 500;
        int c = a % 500 / 5;
        System.out.println(b * 1000 + c * 5);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#define ll long long
#define out(a) printf("%d",a)
#define writeln printf("\n")
using namespace std;
const int N=1e5+50;
int n,m;
int now,ans;
struct node
{
	int x,y;
}a[N];
int read()
{
	int s=0,t=1; char c;
	while (c<'0'||c>'9'){if (c=='-') t=-1; c=getchar();}
	while (c>='0'&&c<='9'){s=s*10+c-'0'; c=getchar();}
	return s*t;
}
ll readl()
{
	ll s=0,t=1; char c;
	while (c<'0'||c>'9'){if (c=='-') t=-1; c=getchar();}
	while (c>='0'&&c<='9'){s=s*10+c-'0'; c=getchar();}
	return s*t;
}
bool cmp(node a,node b)
{
	return a.y==b.y?a.x<b.x:a.y<b.y;
}
int main()
{
	n=read(),m=read(); now=0;
	for (int i=1;i<=m;i++)
	  a[i].x=read(),a[i].y=read();
	sort(a+1,a+m+1,cmp);
	for (int i=1;i<=m;i++)
	  if (now>a[i].x&&now<=a[i].y) continue;
	  else ans++,now=a[i].y;
	out(ans);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define DBG(X) cout<<" "<<#X<<" : "<<X<<endl
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;

const int INF = 1e9;
const double EPS = 1e-8;
const int mod = 1e9 + 7;
const ll LINF = 1e18;

struct Input
{
	int n;char c;char str[1024];string s;ll l;double d;
	int nextInt(){scanf("%d", &n);return n;}
	ll nextLong(){scanf("%lld", &l);return l;}
	double nextDouble(){scanf("%lf", &d);return d;}
	char nextChar(){scanf("%c", &c);return c;}
	string next(){scanf("%s", str);return string(str);}
	string nextLine(){getline(cin, s);return s;}
};
Input in;

double dp[(1<<20) + 10];

int bitcnt(int n){
	int ret = 0;
	while(n > 0) ret += n&1, n>>=1;
	return ret;
}

int main(){
	int n = in.nextInt(), m = in.nextInt();
	vector<double> l, a, b;
	rep(i, n) l.pb(in.nextDouble()), a.pb(in.nextDouble()), b.pb(in.nextDouble());
	double ans = 0.0;
	for(int i = 1; i < (1<<n); i++){
		for(int j = 0; j < n; j++){
			if(i & (1<<j)) continue;
			int nxt = i | (1<<j);
			double tmp = 0.0;
			for(int k = 0; k < n; k++) if(i & (1<<k)){
				tmp += (l[k]-l[j]) * (l[k]-l[j]);
				tmp += (a[k]-a[j]) * (a[k]-a[j]);
				tmp += (b[k]-b[j]) * (b[k]-b[j]);
			}
			dp[nxt] = max(dp[nxt], dp[i] + tmp);
			if(bitcnt(nxt) == m) ans = max(ans, dp[nxt]);
		}
	}
	printf("%.15lf\n", ans);
}

Measured memory_bytes: 11428
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N,P;cin>>N>>P;
  long long a=P;
  long long ans=1;
  for(long long i=2;i*i<=P;i++){
    int n=0;
    for(;P%i==0;P/=i)n++;
    if(n>=N)ans*=pow(i,n/N);
  }
  if(P!=1)if(N==1)ans*=P;
  cout<<ans<<endl;
}

Measured memory_bytes: 3956