akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,v.size())
#define all(v)(v).begin(),(v).end()
#define bit(n)(1ll<<(n))
#define uniq(v)sort(all(v));v.erase(unique(all(v)),v.end())
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&){}template<class T,class...U>void _print(ostream&s,T&&t,U&&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(T&&...t){_print(cout,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#else
template<class...T>void dprint(T&&...t){_print(cerr,t...);}
#endif
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>ostream&operator<<(ostream&o,const multiset<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n;
    cin>>n;
    vp b(n);
    cin>>b;
    map<P,int> c;
    REP(i,n){
        REP(j,i+1,n){
            P a={b[j].F-b[i].F, b[j].S-b[i].S};
            if(a<P(0,0))a={-a.F, -a.S};
            c[a]++;
        }
    }
    int ma=0;
    for(const auto&p:c){
        dprint(p.F,':',p.S);
        chmax(ma,p.S);
    }
    cout<<n-ma<<endl;
    return 0;
}


Measured memory_bytes: 384
def run_length_compress(string):
    """文字列をランレングス圧縮する
    例) string = "aabccaaabb" -> [(2, a), (1, b), (2, c), (3, a), (2, b)]
    """
    string.append(-1) # string中に絶対に現れない文字を番兵とする
    n = len(string)

    begin = 0
    end = 1
    cnt = 1
    ans = []
    while True:
        if end >= n:
            break
        if string[begin] == string[end]:
            end += 1
            cnt += 1
        else:
            ans.append((cnt, string[begin]))
            begin = end
            end = begin + 1
            cnt = 1

    return ans
  
n = int(input())
v = list(map(int, input().split()))
even = []
odd = []

for i in range(n):
    if i % 2 == 0:
        even.append(v[i])
    else:
        odd.append(v[i])
memo_o = {}
for num in odd:
    if num not in memo_o:
        memo_o[num] = 1
    else:
        memo_o[num] += 1

even = sorted(even)
even = run_length_compress(even)
even = sorted(even, reverse = True)
ans = 10 ** 9
for i in memo_o:
    tmp = n // 2 - memo_o[i]
    tmp2 = n // 2
    for cnt, num in even[:2]:
        if i != num:
            tmp2 = min(n // 2 - cnt, tmp2)
    ans = min(ans, tmp + tmp2)
print(ans)



Measured memory_bytes: 59244
#include<iostream>
#include<cstdint>

int64_t const MOD = 1e9+7;

int64_t const MAXRC = 1e6;
int const MAXN = (MAXRC+1)*2;

int64_t inv[MAXN+1];
int64_t fact[MAXN+1];
int64_t ifact[MAXN+1];

void init(int n) {
  fact[0] = ifact[0] = fact[1] = ifact[1] = inv[1] = 1;
  for(int64_t i = 2; i <= n; ++i) {
    fact[i] = fact[i-1]*i%MOD;
    inv[i] = (MOD/i)*(MOD - inv[MOD%i])%MOD;
    ifact[i] = ifact[i-1]*inv[i]%MOD;
  }
}

int64_t f(int r, int c) {
  int64_t res = fact[r+c+2]*ifact[r+1]%MOD;
  (res *= ifact[c+1]) %= MOD;
  (res += MOD-1) %= MOD;
  return res;
}

int main() {
  int r1, c1, r2, c2;
  std::cin >> r1 >> c1 >> r2 >> c2; --r1; --c1;
  init(r2+c2+2);
  int64_t ans = (f(r2, c2) + f(r1, c1))%MOD, mi = (f(r1, c2) + f(r2, c1))%MOD;
  (ans += MOD - mi) %= MOD;
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 47104
import java.util.*;

public class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    String S=sc.next();
    String T=sc.next();
    int cnt=0;
    for(int i=0;i<S.length();i++)
      if(S.charAt(i)!=T.charAt(i))
        cnt++;
    System.out.println(cnt);
  }
}

Measured memory_bytes: 40628
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::io::Read;
use std::io::{stdout, BufWriter, Write};
 
fn main() {
    let mut buf = String::new();
    
    let out = stdout();
    let mut out = BufWriter::new(out.lock());
 
    // 標準入力から全部bufに読み込む
    std::io::stdin().read_to_string(&mut buf).unwrap();
 
    // 読み込んだStringを空白で分解する
    let mut iter = buf.split_whitespace();
 
    /*
    let n: u32 = iter.next().unwrap().parse().unwrap();
    let a: i64 = iter.next().unwrap().parse().unwrap();
    let b: i64 = iter.next().unwrap().parse().unwrap();
    let c: i64 = iter.next().unwrap().parse().unwrap();
    */
    
    let s: String = iter.next().unwrap().parse().unwrap();
    let s = s.into_bytes();
    
    let mut cnt = 1;
    let mut flg = false;
    
    //let mut s1cnt = 1;
    //let mut s2cnt = 1;
    
    let s1 = s[0];
    let mut s2 = s[0];
    
    for i in 1..4 {
        let a = s[i];
        //println!("{}, {}",a, cnt);
        if a != s1 && a != s2 {
            if s1 == s2 { // hajimedake
                //println!("s2 change");
                s2 = a;
            }
            else{
                //println!("flg change");
                flg = true;
                break;
            }
        }
        if a == s1{
            cnt += 1;
        }else if a == s2{
            cnt -= 1;
        }
    }
    if cnt != 0 {
        flg = true;
    }
    
    //println!("{:?}",s);
    
    if flg == true {
        println!("No");
    }else{
        println!("Yes");
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#else
#define dbg(...) {}
#endif

int main(){
  vector<int> v(4,0);
  rep(i,3){
    int x,y;
    cin>>x>>y;
    x--;y--;
    v[x]++;v[y]++;
  }
  sort(all(v));
  vector<int> u = {1,1,2,2};

  cout << (v==u ? "YES" : "NO") << endl;
  return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++) 
#define ll long long
#define ld long double
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)  

int main()
{
  ll n,k;
  cin >> n >> k;
  ll tmp = n % k;
  ll ans = n > tmp ? tmp : n;
  ll ans2 = (k - ans > ans) ? ans : (k - ans);
  cout << fixed << ans2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int dp[101][4][4][4];
int mod=1000000007;
int N;
int main() {
	cin>>N;
	dp[0][3][3][3]=1;
	for(int len=0;len<N;len++){
//		cout<<"len="<<len<<endl;
		for(int a=0;a<4;a++)for(int b=0;b<4;b++)for(int c=0;c<4;c++){
			if(dp[len][a][b][c]==0)continue;
			if(a==0&&b==1&&c==2)continue;
			if(a==1&&b==0&&c==2)continue;
			if(a==0&&b==2&&c==1)continue;
			for(int d=0;d<4;d++){
				if(b==0&&c==1&&d==2)continue;
				if(b==1&&c==0&&d==2)continue;
				if(b==0&&c==2&&d==1)continue;
				if(a==0&&c==1&&d==2)continue;
				if(a==0&&b==1&&d==2)continue;
//				cout<<len<<":"<<a<<":"<<b<<":"<<c<<":"<<d<<endl;
				dp[len+1][b][c][d] += dp[len][a][b][c];
				dp[len+1][b][c][d] %= mod;
			}
		}
	}
	int ans=0;
	for(int a=0;a<4;a++)for(int b=0;b<4;b++)for(int c=0;c<4;c++){
		ans += dp[N][a][b][c];
		ans %= mod;
	}
	cout<<ans;
	return 0;
}

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

using namespace std;

struct M{
  string s;
  string::iterator it;

  void init(const string &str){
    s = str;
    it = s.begin();
  }

  int fact(){
    int res = 0;
    while(isdigit(*it)){
      res *= 10;
      res += *it-'0';
      ++it;
    }
    return res;
  }  

  int exp(){
    int res = term();
    while(*it == '+'){
      ++it;
      res += term();

    }
    return res;
  }

  int term(){
    int res = fact();
    while(*it == '*'){
      ++it;
      res *= fact();
    }
    return res;
  }
};

struct L{
  string s;
  string::iterator it;

  void init(const string &str){
    s = str;
    it = s.begin();
  }

  int fact(){
    int res = 0;
    while(isdigit(*it)){
      res *= 10;
      res += *it-'0';
      ++it;
    }
    return res;
  }  

  int calc(){
    int res = fact();
    while(*it == '+' || *it == '*'){
      if(*it == '+'){
        ++it;
        res += exp();
      }else{
        ++it;
        res *= term();
      }
    }
    return res;
  }

  int exp(){
    int res = fact();
    while(*it == '+'){
      ++it;
      res += fact();
    }
    return res;
  }

  int term(){
    int res = fact();
    while(*it == '*'){
      ++it;
      res *= fact();
    }
    return res;
  }
};

int main(){
  int ans;
  string s;
  cin >> s >> ans; 
  M m; m.init(s); 
  L l; l.init(s);
  int Mres = m.exp(), Lres = l.calc();

  if(Mres == ans && Lres != ans){
    cout << 'M' << endl;
  }else if(Mres != ans && Lres == ans){
    cout << 'L' << endl;
  }else if(Mres == ans && Lres == ans){
    cout << 'U' << endl;
  }else{
    cout << 'I' << endl;
  }
  return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n , m , a[N] , b[N];

bool check(int v) {
    //cout << v << endl;
    for (int i = 1 ; i <= m ; ++ i) {
        b[i] = (a[i] > v);
    }
    if (b[n] == b[n - 1] || b[n] == b[n + 1]) {
        return b[n];
    } else {
        int w = b[n];
        for (int i = 1 ; i <= m ; ++ i) {
            b[i] ^= w;
        }
        int l = n;
        while (l > 1 && b[l] != b[l - 1]) {
            -- l;
        }
        int r = n;
        while (r < m && b[r] != b[r + 1]) {
            ++ r;
        }
        if (l <= 1 && r >= m) {
            return ((n + 1) & 1) ^ w;
        } else {
            if (n - l < r - n) {
                return b[l] ^ w;
            } else {
                return b[r] ^ w;
            }
        }
    }
}

int main() {
    scanf("%d" , &n);
    m = n + n - 1;
    for (int i = 1 ; i <= m ; ++ i) {
        scanf("%d" , &a[i]);
    }
    int l = 1 , r = m;
    /*for (int i = 1 ; i <= m ; ++ i) {
        cout << i << ' ' << check(i) << endl;
        }*/
    while (l < r) {
        int v = l + r >> 1;
        if (!check(v)) {
            r = v;
        } else {
            l = v + 1;
        }
    }
    cout << r << endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;

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

        int N = scanner.nextInt();

        int A = scanner.nextInt();
        int B;

        for(int i=0; i<N-1; i++){
            B = scanner.nextInt();
            A = gcd(A, B);
        }

        System.out.println(A);

    }

    private static int gcd(int A, int B){

        if(A < B){
            int C = A;
            A = B;
            B = C;
        }

        if(B == 0){
            return A;
        }

        return gcd(B, A%B);
    }
}


Measured memory_bytes: 50104
#include <iostream>

int main(int argc, char** argv)
{
    int a, b;
    std::cin >> a >> b;
    int prod = a * b;
    bool is_odd = (prod %2 != 0);
    std::string is_odd_str = is_odd ? "Odd" : "Even";
    std::cout << is_odd_str << std::endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#pragma warning(disable : 4996)
int a1, m1, a2, m2, a3, m3;
int gcd(int x, int y) {
	if (x == 0) return y;
	if (y == 0) return x;
	if (x > y) return gcd(y, x % y);
	return gcd(x, y % x);
}
long long lcm(long long x, long long y) {
	return 1LL * x / gcd(x, y) * y;
}
long long lcm(int a, int b, int c) {
	return lcm(lcm(a, b), lcm(a, c));
}
int solve(int x, int m) {
	int ret = 1, s = x;
	while (s != 1) s = s * x % m, ret++;
	return ret;
}
int main() {
	while (true) {
		scanf("%d%d%d%d%d%d", &a1, &m1, &a2, &m2, &a3, &m3);
		if (!a1 && !m1 && !a2 && !m2 && !a3 && !m3) break;
		printf("%lld\n", lcm(solve(a1, m1), solve(a2, m2), solve(a3, m3)));
	}
	return 0;
}

Measured memory_bytes: 2700
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>
#include <string>
#include <sstream>
#include <cctype>
using namespace std;


int main(){
  int A, B; cin >> A >> B;
  cout << (A + B) % 24 << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    int N; cin >> N;

    bool ans = false;
    if ((N%10)*100+((N/10)%10)*10+N/100 == N) {
        ans = true;
    }

    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vout(v) VOUT(v,z);
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
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;
}


void solve(std::string S, std::string T, long long A, long long B, std::string U){
    map<string,int> m;
    m[S]=A;
    m[T]=B;
    m[U]--;
    cout << m[S] << " " << m[T] << endl;
}

int main(){
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    std::string U;
    std::cin >> U;
    solve(S, T, A, B, U);
    return 0;
}


Measured memory_bytes: 256
import bisect

n = int(input())
l = sorted(list(map(int, input().split())))
count = 0
for b in range(n-2):
  for c in range(b+1, n-1):
    count += max(0, bisect.bisect_left(l, l[b]+l[c])-c-1)

print(count)


Measured memory_bytes: 3316
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


s = S()
n = 1
a = ab = abc = 0
for i in s:
    if i == 'A':
        a = (a + n) % mod
    elif i == 'B':
        ab = (ab + a) % mod
    elif i == 'C':
        abc = (abc + ab) % mod
    else:
        abc = (abc * 3 + ab) % mod
        ab = (ab * 3 + a) % mod
        a = (a * 3 + n) % mod
        n = n * 3 % mod





print(abc)

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

using namespace std;

int main() {
  string S;
  cin >> S;
  int N = static_cast<int>(S.size());
  vector<int> A(N, 1);
  int l = 0;
  for (int i = 1; i < N; ++i) {
    if ((S[i - 1] == 'R') && (S[i] == 'R')) {
      A[i + 1] += A[i - 1];
      A[i - 1] = 0;
    } else if ((S[i - 1] == 'R') && (S[i] == 'L')) {
      l = i;
    } else if ((S[i - 1] == 'L') && (S[i] == 'L')) {
      A[l - ((i - l) & 1)] += A[i];
      A[i] = 0;
    }
  }
  const char* sep = "";
  for (int i = 0; i < N; ++i) {
    cout << sep << A[i];
    sep = " ";
  }
  cout << endl;
  return 0;
}


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

int main() {
  
  int N;
  cin >> N;
  
  vector<int>t = vector<int>(N);
  rep(i,N){
    cin >> t.at(i);
  }
  
  int maxWalk = 0;
  int curWalk = 0;
  for (int i = 0; i < N-1; i++) {
    if (t.at(i) >= t.at(i+1)) {
      curWalk++;
    } else {
      if (curWalk > maxWalk ) maxWalk = curWalk;
      curWalk = 0;
    }
  }
  if (curWalk > maxWalk ) maxWalk = curWalk;
  
  cout << maxWalk << endl;
  return 0;
}


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

namespace Atcoder
{
    class AtCodeeeeeeeeeeeeeeeeeeeer
    {
        static void Main(string[] args)
        {
            //入力受け取ってリストlsに追加
            List<int> ls = new List<int>();
            string[] s = Console.ReadLine().Split(' ');
            ls.Add(int.Parse(s[0]));
            ls.Add(int.Parse(s[1]));
            string[] t = Console.ReadLine().Split(' ');
            ls.Add(int.Parse(t[0]));
            ls.Add(int.Parse(t[1]));
            string[] u = Console.ReadLine().Split(' ');
            ls.Add(int.Parse(u[0]));
            ls.Add(int.Parse(u[1]));

            string ans = "YES";
            if (ls.Count(n => n ==1) == 3 || ls.Count(n => n == 2) == 3 || ls.Count(n => n == 3) == 3 || ls.Count(n => n == 4) == 3)
            {
                ans = "NO";
            }
            Console.WriteLine(ans);
        }
    }
}


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

using namespace std;

int main(){

	int n;

	cin >> n;

	n= n%10;

	if(n== 3) cout << "bon\n";
	else if(n== 0 or n== 1 or n==6 or n==8) cout << "pon\n";
	else cout << "hon\n";

	return 0;
}

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

lli n, m;

int main(void){
	cin >> n;
	unordered_map<string, lli> d(n);
	rep(i, n){
		string a;
		cin >> a;
		d[a]++;
	}
	cin >> m;
	unordered_map<string, lli> t(m);
	rep(i, m){
		string a;
		cin >> a;
		t[a]++;
	}
	bool f = true;
	for(auto i : t){
		if(i.second > d[i.first]) f = false;
	}
	if(f) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 31444
#include<stdio.h>
#include<string.h>
#define ll long long 
ll a[2100][2100]={0};
const ll maxn=1e9+7;
void look()
{
	memset(a,0,sizeof a);
	a[0][0]=1;
	for(int i=1;i<2005;i++)
	{
		a[i][0]=a[i][i]=1;
		for(int j=1;j<=i;j++)
		{
			a[i][j]=(a[i-1][j-1]+a[i-1][j])%maxn;
		}
	}
//	printf("good");
}

int main()
{
	look();
	ll n=0,k=0;
	while(~scanf("%lld%lld",&n,&k))
	{
//		printf("%lld   %lld\n",n,k);
		int h=n-k+1;
		for(ll i=1;i<=k;i++)
		{
//			printf("##%d\n",i);
			printf("%lld\n",(a[h][i]*a[k-1][i-1])%maxn);
		}
	}
}

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

int main(){
  int n,m;
  string x;

  for(;;){
    cin >> n;
    if(!n)break;
    cin >> m;
    cin >> x;

    int ans = 0;
    for(int i=0;i<m;i++){
      if(x[i]=='I'){
	int dif = 1;
	while(i+2*dif<m && x[i+2*dif-1]=='O' && x[i+2*dif]=='I')dif++;
	dif--;
	if(dif>=n)ans += dif-n+1;
	i += 2*dif;
      }
    }

    cout << ans << endl;
  }
}

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

int main() {
    int h;
    int w;
    cin >> h >> w;
 
    char sym;
 
    vector<vector<char>> table(h, vector<char>(w));
    //入力する
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >> sym;
            table.at(i).at(j) = sym;
        }
    }
    
  
    
    //行を調べて'.'が一行続いたら'.'に'x'を代入する
    for (int i = 0; i < table.size(); ++i) {
        for (int j = 0; j < table.at(i).size(); ++j) {
            auto itr = find(table.at(i).begin(), table.at(i).end(), '#'); 
            if (itr != table.at(i).end()) {
                break;
            } else {
                for(int k = 0; k < table.at(i).size(); ++k){
                    table.at(i).at(j) = 'x';
                }
                 //table.at(i).erase(table.at(i).begin(), table.at(i).end());
            }
            
        }
    }

    
    //列を調べて'.'or'x'が一列続いたら'.'に'x'を代入する
    //'x'が入ってくれない
    //変数のwとhを使ってる（妥協）
    
    for (int j = 0; j < w; ++j) {
        int i = 0;
        for (i = 0; i < h; ++i) {
            if (table.at(i).at(j) == '#') {
                break;
            }
        }
        if (i == h) {
            for (int k = 0; k < h; ++k) {
                table.at(k).at(j) = 'x';
                //table.at(k).erase(table.at(k).begin()+i);
            }
        }
    }
    
    //表示する
    for(int i = 0; i < table.size(); ++i){
        bool isNotSkip = false;
        for(int j = 0; j < table.at(i).size(); ++j){
            if (table.at(i).at(j) != 'x') {
                cout << table.at(i).at(j);
                isNotSkip = true;
            }
        }
        if ( isNotSkip ) {
            cout << endl;
        }
    }
} 


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

int main(){
	int a, b;
	scanf("%d %d", &a, &b);
	if(a % b ==0){
		printf("%d", a/b);
	}else{
		printf("%d", a/b + 1);
	}

	
	return 0;
}

Measured memory_bytes: 3176
def add(i,x):
    global BIT
    i+=1
    while i<=n:
        BIT[i] += x
        i += i&(-i)
        
def bitsum(i):
    x = 0
    i+=1
    while i>0:
        x += BIT[i]
        i -= i&(-i)
    return x

def sums(l,r):
    return bitsum(r-1)-bitsum(l-1)

n,q = map(int,input().split())
c = list(map(int,input().split()))
pi = [-1]*(n+1)
ps = [[] for _ in range(n)]
qs = [[] for _ in range(n)]
for i in range(n):
    l = pi[c[i]]
    if l!=-1:
        ps[l].append(i)
    pi[c[i]] = i
for i in range(q):
    l,r = map(int,input().split())
    l,r = l-1,r-1
    qs[l].append((r,i))
BIT = [0]*(n+1)
ans = [None]*q
for x in range(n-1,-1,-1):
    for y in ps[x]:
        add(y,1)
    for r,i in qs[x]:
        ans[i] = r-x+1-bitsum(r)

for i in ans:
    print(i)

Measured memory_bytes: 226024
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<map>
#include<bitset>
#include<stack>
#include<set>
#include<vector>
#include <time.h>
#include<string.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 3e3+5;
const int Mod=1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e=exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl
double dp[maxn][maxn];
double p[maxn];
int main()
{
    //ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%lf",&p[i]);
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=i;j++)
        {
            dp[i][j]=(dp[i-1][j-1]*p[i]+dp[i-1][j]*(1.0-p[i]));
        }
    }
    double ans=0;
    for(int i=n/2+1;i<=n;i++) ans=ans+dp[n][i];
    printf("%.10f",ans);
    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}



Measured memory_bytes: 68992
use std::fmt::Write;

fn main(){
    let mut sc = Scanner::new(std::io::stdin());

    while sc.read() {
        let n = sc.next();
        let mut x = vec![0i64; n];
        for i in 0..n {
            x[i] = sc.next();
        }
        let mut d = vec![0i64; n-1];
        for i in 0..n-1 {
            d[i] = x[i+1] - x[i];
        }
        let m = sc.next();
        let k = sc.next();
        let mut perm:Vec<_> = (0..n-1).collect();
        for _ in 0..m {
            let a = sc.next::<usize>() - 1;
            perm.swap(a-1, a);
        }
        let perm2 = pow(&perm, k);
        let mut res = vec![0i64; n-1];
        for i in 0..n-1 {
            res[i] = d[perm2[i]];
        }

        let mut ans = String::new();
        let mut cur = x[0];
        writeln!(&mut ans, "{}", cur).unwrap();
        for i in 0..n-1 {
            cur += res[i];
            writeln!(&mut ans, "{}", cur).unwrap();
        }

        print!("{}", ans);
    }
}

fn pow(perm: &Vec<usize>, k: usize) -> Vec<usize> {
    if k == 0 {
        (0..perm.len()).collect()
    } else if k%2 == 1 {
        let x = pow(perm, k-1);
        prod(&x, &perm)
    } else {
        let x = pow(perm, k/2);
        prod(&x, &x)
    }
}

fn prod(a: &Vec<usize>, b: &Vec<usize>) -> Vec<usize> {
    let n = a.len();
    let mut res = vec![0; n];
    for i in 0..n {
        res[i] = a[b[i]];
    }
    res
}

#[allow(dead_code)]
pub struct Scanner<T> {
    buf: [u8; 8192], len: usize, idx: usize, next: Option<String>, reader: T,
}

#[allow(dead_code)]
impl<R: std::io::Read> Scanner<R> {
    fn new(r: R) -> Scanner<R> {
        Scanner { buf: [0; 8192], len: 0, idx: 0, next: None, reader: r }
    }

    fn next<T: std::str::FromStr>(&mut self) -> T {
        self.wrapped::<T>().unwrap()
    }

    fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        let mut res = Vec::<T>::with_capacity(n);
        for _ in 0..n { res.push(self.next()) }
        res
    }

    fn wrapped<T: std::str::FromStr>(&mut self) -> Option<T> {
        self.read();
        self.next.take().and_then(|s| s.parse::<T>().ok())
    }

    fn read(&mut self) -> bool {
        if self.next.is_some() { return true }
        let mut s = String::with_capacity(16);
        while let Some(c) = self.get_char() {
            if !c.is_whitespace() { s.push(c); }
            else if !s.is_empty() { break; }
        }
        self.next = if !s.is_empty() { Some(s) } else { None };
        self.next.is_some()
    }

    fn get_char(&mut self) -> Option<char> {
        if self.idx == self.len {
            match self.reader.read(&mut self.buf) {
                Ok(l) if l > 0 => {
                    self.idx = 0;
                    self.len = l;
                }
                _ => return None,
            }
        }
        self.idx += 1;
        Some(self.buf[self.idx - 1] as char)
    }
}


Measured memory_bytes: 7976
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> l(n);
	rep(i,n) cin >> l[i];
	sort(l.begin(), l.end());
	ll ans = 0;
	rep(i,n-2){
		for(int j = i+1; j < n-1; ++j){
			int idx = lower_bound(l.begin(), l.end(), l[i]+l[j]) - l.begin();
			ans += (ll)(idx - j - 1);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, A[200000], B[200000];
ll cnt;
priority_queue<pair<int, int>>q;
int main() {
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
	for (int i = 0; i < N; ++i) {
		cin >> B[i];
		if (A[i] != B[i]) {
			q.push(mkp(B[i], i));
		}
		if (A[i] > B[i]) {
			cout << -1 << endl;
			return 0;
		}
	}
	while (!q.empty()) {
		int x = q.top().first;
		int y = q.top().second;
		q.pop();
		if (A[y] >= max(B[(y - 1 + N) % N], B[(y + 1) % N])) {
			if ((B[y] - A[y]) % (B[(y - 1 + N) % N] + B[(y + 1) % N]) == 0) {
				cnt += (B[y] - A[y]) / (B[(y - 1 + N) % N] + B[(y + 1) % N]);
				B[y] = A[y];
			}
			else {
				cout << -1 << endl;
				return 0;
			}
		}
		else {
			cnt += (B[y] - max(B[(y - 1 + N) % N], B[(y + 1) % N])) / (B[(y - 1 + N) % N] + B[(y + 1) % N]) + 1;
			B[y] -= ((B[y] - max(B[(y - 1 + N) % N], B[(y + 1) % N])) / (B[(y - 1 + N) % N] + B[(y + 1) % N]) + 1)*(B[(y - 1 + N) % N] + B[(y + 1) % N]);
			if (B[y] < A[y]) {
				cout << -1 << endl;
				return 0;
			}
			if (B[y] > A[y]) {
				q.push(mkp(B[y], y));
			}
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3700
using System;
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        Tuple<int[], int>[] vert = Enumerable.Range(0, n).Select(x => new Tuple<int[], int>(Console.ReadLine().Split().Select(int.Parse).ToArray(), x)).ToArray();

        Tuple<int[], int>[] sortbyx = vert.OrderBy(x => x.Item1[0]).ToArray();
        Tuple<int[], int>[] sortbyy = vert.OrderBy(x => x.Item1[1]).ToArray();

        List<Edge> edges = new List<Edge>();
        edges.AddRange(temp(sortbyx));
        edges.AddRange(temp(sortbyy));

        Edge[] edge = edges.OrderBy(x => x.Length).ToArray();
        UnionFind uf = new UnionFind(n);
        int cost = 0;
        for (int i = 0; i < edge.Length; i++)
        {
            if(!uf.IsSameGroup(edge[i].Start, edge[i].End))
            {
                uf.Union(edge[i].Start, edge[i].End);
                cost += edge[i].Length;
            }
        }
        Console.WriteLine(cost);
    }
    static List<Edge> temp(Tuple<int[], int>[] sortbyx)
    {
        List<Edge> edges = new List<Edge>();
        for (int i = 1; i < sortbyx.Length; i++)
        {
            edges.Add(new Edge(sortbyx[i - 1].Item2, sortbyx[i].Item2, Math.Min(Math.Abs(sortbyx[i - 1].Item1[0] - sortbyx[i].Item1[0]), Math.Abs(sortbyx[i - 1].Item1[1] - sortbyx[i].Item1[1]))));
        }
        return edges;
    }
}
class UnionFind
{
    int[] data;
    public UnionFind(int count)
    {
        data = Enumerable.Range(0, count).ToArray();
    }
    public void Union(int x, int y)
    {
        int xp = Parent(x);
        int yp = Parent(y);
        if (xp != yp)
        {
            data[yp] = xp;
        }
    }
    public bool IsSameGroup(int x, int y) => Parent(x) == Parent(y);
    public int[] AllParents() => data.Where((x, y) => x == y).ToArray();
    public int Parent(int x)
    {
        form(x);
        return data[x];
    }
    private void form(int x)
    {
        while (data[x] != data[data[x]])
        {
            data[x] = data[data[x]];
        }
    }
}
struct Edge
{
    public int Start;
    public int End;
    public int Length;
    public Edge(int s, int e, int l)
    {
        Start = s;
        End = e;
        Length = l;
    }
}

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

int main(void){
    int N;
    cin >> N;
    int A[N];
    for(int i=0; i<N; i++)cin>>A[i];

    int ans = 31, p;
    for(int i=0; i<N; i++){
        for(int j=1; j<=ans; j++){
            if(A[i]%(int)pow(2,j)==0){
                p = j;
            }
        }
        ans = min(ans, p);
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
from fractions import gcd

def main():
    n, m = map(int, input().split())
    s = input().rstrip()
    t = input().rstrip()
    l = n*m // gcd(n, m)
    f = True
    for i in range(n):
        if i*m//n * n == i*m:
            j = i*m//n
            if s[i] != t[j]:
                f = False
    if f:
        print(l)
    else:
        print("-1")

if __name__ == "__main__":
    main()

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		boolean ok = false;
		if(A < C && C < B)
			ok = true;
		if(B < C && C < A)
			ok = true;
		System.out.println(ok ? "Yes" : "No");
	}

}

Measured memory_bytes: 24020
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;
typedef pair<int,int> P;

#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

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

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

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);

    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;

    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


int dx[5]={1,0,-1,0};
int dy[5]={0,1,0,-1};
// v.front() = -BOUND;
// v.back() = BOUND;

int main(){
    int N;
    cin >> N;
    long long T=1,A=1;

    for(int i=0; i<N; i++){
        long long t,a;
        long long next;
        cin >> t >> a;
        next = (long long)max(ceil((long double)T/t), ceil((long double)A/a));
        T=next*t;
        A=next*a;
    }
    cout << T+A << endl;
    return 0;
}



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

typedef pair<int, int> P;
vector<P> edge[500050];
int minDist[500050];
map<P, int> mp;
int tot;
int Dijsktra(int s, int e)
{
    fill(minDist + 1, minDist + tot + 1, INF);
    minDist[s] = 0;
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, 1});
    while(que.size())
    {
        P now = que.top();
        que.pop();
        if(minDist[now.second] != now.first)
            continue;
        for(vector<P>::size_type i = 0;i < edge[now.second].size();++i)
        {
            P next = edge[now.second][i];
            if(minDist[now.second] + next.second < minDist[next.first])
            {
                minDist[next.first] = minDist[now.second] + next.second;
                que.push({minDist[next.first], next.first});
            }
        }
    }
    if(minDist[e] != INF)
        return minDist[e];
    return -2;
}
void AddEdge(int u, int v, int w)
{
    edge[u].push_back({v, w});
    edge[v].push_back({u, w});
}
int GetId(int u, int c)
{
    if(mp.find({u, c}) != mp.end())
        return mp[{u, c}];
    return mp[{u, c}] = ++tot;
}
int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    tot = n;
    for(int i = 1; i <= m; ++i)
    {
        int u, v, c;
        scanf("%d%d%d", &u, &v, &c);
        int a = GetId(u, c);
        int b = GetId(v, c);
        AddEdge(a, b, 0);
        AddEdge(u, a, 1);
        AddEdge(v, b, 1);
    }
    printf("%d\n", Dijsktra(1, n) / 2);
    return 0;
}


Measured memory_bytes: 58108
#include <bits/stdc++.h>
using namespace std;
#define int           long long
#define pb            push_back
#define x             first
#define y             second
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define PI            3.14159265358979
#define N             200005

int solve(){
    long double a,b; cin>>a>>b;
    a=a*b+0.001;
    int t=a; cout<<t;
    return 0;
}

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0;
}

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

c = [0] * 9

for rate in a:
    i = rate // 400
    if i < 8:
        c[i] = 1
    else:
        c[8] += 1

c_sum = sum(c[:8])
c_min = max(c_sum, 1)
c_max = c_sum + c[8]

print(c_min, c_max)


Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll MOD=1e9+7;
const int INF=1<<30;

map<ll,ll> pfmp; //各素因数の指数を格納
vector<ll> pfv(0); //異なる素因数を昇順に格納

void PF(ll N){
  ll n=N;
  if(n<=0) return;
  ll exp;
  if(n%2==0){
    if(pfmp[2]==0) pfv.push_back(2);
    exp=0;
    while(n%2==0){
      n/=2;
      exp++;
    }
    if(exp>pfmp[2]) pfmp[2]=exp;
  }
  if(n==1) return;
  for(ll i=3;i<=sqrt(N);i+=2){
    if(n%i==0){
      if(pfmp[i]==0) pfv.push_back(i);
      exp=0;
      while(n%i==0){
        n/=i;
        exp++;
      }
      if(exp>pfmp[i]) pfmp[i]=exp;
    }
  }
  if(n!=1){
    if(pfmp[n]==0){
      pfv.push_back(n);
      pfmp[n]=1;
    }
  } 
}

ll modinv(ll a,ll m){
  ll b=m,u=1,v=0;
  while(b){
    ll t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  u%=m;
  if(u<0) u+=m;
  return u;
}

int main(){
  ll N; cin >> N;
  vector<ll> a(N);
  rep(i,N) cin >> a[i];
  rep(i,N){
    PF(a[i]);
  }
  ll LCM=1;
  rep(i,pfv.size()){
    rep(j,pfmp[pfv[i]]){
      LCM*=pfv[i]%MOD;
      LCM%=MOD;
    }
  }
  ll ans=0;
  rep(i,N){
    ans+=LCM*modinv(a[i],MOD)%MOD;
    ans%=MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <cstdio>

int main(){
    int N,K,X,Y;
    scanf("%d %d %d %d",&N,&K,&X,&Y);
    int M = 0;
    for(int i = 1; i <= N; i++){
        if(i <= K){
            M += X;
        }
        if(i > K){
            M += Y;
        }
    }
    printf("%d\n",M);

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <queue>

using namespace std;

int main(int argc, char* argv[])
{
  int N; cin >> N;

  priority_queue<int> que;
  for (int i = 0; i < N; i++) {
    int l; cin >> l;
    que.push(l);
  }

  int total = 0;
  int max_length = que.top(); que.pop();
  for (int i = 1; i < N; i++) {
    total += que.top(); que.pop();
  }
  
  cout << ((max_length < total) ? "Yes" : "No") << endl; 
  return 0;
}


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


    int main()
    {
        int n,m,x,val,k;
        cin>>n>>m>>k;

        int ans=123456789;
        std::vector<int> v1[n];
        std::vector<int> cost(12);
        for(int i=0;i<n;i++)
        {
            cin>>cost[i];
            for(int j=0;j<m;j++)
            {
                cin>>val;
                v1[i].push_back(val);
            }
        }

        int maxi=1<<n;

        for(int i=1;i<maxi;i++)
        {
            std::vector<int> v2(m,0);
            int x,ind=0,sum=0;
            x=i;
            while(x)
            {
                int t=x%2;
                if(t==1)
                {
                    for(int j=0;j<m;j++)
                    {
                        v2[j]+=v1[ind][j];
                    }
                    sum+=cost[ind];
                }
                x=x/2;
                ind++;
            }

            int chk=0;
            for(int j=0;j<m;j++)
            {
                if(v2[j]<k)
                    chk++;
            }
            if(chk==0)
            {
                if(ans>sum)
                    ans=sum;
            }
        }

        if(ans==123456789)
            cout<<"-1\n";
        else
            cout<<ans<<"\n";
        return 0;
    }

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

#define int 				long long int
#define all(c)				c.begin(), c.end()
#define init(arr, num)		memset(arr, num, sizeof(arr))
#define fast				ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define inputFile			freopen("input.txt", "r", stdin); 
#define outputFile			freopen("output.txt", "w", stdout);
#define modM 				1000000007


#ifdef Voneone
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>  void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << std::endl;}
template <typename Arg1, typename... Args> 
	void __f(const char* names, Arg1&& arg1, Args&&... args) {
		const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; 
		__f(comma + 1, args...);
}
#else
#define trace(...)
#endif
 


void solve() 
{ 

	int a; cin >> a;
	long double b;
	cin >> b;

	cout << (int)(a*b);


} 
 
 
signed main()
{
 
	
	#ifdef _DEBUG
		inputFile;
	#endif
	fast;
	int T = 1;
	// cin >> T;
	while(T--)
	{
		solve();
		cout << endl;
	}
	
	
	return 0;
 
}


  

Measured memory_bytes: 3764
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<map>
#include<queue>
#include<iostream>
#include<algorithm>
#define m(a,b) memset(a,b,sizeof(a));
using namespace std;
const int inf = 1 << 30;
const int maxn = 1e5;
typedef long long LL;
map<LL,int>m;
void check(){
	for(int i = 1;i<500;i++)
		m[i*i] = 1;
}
int main(){
	check();
	char a[maxn+5],b[maxn+5];
	while(cin >> a >> b){
		int a_len = strlen(a);
		int b_len = strlen(b);
		int vis = 1;
		int sum_a = 0;
		int sum;
		for(int i = a_len-1;i>=0;i--,vis*=10)
			sum_a+=(a[i]-'0')*vis;
		vis = 1;
		int sum_b = 0;
		for(int i = b_len-1;i>=0;i--,vis*=10)
			sum_b+=(b[i]-'0')*vis;
		vis = 1;
		while(b_len--) vis*=10;
		sum = sum_a*vis+sum_b;
		if(m[sum]) printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    string s; cin >> s;
    long long res = ((s.size() - 1) * s.size()) / 2;
    long long cnt[26]{};
    for (char ch : s)
    {
        ++cnt[ch - 'a'];
    }
    for (int i = 0; i < 26; i++)
    {
        if (cnt[i] > 0)
        {
            long long sub = ((cnt[i] - 1) * cnt[i]) / 2;
            res -= sub;
        }
    }
    res++;
    cout << res << '\n';
    return 0;
}

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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;

	char buf[bufl],*s=buf,*t=buf;

	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}

	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const double eps = 1e-11;

inline int dcmp(double x){if(-eps<x && x<eps)return 0;return x>0?1:-1;}

struct points
{
	double x,y;
	points(double _x=0,double _y=0){x=_x,y=_y;}

	inline friend points operator + (points a,points b){return points(a.x+b.x,a.y+b.y);}
	inline friend points operator - (points a,points b){return points(a.x-b.x,a.y-b.y);}
	inline friend points operator * (points a,double b){return points(a.x*b,a.y*b);}
	inline friend points operator / (points a,double b){return points(a.x/b,a.y/b);}

	inline friend int operator == (points a,points b){return dcmp(a.x-b.x)==0 && dcmp(a.y-b.y)==0;}

	void takein(){x=ty(),y=ty();}
	void print(char ends='\n'){printf("%.12lf %.12lf",x,y),putchar(ends);}
};

inline double dox(points a,points b){return a.x*b.x+a.y*b.y;}
inline double cox(points a,points b){return a.x*b.y-a.y*b.x;}
inline double length(points a){return sqrt(dox(a,a));}

inline points pervec(points a){if(dcmp(length(a))<=0)return points(0,0);return a/length(a);}

void finder(points va,points vb)
{
	double cx=cox(va,vb);

	if(dcmp(cx)==1)puts("COUNTER_CLOCKWISE");
	else if(dcmp(cx)==-1)puts("CLOCKWISE");
	else
	{
		points pa=pervec(va),pb=pervec(vb);
		if(pa==points(0,0) || pb==points(0,0))puts("ON_SEGMENT");
		else if(pa==pb)
		{
			if(length(va)>=length(vb))puts("ON_SEGMENT");
			else puts("ONLINE_FRONT");
		}
		else puts("ONLINE_BACK");
	}
}

int main()
{
	points bas,a,b;
	bas.takein(),a.takein();

	int q=ty();
	while(q--)b.takein(),finder(a-bas,b-bas);
	
	return 0;
}



Measured memory_bytes: 3116
import java.util.Scanner;

public class Main {

	static String[] alphabet = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q",
			"r", "s", "t", "u", "v", "w", "x", "y", "z" };

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] av = new int[n][alphabet.length];
		for (int i = 0; i < n; i++) {
			String str = sc.next();
			for (int j = 0; j < str.length(); j++) {
				String str2 = String.valueOf(str.charAt(j));
				av[i][search(str2)] += 1;
			}
		}
		for (int j = 0; j < av[0].length; j++) {
			int min = av[0][j];
			for (int i = 1; i < n; i++) {
				if (min > av[i][j]) {
					min = av[i][j];
				}
			}
			for (int i = 0; i < min; i++) {
				System.out.print(alphabet[j]);
			}
		}
	}

	public static int search(String str) {
		for (int i = 0; i < alphabet.length; i++) {
			if (alphabet[i].equals(str)) {
				return i;
			}
		}
		return -1;
	}

}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,m;
  cin>>n>>m;
  vector<int> cnt1(n+1,1),cnt2(n+1,0);
  cnt1[1]=0,cnt2[1]=1;
  rep(i,m){
    int x,y;
    cin>>x>>y;
    if(cnt2[x]){//赤があったら
      cnt2[x]--;
      cnt2[y]+=1+cnt1[y];
      cnt1[y]=0;
    }else{
      cnt1[x]--;
      if(cnt2[y]) cnt2[y]++;
      else cnt1[y]++;
    }
  }
  int ans=0;
  FOR(i,1,n+1) if(cnt2[i]) ans++;
  cout<<ans<<endl;
}

Measured memory_bytes: 1024