akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n;
    cin >> n;
    vector<ll>a(n);
    vector<ll>odd;
    vector<ll>even;
    for(ll i=0;i<n;i++){
        cin >> a[i];
        if(i%2==0) even.push_back(a[i]);
        else odd.push_back(a[i]);
    }
    sort(even.begin(),even.end());
    sort(odd.begin(),odd.end());
    ll ecnt=1,ocnt=1;
    ll er=1,cr=1;
    ll ex=0,ox=0;
    for(ll i=1;i<even.size();i++){
        if(even[i-1]==even[i]){
            er++;
            if(er>ecnt) ex=i;
            ecnt=max(er,ecnt);
            continue;
        }
        er=1;
    }
    for(ll i=0;i<odd.size();i++){
        if(odd[i-1]==odd[i]){
            cr++;
            if(cr>ocnt) ox=i;
            ocnt=max(cr,ocnt);
            continue;
        }
        cr=1;
    }
    if(odd[ox]==even[ex]){
        cr=1,er=1;
        ll ocnt2=0,ecnt2=0;
        for(ll i=1;i<even.size();i++){
            if(even[i-1]==even[i]&&even[i]!=even[ex]){
                er++;
                ecnt2=max(er,ecnt2);
                continue;
            }
            if(even[i-1]==even[i]&&even[ex]==even[i]) continue;
            ecnt2=max(ecnt2,er);
            er=1;
        }
        for(ll i=1;i<odd.size();i++){
            if(odd[i-1]==odd[i]&&odd[i]!=odd[ox]){
                cr++;
                ocnt2=max(cr,ocnt2);
                continue;
            }
            if(odd[i-1]==odd[i]&&odd[i]==odd[ox]) continue;
            ocnt2=max(ocnt2,cr);
            cr=1;
        }
        if(ocnt+ecnt2>ocnt2+ecnt) ecnt=ecnt2;
        else ocnt=ocnt2;
    }
    ll ans=n-ecnt-ocnt;
    cout << ans << endl;
}

Measured memory_bytes: 5108
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    def c(x):
        return 1 <= x <= 9
    if c(a) and c(b):
        print(a * b)
        return
    print(0)
    return

#B
def B():
    a = set()
    for i in range(10):
        for k in range(10):
            a.add(i * k)
    x = II()
    if x in a:
        print("Yes")
    else:
        print("No")
    return

#C
def C():
    n = II()
    factlize = []
    ans = inf
    for i in range(1, int(sqrt(n)) + 1):
        if n % i == 0:
            ans = min(ans, n // i + i - 2)
    print(ans)

    return

#D
def D():
    return

#E
def E():
    def solve(m):
        a1 = a[::-1]
        f1 = f[::1]
        res = 0
        for i in range(n):
            if a1[i] * f1[i] <= m:
                continue
            k = m // f1[i]
            res += a1[i] - k
            if res > K:
                return False
        return True

    n, K = LI()
    a = LI()
    a.sort()
    f = LI()
    f.sort()
    ok = max(a) * max(f)
    ng = -1
    while ok - ng > 1:
        mid = (ok + ng) // 2
        if solve(mid):
            ok = mid
        else:
            ng = mid
    print(ok)
    return

#F
def F():
    return


#Solve
if __name__ == '__main__':
    B()


Measured memory_bytes: 38640
from itertools import product
l = []
for _ in range(3,10):
    tmp = list(product('753', repeat = _))
    l += tmp

m = []
for i in l:
    if len(set(i)) == 3:
       m.append(int(''.join(i)))

n = int(input())
ans = 0
for j in m:
    if j <= n:
        ans += 1

print(ans)

Measured memory_bytes: 8052
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define fi first
#define se second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define debug(val) cerr << "The Value Of " << #val << " is : " << val << '\n';
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll mininf = -922337203685477;
const ll nax = 0;
ll n, tmp=0, k=0;
	
int main(void){
	IOS
	cin >> n;
	while(tmp<n){
		k++;
		tmp+=k;
	}
	cout << k << '\n';
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n,m; cin>>n>>m;
  vector<int> a(n);
  for(int i=0; i<n; ++i) cin>>a[i];
  long double sum=0,res=0;
  for(int i=0; i<n; ++i) sum+=a[i];
  sum/=4*m;
  for(int i=0; i<n; ++i) if(a[i]>=sum) ++res;
  if(res>=m) cout<<"Yes"; else cout<<"No";
  return 0;
}


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

vector<int> tfs = {3, 5, 7};
int ans = 0;

void dfs(int n, int m, int cur, vector<int> used) { //mは現在の数, curはmの桁数
	if (m <= n && used.at(0) > 0 && used.at(1) > 0 && used.at(2) > 0) ans++;
	if (cur < 9) {
		for (int i = 0; i < 3; i++) {
			used.at(i)++;
			dfs(n, 10 * m + tfs.at(i), cur + 1, used);
			used.at(i)--;
		}
	}else return;
}

int main() {
	int n; cin >> n;
	vector<int> used(3, 0);
	dfs(n, 0, 0, used);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

constexpr int MOD = 1000000007;
constexpr int INF = 1LL << 30;
constexpr long long LLINF = 1LL << 62;
constexpr double EPS = 1e-9;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
  }
} initializer;

template<typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec) is >> x;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    if (it != vec.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}

template<typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &pa) {
  return os << "(" << pa.first << ", " << pa.second << ")";
}

template<typename Tuple, size_t N>
struct TuplePrinter {
  static void print(const Tuple &t) {
    TuplePrinter<Tuple, N-1>::print(t);
    cout << ", " << get<N-1>(t);
  }
};

template<typename Tuple>
struct TuplePrinter<Tuple, 1> {
  static void print(const Tuple &t) {
    cout << get<0>(t);
  }
};

template<typename... T>
ostream &operator<<(ostream &os, const tuple<T...> &tup) {
  os << "(";
  TuplePrinter<decltype(tup), sizeof...(T)>::print(tup);
  return os << ")";
}

template<typename T>
ostream &operator<<(ostream &os, const set<T> &se) {
  os << "{";
  for (auto it = se.begin(); it != se.end(); ++it) {
    if (it != se.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}

template<typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &ma) {
  os << "{";
  for (auto it = ma.begin(); it != ma.end(); ++it) {
    if (it != ma.begin()) os << ", ";
    os << it->first << ": " << it->second;
  }
  return os << "}";
}

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }
#define dump(...) cout<<#__VA_ARGS__<<": [L_"<<__LINE__<<"]"<<'\n'; print(__VA_ARGS__);cout<<'\n';

template<class T, class U>inline bool chmax(T &a, const U &b) { if(a<b){ a=b; return 1; } return 0; }
template<class T, class U>inline bool chmin(T &a, const U &b) { if(b<a){ a=b; return 1; } return 0; }


int main() {
  vector<int> dp(10010, INF);
  int h, n; cin>>h>>n;
  vector<int> a(n), b(n);
  rep(i, n) cin>>a[i]>>b[i];
  dp[0] = 0;

  rep(i, 10010) {
    rep(j, n) {
      if (i+a[j] <= h) {
        dp[i+a[j]] = min(dp[i+a[j]], dp[i]+b[j]);
      } else {
        dp[h] = min(dp[h], dp[i]+b[j]);
      }
    }
  }
  print(dp[h]);

  return 0;
}

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

int main() {
string s;
  int64_t ans;
  ans=0;
cin>>s;
  int64_t a=s.size();
vector<char> vec(a);
  for(int64_t i=0;i<a;i++){
  vec.at(i)=s.at(i);
  }
  for(int64_t i=0;i<a;i++){
  if(vec.at(i)=='0'){ans+=0;}
  if(vec.at(i)=='1'){ans+=1;}
  if(vec.at(i)=='2'){ans+=2;}
  if(vec.at(i)=='3'){ans+=3;}
  if(vec.at(i)=='4'){ans+=4;}
  if(vec.at(i)=='5'){ans+=5;}
  if(vec.at(i)=='6'){ans+=6;}
  if(vec.at(i)=='7'){ans+=7;}
  if(vec.at(i)=='8'){ans+=8;}
  if(vec.at(i)=='9'){ans+=9;}
  
  }
  if(ans%9==0){cout<<"Yes"<<endl;
            }
  else{cout<<"No"<<endl;}
}

Measured memory_bytes: 3916
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    long n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        long tmp;
        cin  >> tmp;
        if (tmp % 2 == 0) {
            if (tmp % 3 == 0 || tmp % 5 == 0) {
                continue;
            }
            cout << "DENIED" << endl;
            return 0;
        }
    }
    cout << "APPROVED" << endl;
    return 0;
}


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

struct Mypair {
	int X,L,T,S;
};

bool operator<(const Mypair &l, const Mypair &r){
	return l.T<r.T;
}

signed main(){
	int N; cin>>N;
	vector<Mypair> rob(N);
	for(int i=0;i<N;i++){
		cin>>rob[i].X>>rob[i].L;
		rob[i].T=rob[i].X+rob[i].L;
		rob[i].S=rob[i].X-rob[i].L;
	}
	sort(rob.begin(),rob.end());
	vector<Mypair> ans(0);
	ans.push_back(rob[0]);
	for(int i=1;i<N;i++){
		if(ans[ans.size()-1].T<=rob[i].S){
			ans.push_back(rob[i]);
		}
	}
	cout<<ans.size()<<endl;

}

Measured memory_bytes: 9456
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
using std::swap;

int main()
{	
	int n, k;
	string t;
	string g;
	cin >> n >> k >> t;
	g = t.substr(k - 1,1);
	if (g == "A") {
		g = "a";
		t.replace(k - 1, 1, g);
	}else if (g == "B") {
		g = "b";
		t.replace(k - 1, 1, g);
	}else if (g == "C") {
		g = "c";
		t.replace(k - 1, 1, g);
	}


	cout << t << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#define REP(i,n) for(int i = 0;i < (n);i++)
#define pb push_back
using namespace std;
const int INF = 1e9;
typedef long long ll;

int main(){
  ll n;
  cin >> n;
  ll sum = 0;
  ll a[n+1] = {0};
  REP(i,n){
    ll b;
    
    cin >> b;
    if(b <= n){
      a[b]++;
    }
    else
      sum++;
    
  }
  /*REP(i,n+1){
    cout << a[i] << endl;
    }*/
  
  for(int i = 1;i < n+1;i++){
    if(i < a[i]){
      sum += a[i]-i;
    }
    else if(i > a[i])
      sum += a[i];
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1152
N = int(input())
S = input()

# RGBそれぞれの字数カウント
R = S.count('R')
G = S.count('G')
B = S.count('B')

# 条件２の対象数カウント
ad = R * G * B
ed = 0

for i in range(0, N-1):
  for j in range(i+1, N):
    # 判定
    P = j+(j-i)
    if P < N:
      if S[i] != S[j] and S[j] != S[P] and S[P] != S[i]:
        ed += 1

print(ad-ed)


Measured memory_bytes: 9196
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

func input() string {
	sc.Scan()
	return sc.Text()
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func main() {
	mod := 2019
	left, _ := strconv.Atoi(input())
	right, _ := strconv.Atoi(input())

	right = min(right, left+mod-1)
	n := right - left + 1
	remList := make([]int, n)
	for i := left; i <= right; i++ {
		remList[i-left] = i % mod
	}

	ans := mod - 1
	for i := 0; i < n-1; i++ {
		for j := i + 1; j < n; j++ {
			ans = min(ans, remList[i]*remList[j]%mod)
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 640
import java.util.Scanner;
import java.util.ArrayDeque;
import java.util.Deque;
 
class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int q = scan.nextInt();
        int i = 0;
        int d = 0;
        int limit = 400000;
        MyDeque A = new MyDeque(limit);
        while (i < q) {
            i++;
 
            int Cmd = scan.nextInt();
            switch (Cmd) {
            case 0:
                d = scan.nextInt();
                int x = scan.nextInt();
                push(A, d, x);
                break;
            case 1:
                int p = scan.nextInt();
                randomAccess(A, p);
                break;
            case 2:
                d = scan.nextInt();
                pop(A, d);
                break;
            default:
                break;
            }
        }
    }
 
    private static void push(MyDeque A, int d, int x) {
        if (d == 0) {
            A.addFirst(x);
        } else if (d == 1) {
            A.addLast(x);
        }
    }
    private static void randomAccess(MyDeque A, int p) {
        System.out.println(A.get(p));
    }
    private static void pop(MyDeque A, int d) {
        if (d == 0) {
            A.removeFirst();
        } else if (d == 1) {
            A.removeLast();
        }
    }
}
 
class MyDeque {
    private int size;
    private int first;
    private int last;
    private int data[];
    MyDeque(int limit) {
        data = new int [limit * 2 + 1];
        first = limit;
        last = limit - 1;
        size = 0;
    }
    void addFirst(int x) {
        data[--first] = x;
    }
    void addLast(int x) {
        data[++last] = x;
    }
    int get(int p) {
        return data[first + p];
    }
    void removeFirst() {
        first++;
    }
    void removeLast() {
        last--;
    }
}


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

int n,m,z;
string x,y;

signed main(){
    cin>>n>>m>>x>>y;
    z = n*m/__gcd(n,m);
    map<int,char>M;
    r(i,n)M[(z/n)*i]=x[i];
    r(i,m)if(M.count((z/m)*i)&&M[(z/m)*i]!=y[i]){
        cout<<-1<<endl;
        exit(0);
    }
    cout<<z<<endl;
}

Measured memory_bytes: 6144
#include<iostream>
using namespace std;
int main(){
int n;
cin >>n;
int a[n];
for(int i=0;i<=n;i++){
cin >>a[i];
}
for(int j=n-1;j>=0;j--){
if(j == 0){
cout<<a[0]<<endl;
}else{
cout <<a[j]<<" ";
}
}
}




Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}

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


Measured memory_bytes: 3712
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

typedef pair<ll,const char*> parsed;

parsed expr(const char*);
parsed term(const char*);
parsed fact(const char*);

parsed expr(const char* s)
{
	//cout<<"expr(\""<<s<<"\")"<<endl;
	parsed now=term(s);
	while(*now.second=='+' || *now.second=='-'){
		char op=*now.second;
		parsed next=term(now.second+1);
		if(op=='+')
			now=parsed(now.first+next.first,next.second);
		else
			now=parsed(now.first-next.first,next.second);
	}
	//cout<<"expr(\""<<s<<"\")="<<now.first<<endl;
	return now;
}

parsed term(const char* s)
{
	//cout<<"term(\""<<s<<"\")"<<endl;
	parsed now=fact(s);
	while(*now.second=='*' || *now.second=='/'){
		char op=*now.second;
		parsed next=fact(now.second+1);
		if(op=='*')
			now=parsed(now.first*next.first,next.second);
		else
			now=parsed(now.first/next.first,next.second);
	}
	//cout<<"term(\""<<s<<"\")="<<now.first<<endl;
	return now;
}

parsed fact(const char* s)
{
	//cout<<"fact(\""<<s<<"\")"<<endl;
	//if(s[0]=='('){
	//	parsed res=expr(s+1);
	//	res.second++;
	//	return res;
	//}
	//else{
	//	const char* p=s;
	//	if(*p=='-')
	//		p++;
	//	ll n=0;
	//	while(isdigit(*p)){
	//		n=n*10+*p-'0';
	//		p++;
	//	}
	//	return parsed(n,p);
	//}
	
	if(isdigit(s[0])){
		const char* p=s;
		if(*p=='-')
			p++;
		ll n=0;
		while(isdigit(*p)){
			n=n*10+(*p-'0');
			p++;
		}
		return parsed(n,p);
	}
	else if(s[0]=='('){
	//else{
		parsed res=expr(s+1);
		if (*res.second!=')') exit(0);
		res.second++;
		return res;
	}
	else
		exit(0);
}

//parsed fact(const char *p)
//{
//  if (isdigit(*p)){
//    int t=0;
//    while(isdigit(*p)) t=t*10+*(p++)-'0';
//    return parsed(t,p);
//  }
//  else if (*p=='('){
//    parsed r=expr(p+1);
//    if (*r.second!=')') exit(0); // invalid input
//    return parsed(r.first,r.second+1);
//  }
//  else
//    exit(0); // invalid input
//}

int main()
{
	string s;
	getline(cin,s);
	while(getline(cin,s))
		cout<<expr(s.c_str()).first<<endl;
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n; cin >> n;
	vi v(n); cin >> v;
	vi ev(111111), od(111111);
	REP(i, n)
	{
		if (i % 2 == 0) ev[v[i]]++;
		else od[v[i]]++;
	}
	int e1cnt = 0, e2cnt = 0, e1 = 0, e2 = 0;
	int o1cnt = 0, o2cnt = 0, o1 = 0, o2 = 0;
	REP(i, 111111)
	{
		if (e1cnt < ev[i])
		{
			e2cnt = e1cnt;
			e2 = e1;
			e1cnt = ev[i];
			e1 = i;
		}
		else if (e2cnt < ev[i])
		{
			e2cnt = ev[i];
			e2 = i;
		}
		if (o1cnt < od[i])
		{
			o2cnt = o1cnt;
			o2 = o1;
			o1cnt = od[i];
			o1 = i;
		}
		else if (o2cnt < od[i])
		{
			o2cnt = od[i];
			o2 = i;
		}
	}
	int ans;
	if (e1 != o1) ans = n - e1cnt - o1cnt;
	else ans = n - max(e1cnt + o2cnt, e2cnt + o1cnt);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>


int main(void)
{
	int n, i, j,v;
	int A[100];

	/*???°?????\???*/
	 scanf("%d", &n);
	 for (i = 0; i < n; i++)
	 {
		 scanf("%d", &A[i]);
	 }

	 /**/
	 for (i = 0; i < n; i++)
	 {
		 v = A[i];
		 j = i - 1;

		 while (j >= 0 && A[j] > v)
		 {
			 A[j + 1] = A[j];
			 j--;
		 }
		 A[j + 1] = v;

		 for (j = 0; j < n; j++)
		 {
			 if (j != 0)
			 {
				 printf(" ");
			 }

			 printf("%d", A[j]);
		 }

		 printf("\n");
	 }
			

		
		return 0;
}

Measured memory_bytes: 1804
import java.util.*; 
 
class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        
  		int[] a=new int[9];
		for(int c=0;c<n;c++){
    		int b=sc.nextInt();
          if(b<3200){
            a[b/400]++;
          }else{
          	a[8]++;
          }
    	}
        int ans=0;
  		for(int d=0;d<8;d++){
        	if(a[d]>0){
            ans++;
            }
        }
    
 	
    		System.out.println(Math.max(ans,1));
     		System.out.println(ans+a[8]);
        
   
 
    }
}

Measured memory_bytes: 35808
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int N,A,B;
    cin >> N >> A >> B;
    if ((B - A) % 2 == 1) cout << "Borys" << endl;
    else cout << "Alice" << endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,x) for(int i=0;i<x; i++)
typedef long long  ll;
using namespace std;
int main(){
	string S;
  cin>>S;
  if(S[3]==S[2] && S[4]==S[5]){
  	cout<<"Yes";
  }else{
  	cout<<"No";
  }
}


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

int main() {
  string a,b,c;
  cin >> a >> b >> c;
  int asize=a.size(),bsize=b.size(),csize=c.size();
  int acnt=0,bcnt=0,ccnt=0;
  char now = 'a';
  
  while(true){
    if(now == 'a'){
      if(acnt == asize){
        cout << "A" << endl;
        break;
      }else{
        now = a[acnt];
        acnt++;
      }
    }else if(now == 'b'){
      if(bcnt == bsize){
        cout << "B" << endl;
        break;
      }else{
        now = b[bcnt];
        bcnt++;
      }
    }else if(now == 'c'){
      if(ccnt == csize){
        cout << "C" << endl;
        break;
      }else{
        now = c[ccnt];
        ccnt++;
      }        
    }
  }
  
  return(0);
}

Measured memory_bytes: 3612
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	//n := stdin.Text()
	stdin.Scan()
	s := stdin.Text()
	stdin.Scan()
	//q := stdin.Text()
	stdin.Scan()
	t := stdin.Text()

	cnt := 0
	for _, tv := range strings.Split(t, " ") {
		for _, sv := range strings.Split(s, " ") {
			if tv == sv {
				cnt++
				break
			}
		}
	}
	fmt.Println(cnt)

}



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

using namespace std;

int n;
int x[200000];

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

    int last = 0;
    bool ng = false;
    long long ans = 0;
    for (int i = n - 1; i >= 0; i--) {
        if (x[i] == max(last - 1, 0)) {
            //cout << i << "  - " << last <<  endl;
        } else if (x[i] > last - 1) {
            //cout << i << " " << x[i] << " las " << last << endl;
            ans += x[i];
            if (x[i] > i) ng = true;
        } else ng = true;
        last = x[i];
    }

    if (ng) ans = -1;
    cout << ans << endl;
}

Measured memory_bytes: 1152
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

int main(){
  int D, N;
  cin >> D >> N;
  cout << (ll)pow(100, D) * (N + N/100) << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace ABC140_C
{
    class Program
    {
        static void Main(string[] args) {
            int n = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split();

            List<long> bList = new List<long>();
            for (long i = 0; i < n - 1; i++) {
                bList.Add(long.Parse(input[i]));
            }

            long ans = bList[0];

            for(int i = 1; i < n - 1; i++) {
                //ans += bList[i];

                if (bList[i] > bList[i - 1]) {
                    ans += bList[i - 1];
                } else {
                    ans += bList[i];
                }
            }

            ans += bList[n - 2];

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13140
import java.util.Scanner;

public class Main{
	
	public void solve(){
		Scanner sc = new Scanner(System.in);
		
		int x =sc.nextInt();
		
		x=(x*x*x);
		
		System.out.println(x);
	}
	
	public static void main(String[]args){
		Main obj = new Main();
		obj.solve();
	}
}

Measured memory_bytes: 17156
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

map<ll,ll> m;

ll N;

int main(){
  COMinit();
  ll M,C[51];
  cin >> N >> M;
  ll T = M;
  Rep(i,2,sqrt(T)+1){
    while(M%i==0){
      M/=i;
      m[i]++;
    }
  }
  if(M>1){
    m[M]++;
  }
  ll ans = 1;
  for(auto P : m){
    if(P.sc>0){
      ans*=COM(N-1+P.sc,N-1);
      ans%=MOD;
    }
  }
  cout << ans%MOD << endl;
}

Measured memory_bytes: 12160
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    min_a = 10**6
    ret = 0
    for i in range(N):
        if A[i] < min_a:
            ret += 1
            min_a = A[i]
            
    print(ret)
    
solve()

Measured memory_bytes: 24744
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N; cin>>N;
	rp(i,1,10){
		rp(j,1,10){
			if(i*j == N){
				ote("Yes");
				return 0;
			}
		}
	}
	ote("No");
}


Measured memory_bytes: 256
n=int(input())
a=[]
xy=[]
for i in range(n):
  a.append(int(input()))
  xy.append([list(map(int,input().split())) for _ in range(a[-1])])

# bfs,dfs ?->try dfs
def dfs(seen_,i):#iの人が正直者だと仮定する。i=0,1,2,...,n-1
  seen=seen_.copy()
  seen[i]=1 # -1:未定、1:正直者、0:不親切
  todo=[]
  todo.append(i)
  while len(todo)>0:
    b=todo.pop()
    if seen[b]==1:
      l=xy[b]
      for li in l:
        if seen[li[0]-1]==-1:
          seen[li[0]-1]=li[1]
          if li[1]==1:
            todo.append(li[0]-1)
        elif seen[li[0]-1]!=li[1]:
          seen_[i]=0
          return seen_
  return seen

ans=0
for i in range(n):
  seen=[-1]*n
  seen[i]=1
  seen=dfs(seen,i)
  #print(i,seen)
  while seen.count(-1)>0:
    j=[k for k,v in enumerate(seen) if v==-1][0]
    seen=dfs(seen,j)
  ans=max(ans,seen.count(1))
print(ans)


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

using namespace std;
using ll = long long;

template<class T>
int compress(vector<T>& ar) {
    map<T,int> Map;
    int cur = 0;
    for(auto i : ar)Map[i] = -1;
    for(auto &i:Map)i.second = cur++;
    for(auto &i: ar)i = Map[i];
    return cur;
}

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++)cin >> a[i];
    compress(a);
    int cnt = 0;
    for(int i = 0; i < n; i++) {
        if(a[i] % 2 != i % 2)cnt++;
    }
    if(cnt % 2 == 1) {
        return 1;
    }
    cout << cnt / 2 << endl;
}

Measured memory_bytes: 8216
#include<stdio.h>
#define N 100
int G[N][N];
int main(){
  int i,j,n,u,k,in;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<n;j++){
      G[u-1][j]=0;
    }
    if(k!=0){
	for(j=0;j<k;j++){
	  scanf("%d",&in);
	  G[u-1][in-1]=1;
	}
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      printf("%d",G[i][j]);
      if(j!=n-1) printf(" ");
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mxn= 5e5+5;
#define mod 1000000007
#define endl '\n'
void rishabh(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
int main(){
    string str;
    cin>>str;
    set<char> s;
    for(auto x: str){
        if(s.count(x)){
            cout<<"no";
            return 0;
        }
        s.insert(x);
    }
    cout<<"yes";
}



Measured memory_bytes: 3600
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

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


int main(){
    
    ll n,m;
    cin >> n >> m;
    pair<ll,ll> p[n];
    rep(i,0,n){
	cin >> p[i].ft >> p[i].sd;
    }
    sort(p,p+n);
    ll ans = 0;
    rep(i,0,n){
	//	PS(p[i].ft);P(p[i].sd);
	m -= p[i].sd;
	ans += p[i].ft * p[i].sd;
	if(m <= 0){
	    ans += p[i].ft * m;
	    break;
	}
    }
    P(ans);
	
    return  0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
ll read()
{
	ll x=0,f=1;char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=-1;
	for(;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x*f;
}
ll a,b,c,k;
int main()
{
	a=read();b=read();c=read();k=read();
	if(k&1) printf("%lld",b-a);
	else printf("%lld",a-b);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
  int n,d,x;
  cin >> n >> d >> x;
  int a[n];
  for(int i=0;i<n;i++) cin >> a[i];
  
  int ans[n];
  for(int i=0;i<n;i++){
    for(int j=0;j*a[i]+1<d+1;j++){
      ans[i] =j+1;
    }
  }
  
  int sum;
  for(int i=0;i<n;i++) sum=sum+ans[i];
  cout << sum+x << endl;
  return 0;
} 

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

 int main(){
 int N;
 double ans = 0.0, A;
 cin >> N;
 for(int i = 1; i <= N; ++i){
 cin >> A;
 ans += 1.0 / A;
 }
 ans = 1.0 / ans;
 cout << setprecision(16) << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main(){
    int N=0,A=0;
    cin >> N >> A;
    while(N>499){
        N-=500;
    }
    if(N-A<1){
        cout << "Yes";
    }
    else{
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using PP = pair<long, long>;
long n, d, a;
set<PP> st;
int main() {
  cin >> n >> d >> a;
  for (int i = 0; i < n; ++i) {
    int x, h;
    cin >> x >> h;
    h = (h + a - 1) / a;
    st.insert(PP(x, -h));
  }
  
  long sum = 0;
  long cnt = 0;
  for (auto it = st.begin(); it != st.end(); ++it) {
    PP p = *it;
    long x = p.first;
    long k = p.second;
    if (k < 0) {
      long h = -k;
      long at = h - cnt;
      if (at > 0) {
        sum += at;
        cnt += at;
        st.insert(PP(x + 2 * d, at));
      }
    } else {
      int at = k;
      cnt -= at;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 25216
#include<stdio.h>
int main(){

	int x,y,i;

    for (i = 1; ; i++) {

    scanf("%d %d", &x,&y); 

if (x == 0 && y == 0) break; 

	if(x<y){

	printf("%d %d\n",x,y);

	} else{

		printf("%d %d\n",y,x);

	}

  } 

	return 0;

}

Measured memory_bytes: 600
#include <stdio.h>
#include <string.h>
int main(){
  int i;
  char c1[11],c2[50],count=0;
  scanf("%s",c1);
  for(i=0;i<strlen(c1);i++){
   c1[i]=tolower(c1[i]);
  }
  while(scanf("%s",c2)!=EOF){
    for(i=0;i<strlen(c2);i++){
      c2[i]=tolower(c2[i]);
    }
   /* printf("%s|%s\n",c2,c1); */
    /* for(i=0;i<strlen(c1);i++) */
    /*   if(c1[i]!=c2[i]) break; */
    /* if(i==strlen(c1))count++;     */
    if(strcmp(c1,c2)==0) count++;
  }
  printf("%d\n",count);
  return 0;
}

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




int main(void){
   int N; 
   cin>>N;
   vector<int> v(N);
   for(int i=0;i<N;i++){
      cin>>v[i];
   }
   int a=0;
   int minn=1e9;
   for(int i=0;i<N;i++){
minn=min(minn,v[i]);
if(minn==v[i]){
   a++;
}
   }
   cout<<a<<endl;
 return 0;
}




Measured memory_bytes: 4008
/*
            _ _  ___            __ _ _  _       _     
 _   _  ___| | |/ _ \__      __/ _| | || |  ___| |__  
| | | |/ _ \ | | | | \ \ /\ / / |_| | || |_/ __| '_ \ 
| |_| |  __/ | | |_| |\ V  V /|  _| |__   _\__ \ | | |
 \__, |\___|_|_|\___/  \_/\_/ |_| |_|  |_| |___/_| |_|
 |___/                 

 */

#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
#define MOD 1000000007
#define INF 1000000000000000007
#define MAXN 300005


signed main(){
	fast
	string s;
	cin>>s;
	vector<int> v;
	char temp = s[0];
	int count=1;
	For(i, 1, s.size()){
		if(s[i]==temp){
			v.pb(count);
			count=1;
			temp = s[i];
		}else{
			count++;
			temp = s[i];
		}
	}
	v.pb(count);

	// For(i, 0, v.size()){
	// 	cout<<v[i]<<" ";
	// }
	// cout<<endl;
	int a=0, b=0;
	For(i, 0, v.size()){
		if(i%2==0){
			a+=v[i];
		}else{
			b+=v[i];
		}
	}

	if(a<b){
		cout<<a<<endl;
	}else{
		cout<<b<<endl;
	}
    return 0;
}
    



Measured memory_bytes: 1480
def main():
    s = input()
    mod = 13
    p = 10 ** 9 + 7
    dp = [0] * mod
    dp[0] = 1

    for i, ss in enumerate(s):
        tmp = [0] * mod
        if ss == "?":
            for j in range(10):
                for k in range(mod):
                    d = (10 * k + j) % mod
                    tmp[d] += dp[k]
                    tmp[d] %= p
        else:
            for k in range(mod):
                d = (10 * k + int(ss)) % mod
                tmp[d] += dp[k]
        dp = tmp
    print(dp[5])
if __name__ == '__main__':
    main()


Measured memory_bytes: 43244
#include<iostream>
#include<string.h>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack> 
#define  ll long long
using namespace std;
int a[100005],b[100005];
int main()
{
int n,m,sum1=0;
cin>>n;
for(int i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
cin>>m;
for(int i=0;i<m;i++)
{
	cin>>b[i];
}
sort(b,b+m);
for(int i=0;i<m;i++)
{
	for(int j=0;j<n;j++)
	{
		if(b[i]==a[j])
		{
			sum1++;
		break;
	}
	else if(b[i]<a[j])
	{
		break;
	}
	}
}
cout<<sum1<<"\n";
return 0;
}


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

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

int N, M;
char field[3005][3005];
ll ans;

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

	cin >> N >> M;

	for (int i = 0;i < N;i++){
		for (int j = 0;j < M;j++){
			cin >> field[i][j];
		}
	}

	ans = 0;

	for (int si = 1;si <= N+M-3;si++){
		int i,j;
		if(si <= N-1){
			i = si; j = 0;
		} else {
			i = N-1; j = si-(N-1);
		}

		ll dp[3005][2][2]; memset(dp, 0, sizeof(dp));
		int idx = 0;

		while(i >= 0 && j < M){
			for (int k = 0;k < 2;k++){
				for (int l = 0;l < 2;l++){
					if(idx == 0 && !(k == 0 && l == 0)) continue;
					if(l == 1 && k == 1) continue;
					dp[idx+1][0][0] = max(dp[idx+1][0][0], dp[idx][k][l]);
					if(field[i][j] != 'G') continue;
					if(i-1 >= 0 && i+1 < N && field[i-1][j] == 'R' && field[i+1][j] == 'W' && l == 0){
						dp[idx+1][1][0] = max(dp[idx+1][1][0], dp[idx][k][l] + 1);
					}
					if(j-1 >= 0 && j+1 < M && field[i][j-1] == 'R' && field[i][j+1] == 'W' && k == 0){
						dp[idx+1][0][1] = max(dp[idx+1][0][1], dp[idx][k][l] + 1);
					}
				}
			}
			i--; j++;
			idx++;
		}

		ll MAX = -1;;
		for (int k = 0;k < 2;k++){
			for (int l = 0;l < 2;l++){
				MAX = max(MAX, dp[idx][k][l]);
			}
		}

		ans += MAX;
	}

	cout << ans << endl;

	return 0;

}



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

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L

#define long long long int

using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n - 1);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    for (int i = 0; i < n - 1; i++) cin >> c[i];
    long s = 0;
    for (int i = 0; i < n; i++) {
        s += b[a[i] - 1];
    }
    for (int i = 0; i < n - 1; i++) {
        if (a[i + 1] == a[i] + 1) {
            s += c[a[i] - 1];
        }
    }
    cout << s;
    return 0;
}

Measured memory_bytes: 256
#! /usr/bin/env python3

n = int(input())
a = [int(i) for i in input().split()]

sorted_a = sorted(a)

ai = sorted_a[n-1]

goal = ai / 2

min_dist = ai * 2
aj = ai

for i in range(n-1):
    dist = abs(sorted_a[i] - goal)
    if dist < min_dist:
        min_dist = dist
        aj = sorted_a[i]

print(ai, aj)


Measured memory_bytes: 14052
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define FOR(i, n, m) for (int i = m; i < n; i++)
#define MM(i, n, m) for (int i = m; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;

/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
 * pair<型, 型> 変数名
 * map<型, 型> 変数名  // 連想配列
 * priority_queue<型> 変数名  // 最大値から出てくるヒープ
*/
int main()
{
    int N;
    cin >> N;
    bool flag = true;
    REP(i, N)
    {
        int A;
        cin >> A;
        if(A % 2 == 0) {
            if(A % 3 != 0 && A % 5 != 0) {
                flag = false;
            }
        }
    }
    cout << (flag ? "APPROVED" : "DENIED") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int64_t seg[800015],mod=998244353;
vector<pair<int,int>> khoang;
void sett(int l,int r,int id){
	seg[id]=0;
	if (l==r) return;
	int mid=l+(r-l)/2;
	sett(l,mid,id*2);
	sett(mid+1,r,id*2+1);
}
int64_t gett(int l,int r,int curl,int curr,int id){
	if (l>curr||curl>r||l>r) return 0;
	if (curl>=l&&curr<=r) return seg[id];
	int mid=curl+(curr-curl)/2;
	return (gett(l,r,curl,mid,id*2)+gett(l,r,mid+1,curr,id*2+1))%mod;
}
void update(int p,int64_t val,int l,int r,int id){
	if (p<l||p>r) return;
	seg[id]=(seg[id]+val)%mod;
	int mid=l+(r-l)/2;
	if (l!=r) {
		update(p,val,l,mid,id*2);
		update(p,val,mid+1,r,id*2+1);
	}
}
int main (){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,k;
	cin>>n>>k;
	sett(1,n,1);
	int64_t dp[n+1];
	for (int i=0;i<=n;i++) dp[i]=0;
	for (int i=0;i<k;i++){
		int a,b;
		cin>>a>>b;
		khoang.push_back(make_pair(a,b));
	}
	dp[1]=1;
	update(1,1,1,n,1);
	for (int i=2;i<=n;i++){
		int64_t tmp=0;
		for (int j=0;j<k;j++){
			int l=max(1,i-khoang[j].second),r=max(0,i-khoang[j].first);
			tmp=(tmp+gett(l,r,1,n,1))%mod;
		}
		dp[i]=tmp;
		update(i,tmp,1,n,1);
	}
	cout<<dp[n];
}

Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
 
int n,t;
int max1=0, sum = 0;
 
int main()
{	
	cin >> n;
 
	for (int i = 0; i < n; i++)
	{
		cin >> t;
		if(max1 < t)
			max1 = t;
		sum += t;
	}
 
	if(sum-max1 > max1)
		cout << "Yes" << '\n';
	else
		cout << "No" << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
    int r,s=0,c;
    for(;!isdigit(c=getchar());s=c);
    for(r=c^48;isdigit(c=getchar());(r*=10)+=c^48);
    return s^45?r:-r;
}
const int N=110000;
int n;
int a[N];
map<int,int> mp;
int ans;
int main()
{
    n=read();
    for(int i=1;i<=n;i++)
        a[i]=read(),mp[a[i]]++;
    for(int i=1;i<=n;i++)
        if(a[i]!=mp[a[i]])
        {
        	if(a[i]<mp[a[i]])
        		ans+=mp[a[i]]-a[i],mp[a[i]]=a[i];
        	else
        		ans+=mp[a[i]],mp[a[i]]=0;
		}
    printf("%d\n",ans);
    return 0;
}

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

int main(){
    int n,m;
    int s[3];
    cin  >> n >> m;
    int t1,t2;
    s[0]=-1;
    s[1]=-1;
    s[2]=-1;
    bool flag = 0;
    for(int i=0;i<m;i++){
        cin >> t1 >> t2;
        if(s[t1-1] == -1)s[t1-1] = t2;
        else if(s[t1-1] != t2)flag = 1;
    }

    if(n == 1){
        if(s[1] != -1 || s[2] != -1)flag = 1;
        if(flag){
            cout << -1 << endl;
            return 0;
        }
        if(s[0] == -1)s[0] = 0;
        cout << s[0] <<endl;
        return 0;
    }

    if(n == 2){
        if(s[2] != -1 || s[0] == 0)flag = 1;
        if(s[0] == -1)s[0]=1;
        if(s[1] == -1)s[1]=0;
        
        if(flag){
            cout << -1 << endl;
            return 0;
        }
        cout << s[0]*10+s[1] << endl;
        return 0;
    }

    if(n == 3){
        if(s[0] == 0)flag=1;
        if(flag){
            cout <<-1 << endl;
            return 0;
        }
            if(s[0] == -1)s[0]=1;
            if(s[1] == -1)s[1]=0;
            if(s[2] == -1)s[2]=0;
            cout << s[0]*100+s[1]*10+s[2] <<endl;
            return 0;
    }
       
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
using ll = long long;

using namespace std;
int main(){
	string S;
	vector<ll>Term;
	vector<int>cutIndex;
	set<ll> count;
	ll allsum= 0;
	cin >> S;
	int len = S.size();
	for (int tmp = 0; tmp < (1 << len); tmp++) {
		bitset<9>bit(tmp);
		string cutstr = S;
		//ビットの1に対応する場所に反応
		//ll sum = 0;
		Term.clear();
		cutIndex.clear();
		rep(i, len-1) {
			if (bit.test(i)) {
				allsum += stoll(cutstr.substr(len - 1 - i));
				cutstr.erase(len - 1 - i);
			}
		}
		allsum += stoll(cutstr);
		//count.insert(sum);	}
	//for (auto n : count) {
	//	allsum += n;
	}
	cout << allsum/2 << endl;
}


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

using namespace std;

vector<int> ans;

int main(){
	while(1){
		map<int,int> day;
		for(int i = 1;i <= 100;i++){
			day[i] = 0;
		}
		int n,q;
		cin >> n >> q;
		if(n + q == 0)break;
		int meeting = 0;
		for(int i = 0;i < n;i++){
			int days;
			cin >> days;
			for(int j = 0;j < days;j++){
				int okd;
				cin >> okd;
				day[okd]++;
			}
		}
		int numm=0;
		for(int i = 100;i >= 1;i--){
			if(day[i] >= q && day[i] >= numm){meeting = i;numm = day[i];}
		}
		ans.push_back(meeting);
	}
	for(int i = 0;i < ans.size();i++) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 3052