akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define WEIGHTSUM minWeight[i] + weight
#define VALUESUM value + i
#define MAXVALUE 100001
using namespace std;
int minWeight[MAXVALUE];

int main() {
    int n, w, weight, value, result = 0;

    cin >> n >> w;
    for (int i = 1; i <= n; i++) {
        cin >> weight >> value;

        for (int i = MAXVALUE; i >= 0; i--)
            if ((minWeight[i] || i == 0) && WEIGHTSUM <= w) {
                if (!minWeight[VALUESUM])
                    minWeight[VALUESUM] = WEIGHTSUM;
                minWeight[VALUESUM] = min(minWeight[VALUESUM], WEIGHTSUM);
                result = max(result, VALUESUM);
            }
    }

    cout << result;

    return 0;
}


Measured memory_bytes: 3928
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int total =0;
		for(int i=1;i<=N;i++){
			total += i;
		}
		System.out.println(total);
	}
}


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

int main() {
  int N;
  cin >> N;
  int64_t count=0;
  int64_t r=0;
  int64_t g=0;
  int64_t b=0;
  vector<char> vec(N);
  for (int i=0; i<N; i++) cin >> vec.at(i);
  for (int i=0; i<N; i++) {
    if (vec.at(i)=='R') r++;
    else if (vec.at(i)=='G') g++;
    else b++;
  }
  int j,k;
  for (k=2; k<N; k++) {
    for (j=1; j<k; j++) {
      int i=2*j-k;
      if (i<0) continue;
      if (vec.at(i)!=vec.at(j) && vec.at(j)!=vec.at(k) && vec.at(k)!=vec.at(i)) count++;
    }
  }
  int64_t m=r*g*b;
  cout << m-count << endl;
}


Measured memory_bytes: 3636
from math import gcd
N = int(input())
A = list(map(int,input().split()))

g = 0
for a in A:
    g = gcd(g,a)
if g > 1:
    print('not coprime')
    exit()

sa = set()
for a in A:
    if a==1: continue
    if a in sa:
        print('setwise coprime')
        exit()
    sa.add(a)

MAXN = 10**6+10
sieve = [0,0] + [1]*MAXN
p = 2
small_primes = []
while p*p <= MAXN:
    if sieve[p]:
        small_primes.append(p)
        for q in range(2*p,MAXN+1,p):
            sieve[q] = 0
    p += 1

st = set()
for a in A:
    for p in small_primes:
        found = False
        while a%p==0:
            a //= p
            found = True
        if found:
            if p in st:
                print('setwise coprime')
                exit()
            st.add(p)
        if a==1: break
    else:
        if a in st:
            print('setwise coprime')
            exit()
        st.add(a)

print('pairwise coprime')

Measured memory_bytes: 127344
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

ll dp[222222][5];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	deque<ll> a(n);
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	while(!a.empty()&&a.front()==0) a.pop_front();
	while(!a.empty()&&a.back()==0) a.pop_back();
	n=a.size();
	if(n==0){cout<<0<<'\n'; return 0;}
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<5;j++) dp[i][j]=ll(1e18);
	}
	dp[0][0]=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<5;j++)
		{
			ll v=dp[i][j];
			if(v>=ll(1e18)) continue;
			//none
			if(j==0)
			{
				dp[i+1][0] = min(dp[i+1][0], v+a[i]);
			}
			else
			{
				dp[i+1][4] = min(dp[i+1][4], v+a[i]);
			}
			//flipping
			if(j<=2)
			{
				dp[i+1][2] = min(dp[i+1][2], v+(a[i]%2==0));
			}
			//even
			if(j<=1)
			{
				dp[i+1][1] = min(dp[i+1][1], v+(a[i]==0?2:(a[i]&1)));
			}
			else if(j<=3)
			{
				dp[i+1][3] = min(dp[i+1][3], v+(a[i]==0?2:(a[i]&1)));
			}
		}
	}
	ll ans=ll(1e18);
	for(int i=0;i<5;i++) ans=min(ans,dp[n][i]);
	cout<<ans<<'\n';
}


Measured memory_bytes: 10112
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int n, cnt[200001];

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	for(int i = 2; i <= n; i++){
		int x;
		cin >> x;
		cnt[x]++;
	}
	for(int i = 1; i <= n; i++) cout << cnt[i] << "\n";
	return 0;
}

Measured memory_bytes: 4400
#include <math.h>
#include <iomanip>
#include <algorithm>
#include <iostream>
using namespace std;
int main() {

	int n; cin >> n;
	double sum = 0;
	for (int i = 0; i < n; i++) {
		double num; cin >> num;
		sum += 1 / num;
	}
	cout << setprecision(15) <<1 / sum << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
set<string> c;
const ll mod=1000000007;
const ll mod2=998244353;
const ll inf=100000000000000000;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
ll dp[200000][13];
int main(){
string s;
cin>>s;
int n=s.size();
dp[n][0]=1;
int tmp=1;
for(int i=n-1;i>=0;i--){
    if(s.at(i)=='?'){
        for(int k=0;k<10;k++){
            for(int j=0;j<13;j++){
                dp[i][(tmp*k+j)%13]+=dp[i+1][j];
                dp[i][(tmp*k+j)%13]%=mod;
            }
        }
    }
    else {
        int k=s.at(i)-'0';
         for(int j=0;j<13;j++){
                dp[i][(tmp*k+j)%13]+=dp[i+1][j];
                dp[i][(tmp*k+j)%13]%=mod;
            }
    }
    tmp*=10;
    tmp%=13;
}
cout<<dp[0][5]<<endl;
}

Measured memory_bytes: 10752
ins = list(map(int, input().split()))
if ins[0] == 0:
	print(1)
elif ins[1] == 0:
	print(2)
elif ins[2] == 0:
	print(3)
elif ins[3] == 0:
	print(4)
elif ins[4] == 0:
	print(5)
else :
  print("something wrong.")

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

int main(){
  int n;
  cin >> n;
  vector<int> odd(n/2);
  vector<int> even(n/2);
  for(int i=0; i<n/2; i++) cin >> odd.at(i) >> even.at(i);
  sort(odd.begin(),odd.end());
  sort(even.begin(),even.end());
  vector<pair<int,int>> odnum(n/2);
  vector<pair<int,int>> evnum(n/2);
  int j=0; int k=0;
  for(int i=0; i<n/2-1; i++){
    if(odd.at(i)==odd.at(i+1)){
      odnum[j].first++;
      odnum[j].second=odd.at(i);
    }
    else{
      odnum[j].first++;
      j++;
    }
    if(even.at(i)==even.at(i+1)){
      evnum[k].first++;
      evnum[k].second=even.at(i);
    }
    else{
      evnum[k].first++;
      k++;
    }
  }
  odnum[j].first++;
  evnum[k].first++;
  sort(odnum.begin(), odnum.end());
  reverse(odnum.begin(), odnum.end());
  sort(evnum.begin(), evnum.end());
  reverse(evnum.begin(), evnum.end());

  int ans;
  if(odnum[0].second!=evnum[0].second) ans =  n-odnum[0].first -evnum[0].first;
  else ans = min((n-odnum[1].first -evnum[0].first),(n-odnum[0].first-evnum[1].first));
  cout << ans << endl;
}

Measured memory_bytes: 1408
use std::cmp::min;
use std::collections::BTreeMap;

const INF: i64 = 1e17 as i64;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let k: usize = sc.read();
    let h: Vec<i64> = sc.vec(n);

    let mut dp = BTreeMap::new();
    dp.insert((0, 0), 0);
    for height in h.into_iter() {
        let mut next = BTreeMap::new();
        for ((cur_height, cur_ops), min_cost) in dp.into_iter() {
            if cur_height >= height {
                {
                    let cur = next.entry((height, cur_ops)).or_insert(INF);
                    update_min(cur, min_cost);
                }
                if cur_ops < k {
                    let cur = next.entry((cur_height, cur_ops + 1)).or_insert(INF);
                    update_min(cur, min_cost);
                }
            } else {
                {
                    let cur = next.entry((height, cur_ops)).or_insert(INF);
                    update_min(cur, min_cost + height - cur_height);
                }
                if cur_ops < k {
                    let cur = next.entry((cur_height, cur_ops + 1)).or_insert(INF);
                    update_min(cur, min_cost);
                }
            }
        }
        dp = next;
    }

    println!("{}", dp.values().cloned().min().unwrap());
}

fn update_min<T: PartialOrd>(cur: &mut T, v: T) {
    if *cur > v {
        *cur = v;
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  sort(all(a));
  vector<ll> sum(n+1,0);
  rep(i,n) {
    sum[i+1] += a[i];
    sum[i+1] += sum[i];
  }
  auto f = [&](int i) {
    bool ok = true;
    for (int j = i + 1; j < n; ++j) {
      if (2*sum[j] < a[j]) { //a_jを吸収できない
        ok = false; break;
      }
    }
    return ok;
  };
  int left = -1, right = n;
  while (right - left > 1) {
    int mid = (right + left) / 2;
    if (f(mid)) right = mid;
    else left = mid;
  }
  debug(right);
  int ans = n - right;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
//----------BHAVIK DIWANI(PICT_COMP)---------------
	#include<bits/stdc++.h>
	#define test ll t; cin>>t; while(t--)
	#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define mod 1000000007
	#define ll long long
	#define int long long
	#define ull unsigned long long
	#define MAX 1000005
	#define pb push_back
	#define mkp make_pair
	#define vi vector<int>
	#define pii pair<int,int>
	#define endl '\n'
	#define vs vector<string>
	#define mii map<int,int>
	#define msi map<string,int>
	#define vpii vector< pair<int, int > >
	#define vpsi vector< pair< string ,int > >
	#define forci(p,q) for(int i=p;i<q;i++)
	ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
	ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
	ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
	ll modmul(ll x, ll y){return (x*y)%mod;}
	ll modadd(ll x, ll y){return (x+y)%mod;}
	ll modsub(ll x, ll y){return (x-y+mod)%mod;}
	ll fact[1000007]={0};
	void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
	ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
	ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
	inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
	inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
	inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
	/*bool prime[MAX];
	ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
	}*/
	/*int inv[1000001]={0};
	void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
	*/
	using namespace std;
	int solve()
	{
		int k;
		cin>>k;
		int num=0;
		for(int i=0;i<k;i++){
			(num=num*10+7)%=k;
	//		cout<<num<<endl;
			if(num%k==0){
				cout<<i+1;
				return 0;
			}
		}
		cout<<"-1";
		return 0;
	}
	signed main()
	{
		fastio;
	//	test
			solve();
	}
	
	
	
	
	


Measured memory_bytes: 3652
x,y=map(str,input().split())
l=[str(i) for i in range(0,10)]
l=l+['A','B','C','D','E','F']
for i in l:
    if i==x:
        a=i
    if i==y:
        b=i

if a<b:print('<')
elif a==b:print('=')
else:print('>')

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int> >;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

int f_dir[2][4] = {{-1, 0, 1, 0}, {0, 1, 0, -1}}; //↑→↓←
int e_dir[2][8] = {{-1, -1, -1, 0, 0, 1, 1, 1}, {-1, 0, 1, -1, 1, -1, 0, 1}};
bool is_in_field(int y, int x, int h, int w){
  return (y >= 0 && y < h && x >= 0 && x < w);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  ll n;
  cin >> n;
  ll h = 0;
  ll ans = 0;
  for(int i = 0; i < n; i++){
    ll a; cin >> a;
    if(h > a) ans += h-a;
    else h = a;
  }
  cout << ans << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 3604
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vpint> vvpint;
typedef vector<vpll> vvpll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<string>> vvstring;
typedef vector<vector<bool>> vvbool;

typedef vector<vector<vector<ll>>> vvvll;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================





int main() {

	////==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	////==================================
	
	string S;
	cin >> S;
	int a;
	cin >> a;

	for (int i = 0; i < S.length(); i++)
	{
		if (i % a == 0)
		{
			cout << S[i];
		}
	}





}





Measured memory_bytes: 256
def main():
  N,K = input().split()
  N = int(N)
  K = int(K)
  R,S,P = input().split()
  R = int(R)
  S = int(S)
  P = int(P)
  T = input()
  #r -> a -> p 
  #s -> b -> r
  #p -> c -> s
  T = T.replace("r","a")
  T = T.replace("s","b")
  T = T.replace("p","c")
  T = T.replace("a","p")
  T = T.replace("b","r")
  T = T.replace("c","s")
  #print(T)
  #r_count = T.count("r")
  #s_count = T.count("s")
  #p_count = T.count("p")
  #print(r_count, s_count, p_count)
  
  T = list(T)
  score=0
  
  for i in range(N-K):
    if(T[i]=="r"):
      score = score+R
    elif(T[i]=="s"):
      score = score+S
    elif(T[i]=="p"):
      score = score+P
    if(T[i]==T[i+K]):
      T[i+K]="n"
          
  for i in range(N-K,N,1):
    if(T[i]=="r"):
      score = score+R
    elif(T[i]=="s"):
      score = score+S
    elif(T[i]=="p"):
      score = score+P

  print(score)
  

if __name__=="__main__":
  main()

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

int main(){
  int n;
  string s;
  cin >> n >> s;
  if(n % 2 == 1){
    cout << "No" << endl;
  }else{
    if(s.substr(0, n/2) == s.substr(n/2, n/2)) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}

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

using namespace std;

template <typename Data, typename T>
struct ReRooting
{

    struct Node
    {
        int to, rev;
        Data data;
    };

    using F1 = function<T(T, T)>;
    using F2 = function<T(T, Data)>;

    vector<vector<Node>> g;
    vector<vector<T>> ldp, rdp;
    vector<int> lptr, rptr;
    const F1 f1;
    const F2 f2;
    const T ident;

    ReRooting(int n, const F1 &f1, const F2 &f2, const T &ident) : g(n), ldp(n), rdp(n), lptr(n), rptr(n), f1(f1), f2(f2), ident(ident) {}

    void add_edge(int u, int v, const Data &d)
    {
        g[u].emplace_back((Node){v, (int)g[v].size(), d});
        g[v].emplace_back((Node){u, (int)g[u].size() - 1, d});
    }

    void add_edge_bi(int u, int v, const Data &d, const Data &e)
    {
        g[u].emplace_back((Node){v, (int)g[v].size(), d});
        g[v].emplace_back((Node){u, (int)g[u].size() - 1, e});
    }

    T dfs(int idx, int par)
    {

        while (lptr[idx] != par && lptr[idx] < g[idx].size())
        {
            auto &e = g[idx][lptr[idx]];
            ldp[idx][lptr[idx] + 1] = f1(ldp[idx][lptr[idx]], f2(dfs(e.to, e.rev), e.data));
            ++lptr[idx];
        }
        while (rptr[idx] != par && rptr[idx] >= 0)
        {
            auto &e = g[idx][rptr[idx]];
            rdp[idx][rptr[idx]] = f1(rdp[idx][rptr[idx] + 1], f2(dfs(e.to, e.rev), e.data));
            --rptr[idx];
        }
        if (par < 0)
            return rdp[idx][0];
        return f1(ldp[idx][par], rdp[idx][par + 1]);
    }

    vector<T> solve()
    {
        for (int i = 0; i < g.size(); i++)
        {
            ldp[i].assign(g[i].size() + 1, ident);
            rdp[i].assign(g[i].size() + 1, ident);
            lptr[i] = 0;
            rptr[i] = (int)g[i].size() - 1;
        }
        vector<T> ret;
        for (int i = 0; i < g.size(); i++)
        {
            ret.push_back(dfs(i, -1));
        }
        return ret;
    }
};

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

    int n;
    cin >> n;
    auto f1 = [](int a, int b) {
        return max(a, b);
    };

    auto f2 = [](int a, int data) {
        return a + data;
    };
    ReRooting<int, int> g(n, f1, f2, 0);
    for (int i = 1; i < n; i++)
    {
        int s, t;
        cin >> s >> t;
        s--;
        t--;
        g.add_edge(s, t, 1);
    }
    auto ret = g.solve();
    for (int i = 0; i < n; i++)
    {
        cout << 2 * (n - 1) - ret[i] << endl;
    }
}



Measured memory_bytes: 40980
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <limits>
#include <string>
#include <vector>

using namespace std;

const long long INF = 1LL << 60;

//各桁の和を出力
long long Sum(long long n) {
  long long m = 0;
  while (n) {
    m += n % 10;
    n /= 10;
  }
  return m;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void Comuse() {
  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;
  }
}

#define comuse Comuse()
// nCk(comuseを使え)
long long combi(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;
}
// pCk(comuseを使え)
long long perm(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] % MOD) % MOD;
}

//最小公倍数(aとbの)
long long lcm(long long a, long long b) {
  long long n;
  n = a / __gcd(a, b) * b;
  return n;
}

// auto A = div(n)
vector<long long> div(long long n) {
  vector<long long> ret;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) {
        ret.push_back(n / i);
      }
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}

//(aのn乗をmodで割ったあまり)
long long modpow(long long a, long long n, long long mod) {
  long long ans = 1;
  while (n > 0) {
    if (n & 1) {
      ans = ans * a % mod;
    }

    a = a * a % mod;

    n >>= 1;
  }

  return ans;
}

void solve();

const int MAX_N = 131072;
// segment tree
int NN;
int seg[MAX_N * 2 - 1];
void seguse() {
  for (int i = 0; i < 2 * NN - 1; i++) {
    seg[i] = INT_MAX;
  }
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << fixed;
  solve();
}

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

int K,X;

void solve() {
  cin >> K >> X;
  if(K*500 >= X){
    cout << "Yes" <<endl;
  } else{
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    int h, w; cin >> h >> w;
    int n; cin >> n;
    vector<int> a(n);
    vector<vector<int>> c(h, vector<int>(w, 0));
    REP(i,n) cin >> a[i];
    int index = 0;

    REP(i,h) {
        if (i%2 == 0) {
            REP(j,w) {
                c[i][j] = index+1;
                if (--a[index] <= 0) index++;
            }
        } else {
            REPR(j,w-1) {
                c[i][j] = index+1;
                if (--a[index] <= 0) index++;
            }
        }
    }

    REP(i,h) {
        REP(j,w) {
            cout << c[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
bool pal(string s)
{
    int l=s.size();
    for(int i=0;i<(l+1)/2;i++)
    {
        if(s[i]!=s[l-1-i])
            return false;
    }
    return true;

}
int main()
{
    string s,a,b;
    cin>>s;
    int l=s.size();
    int i,j,k,m,n,c,d;
    for(i=0,j=((l+3)/2)-1;i<(l-1)/2;i++)
    {

        a=a+s[i];
        b=b+s[j];
    }
    if(pal(s))
    {
        if(pal(a) && pal(b))
            {
                cout<<"Yes"<<endl;
                return 0;
            }
        
    }
    cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

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

using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

using ll = long long;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
Bint comb(Bint, Bint);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    int n;
    cin >> n;
    int a[n + 1];
    repd(i, 1, n + 1) { cin >> a[i]; }

    bool judge[n + 1] = {};
    int count = 0;
    int point = 1;
    while (true) {
        if (point == 2) {
            break;
        }
        count++;
        if (judge[a[point]]) {
            cout << -1 << endl;
            return 0;
        }
        point = a[point];
        judge[point] = true;
    }

    cout << count << endl;
    return 0;
}

Bint comb(Bint a, Bint b) {
    Bint ans = 1;

    if (a < b) {
        return 0;
    }

    rep(i, b) {
        ans *= a - i;
        ans /= i + 1;
    }

    return ans;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

ll gcd(ll a, ll b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

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

void prime_map(map<ll, ll> &m, ll num) {
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }

    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }
        return;
    } else {
        prime_map(m, num);
    }
}


Measured memory_bytes: 768
import java.util.*;

public class Main{
	public static char[][] map;
	public static int[] dx = {0,0,1,-1};
	public static int[] dy = {1,-1,0,0};

	public static int dfs(int x, int y){
		int ans=1;
		map[y][x] = '#';
		for(int i=0;i<4;i++){
			int nx = x + dx[i];
			int ny = y + dy[i];
			if(0<=nx && nx<map[0].length && 0<=ny && ny<map.length && map[ny][nx] == '.'){
				ans += dfs(nx,ny);
			}
		}
		return ans;
	}

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

		while(true){
			int w=sc.nextInt(), h=sc.nextInt();
			if(w==0 && h==0) break;

			map = new char[h][w];
			int x=0, y=0;
			for(int i=0;i<h;i++){
				map[i] = sc.next().toCharArray();
				for(int j=0;j<w;j++){
					if(map[i][j]=='@'){x=j; y=i; map[i][j]='.';}
				}
			}
			System.out.println(dfs(x,y));
		}
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
using namespace std;
long long MOD = 1e9 + 7;
typedef long long ll;
typedef pair<ll, ll> pll;

ll a, b;

int main() {
	cin >> a >> b;
	if (b % a == 0)cout << a + b << endl;
	else cout << b - a << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
H = list(map(int,input().split()))

ans = 0

memo = 0
ans = 0

for i in range(len(H)-1):
    if H[i] >= H[i+1]:
        memo += 1
       
    else:
        memo = 0
    ans = max(memo,ans)
    
print(ans)


Measured memory_bytes: 14224
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int N;
  cin >> N;
  vector<int> b(N);
  REP(i, N) {
    cin >> b[i];
    b[i]--;
  }
  vector<int> ans;
  while (b.size()) {
    int index = -1;
    REP(i, b.size()) {
      if (i == b[i]) index = i;
    }
    if (index == -1) {
      cout << -1 << endl;
      return 0;
    } else {
      ans.push_back(index + 1);
      b.erase(b.begin() + index);
    }
  }
  reverse(ALL(ans));
  REP(i, ans.size()) cout << ans[i] << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;

int main(){

    ll n;
    cin >> n;
    vector<ll> dm(n);
    for(int i = 0; i < n; i++)
        cin >> dm[i];
    int pr = -1, vl = dm[0];
    for(int i = 1; i < n; i++)
        vl = dm[i] - vl;
    vl = vl/2;
    vector<int> mn(n+1);
    for(int i = 0; i < n+1; i++){
        mn[i] = vl*2;
        vl = dm[i] - vl;
    }

    for(int i = 0; i < n; i++)
        cout << mn[i] << " ";
    return 0;
}

Measured memory_bytes: 2432
n = input()
 
a = [int(i) for i in input().split()]
 
max = 1000000000
for i in a:
    sum = 0
    while(i % 2 == 0):
        i /= 2
        sum += 1
    
    if(max > sum):
        max = sum
 
print(max)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int a[205];
int main(){
	int n,l;
	cin>>n>>l;
	int f=0;
	int sum=0;
	for(int i=1;i<=n;i++){
		a[i]=l+i-1;
		sum+=a[i];
	}
	int t=2e9;
	int ans;
	for(int i=1;i<=n;i++){
		if(abs(a[i])<t){
			t=abs(a[i]);
			ans=sum-a[i];
		}
	}	
	printf("%d\n",ans);
}

Measured memory_bytes: 256
N,MaxW = list(map(int,input().split()))

V = []
W = []

for i in range(N):
    v,w = list(map(int,input().split()))
    V.append(v)
    W.append(w)
    
dp = [[0]*(MaxW+1) for i in range(N+1)]

for i in range(N):
    for w in range(MaxW+1):
        if w-W[i]>=0:
            dp[i+1][w] = max(dp[i][w-W[i]] + V[i], dp[i][w])
        else:
            dp[i+1][w] = dp[i][w]


print(dp[N][MaxW])



Measured memory_bytes: 41900
/* kop Chy_Chy*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll , ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define si(x)   scanf("%d", &x)
#define sl(x)   scanf("%lld", &x)
#define pi(x)   printf("%d\n", x)
#define pl(x)   printf("%lld\n", x)
#define deb(x)  cout<< #x << " = " << x << endl // debugging kop 
#define mp      make_pair
#define pb      push_back
#define MOD     1000000007
#define PI      acos(-1)
#define ff      first
#define ss      second
#define newline printf("\n")
ll binpow(ll a, ll b); // binary exponentiation kop
void prime_factorization(ll n, vll &prime_factors); // prime factorization kop
ll gcd(ll a, ll b); // greatest common divisor kop. Use LONG LONG
void speedup() {
    ios::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
}
ll lcm(ll a, ll b){
    return (a / gcd(a,b))*b;
}
int main(){
    speedup();
    int t = 1;
    // cin>> t;
    while(t--){
        // khela final Mamooo
        // cout << lcm(101, 7);
        int n; cin>> n;
        string s; cin>> s;
        map<char, int> cnt;
        for(char c: s){
            cnt[c]++;
        }
        int ans = 0;
        if(cnt['R'] == 0|| cnt['W'] == 0){
            cout<< 0 << "\n";
            return 0;
        }
        else{
            for(int i = 0; i < cnt['R']; i++){
                if(s[i] == 'W') ans++;
            }
        }
        ans = min(ans, cnt['R']);
        ans = min(ans, cnt['W']);
        cout<< ans << "\n";
    }
    // kop kop return 
    return 0;
}


// kop kop functions:
ll binpow(ll a, ll b){
    a = a ; ll res = 1;
    while(b > 0){
        if(b & 1) res *= a ;
        a = a* a;b = b >> 1;}
    return res;
}
/*---------------------------------------------------------------------------------------------------------------*/
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a%b);
}
/*---------------------------------------------------------------------------------------------------------------*/
void prime_factorization(ll n, vll &prime_factors){
    // first two step taking care of composite number
    // taking care of 2
    while(n%2 == 0){
        prime_factors.pb(2);
        n = n / 2;
    }
    // now n must be odd. And the remaining prime divisors are odd. so we start from 3 and increamenting 2
    for(ll i = 3; i <= sqrt(n); i = i + 2){
        while(n%i == 0){
            prime_factors.pb(i);
            n = n / i;
        }
    }
    // now we are taking care of  n is prime number and greater than 2
    if(n > 2){
        prime_factors.pb(n);
    }
}
/*---------------------------------------------------------------------------------------------------------------*/














Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i,k;
	long long x,s=0;
	vector<long long> a;
	scanf("%d",&n);
	a.resize(n+1);
	a[0]=0;
	for(i=1;i<=n;i++)
	{
		scanf("%lld",&x);
		a[i]=a[i-1]+x;
	}
	sort(a.begin(),a.end());
	for(i=0;i<=n;i++)
	{
		if(i==0||a[i]>a[i-1])
			k=i;
		s+=i-k;
	}
	printf("%lld",s);
	return 0;
} 

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define MOD 998244353

int pow(int a, int n) {
  int res = 1;
  while (n > 0) {
    if (n & 1) res = 1LL * res * a % MOD;
    a = 1LL * a * a % MOD;
    n >>= 1;
  }
  return res;
}

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i++)
    cin >> d[i];
  if (count(d.begin(), d.end(), 0) != 1 || d[0] != 0) {
    cout << 0 << endl;
    return 0;
  }
  sort(d.begin(), d.end());
  int ans = 1, count = 1, value = 1;
  for (int i = 1; i < n; i++) {
    if (d[i-1] == d[i])
      count++;
    else {
      if (d[i] - d[i-1] != 1) {
        cout << 0 << endl;
        return 0;
      }
      ans = 1LL * ans * pow(value, count) % MOD;
      value = count;
      count = 1;
    }
  }
  ans = 1LL * ans * pow(value, count) % MOD;
  cout << ans << endl;
}

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


int main(void){
    // Your code here!
    int n;
    int alice=0;
    int bob=0;
    cin >> n;
    
    vector<int> vc(n);
    for(int i=0;i<n;i++)    cin >> vc[i];
    
    //まず大きい順にソート
    sort(vc.begin(), vc.end());
    reverse(vc.begin(),vc.end());
    
    
    //奇数部分がアリス
    for(int i=0;i<n;i++){
        if(i%2==1){
            bob += vc[i];
        }
        else{
            alice += vc[i];
        }
    }
    
    cout << alice-bob;
}


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

using namespace std;

int main(){
  int n, m;
  std::cin >> n >> m;

  vector<long long> h(n);
  for(int i=0; i<n; i++){
    std::cin >> h[i];
  }

  vector<pair<int, int> > path;
  for(int i=0; i<m; i++){
    int a, b;
    std::cin >> a >> b;
    path.push_back(make_pair(a - 1, b - 1));
    path.push_back(make_pair(b - 1, a - 1));
  }

  vector<bool> good_arr(n, true);
  vector<bool> exists_path(n, false);
  for(int i=0; i<path.size(); i++){
    if(h[path[i].first] <= h[path[i].second]){
      good_arr[path[i].first] = false;
    }
    // std::cout << h[path[i].first] << " > " << h[path[i].second] << " : " << good_arr[path[i].first] << '\n';
  }
  int ans = 0;
  for(int i=0; i<n; i++){
    if(good_arr[i]) ans += 1;
  }

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


Measured memory_bytes: 5740
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Scanner;

import javax.swing.tree.TreeNode;
class Main{


	static final int MOD = 1000000007;

	static int MAX = 10000000;
	static	ArrayList<TreeNode> tree;
	static HashSet<Integer> set;
	static int[] ans;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		Pair[] pairs = new Pair[n];
		for(int i = 0;i < n;i++){
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			Pair pair = new Pair(a[i], b[i]);
			pairs[i] = pair;
		}
		Arrays.sort(pairs);
		long ans = 0;
		PriorityQueue<Integer> que = new PriorityQueue<>(Collections.reverseOrder());

		int index = 0;
		for(int day = 1;day <= m;day++){

			while(true){
				if(index == n || day != pairs[index].from){
					if(!que.isEmpty()){
						ans += que.poll();			//先頭
					}
//					System.out.println("day " + day + " "  +ans);
					break;
				}
				que.add(pairs[index].end);
				index++;

			}
		}

		System.out.println(ans);











	}

	static long fac[] = new long[MAX];
	static long finv[] = new long[MAX];
	static long inv[] = new long[MAX];



	//テーブルの作成
	static 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;
		}
	}

	// 二項係数計算
	static	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;
	}








	static int upperbond(int k,ArrayList<Integer> data){		//k以下で最大の値をdataの中から探し、返す二分探索
		if(data == null){
			return -1;
		}
		int max = data.size();
		int min = -1;
		while(max-min > 1){
			int mid = (max+min)/2;
			if(data.get(mid) <= k){
				min = mid;
			}else{
				max = mid;
			}
		}


		//		if(min != -1){
		//			min = data.get(min);
		//		}

		//		System.out.println(max);
		return min;					//indexを返している
	}

	static int lowerbond(int k,ArrayList<Integer> data){		//k以上で最小の値をdataの中から探し、返す二分探索
		if(data == null){
			return -1;
		}
		//		System.out.println("lo");
		//		System.out.println("lo");
		int max = data.size();
		int min = -1;

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data.get(mid) >= k){
				max = mid;
			}else{
				min = mid;
			}
		}

		return max;			//indexを返している
	}



	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	static long gcd(long a,long b){
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}



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




}

class Pair implements Comparable{
	int from;
	int end;
	public Pair(int from,int end) {
		this.from = from;
		this.end = end;
		// TODO 自動生成されたコンストラクター・スタブ
	}

	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return  from - otherpair.from;
	}








}






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

int w,h;
int m[25][25],done[25][25];
int s[2],g[2];
const int dx[] ={-1,1,0,0};
const int dy[] = {0,0,-1,1};

int dfs(int l,int c, int cnt){
  int ret = 1000,i,j,tmpl,tmpc;
  //if(m[l][c]==3 && cnt<=10)return cnt;
  if(cnt>10)return 1000;
  for(i=0;i<4;i++){
    tmpl = l,tmpc = c; //初期位置
    bool ch = 0;
    if(i<2){
      while(tmpl+dx[i]>=0 && tmpl+dx[i]<h && m[tmpl+dx[i]][tmpc+dy[i]]!=1){
        if(m[tmpl+dx[i]][c]==3)return (cnt+1);
        tmpl+=dx[i];
        ch = 1;
      }
      bool flag = 0;
      if(tmpl+dx[i]<0 || tmpl+dx[i]>=h)continue;
      if(ch==1 && m[tmpl+dx[i]][c]==1){
        m[tmpl+dx[i]][c]=0;
        flag = 1;
        ret = min(ret,dfs(tmpl,c,cnt+1));
        m[tmpl+dx[i]][c]=1;
      }
    }else{
      while(tmpc+dy[i]>=0 && tmpc+dy[i]<w && m[l][tmpc+dy[i]]!=1){
        if(m[l][tmpc+dy[i]]==3)return (cnt+1);
        tmpc+=dy[i];
        ch = 1;
      }
      bool flag = 0;
      if(tmpc+dy[i]<0 || tmpc+dy[i]>=w)continue;
      if(ch==1 && m[l][tmpc+dy[i]]==1){
        m[l][tmpc+dy[i]]=0;
        flag = 1;
        ret = min(ret,dfs(tmpl,tmpc,cnt+1));
        m[tmpl+dx[i]][tmpc+dy[i]]=1;
      }
    }
  }
  return ret;
}

int main(){
  int ret,i,j;
  while(1){
    cin >> w >> h;
    if(w==0 && h==0)break;
    ret = 1000;
    for(i=0;i<25;i++)for(j=0;j<25;j++){
      m[i][j]=0;
      done[i][j]=0;
    }

    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
        cin >> m[i][j];
        if(m[i][j]==2)s[0]=i,s[1]=j;
      }
    }
    done[s[0]][s[1]]=1;
    ret = dfs(s[0],s[1],0);
    if(ret>10)ret = -1;
    cout << ret << endl;
  }
  return 0;
}



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

int N;
vector<string> S(200001);

void solve(){
    map<string, int> t;
    for(int i = 1; i <= N; ++i){
        t[S[i]]++;
    }
    int max = 0;
    for(auto itr = t.begin(); itr != t.end(); ++itr){
        if(max < itr->second) max = itr->second;
    }
    for(auto itr = t.begin(); itr != t.end(); ++itr){
        if(max == itr->second) cout << itr->first << endl;
    }
}
int main(){
    cin >> N;
    for(int i = 1; i <= N; ++i){
        cin >> S[i];
    }
    solve();
    return 0;
}

Measured memory_bytes: 26752
N = int(input())

from math import log10,ceil,floor
mini = int(log10(N))
digit =  floor(log10(N)**0.5)
for n in range(1,int(N**0.5) + 1):
    if N % n == 0:
        rev = N // n
        if floor(abs(log10(max(n,rev))-digit)) < floor(abs(mini - digit)):
            mini = floor(log10(max(n,rev)))
print(mini + 1)

Measured memory_bytes: 3188
#include<iostream>
#include<vector>
#include<map>
#define P pair<int,int>
using namespace std;
int main(){
int n,m,p;
while(cin>>n>>m>>p,n||m||p){
	int maisu=0,tmp,atari;
	int  ans=0;
	for(int i=0;i<n;i++){
		cin>>tmp;
		maisu+=tmp*100;
		if(i+1==m)atari=tmp;
	}
		//cout<<"p"<<p;
	if(atari==0)ans=0;

	else {
		ans=maisu;
		ans-=maisu*p/100;
		ans=ans/atari;
	}
	cout<<ans<<endl;
}
return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define all(x) (x).begin(), (x).end()

using namespace __gnu_pbds;
using namespace std;

using ull = unsigned long long;
using ll = long long;
using ld = long double;
template <typename T> using ordered_set = tree<T, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;

const int mod = 1e9 + 7;
const int inf = INT_MAX;

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

    string s;
    cin >> s;

    if (s[0] == 'R' and s[0] == s[1] and s[1] == s[2]) {
        cout << "3\n";
    } else if ((s[0] == 'R' and s[1] == 'R') or (s[1] == 'R' and s[2] == 'R')) {
        cout << "2\n";
    } else if (s[0] == 'R' or s[1] == 'R' or s[2] == 'R') {
        cout << "1\n";
    } else cout << "0\n";
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
 
using namespace std;
int N,K;

double h(int);

int main()
{
  int i,j;
  int inp;
  int sum, maxh;
  int maxi=0;
  double sumh=0;

  cin >> N >> K;

  vector<int> hh(N);

  sum = 0;
  for (i=0; i<K; i++) {
    cin >> inp;
    hh[i] = inp;
    sum += inp;
  }
  maxh = sum;
  maxi = K-1;
  for (i=K; i<N; i++) {
    cin >> inp;
    hh[i] = inp;
    sum += inp - hh[i-K];
    if (sum > maxh) {
      maxh = sum;
      maxi = i;
    }
  }
  for (i=maxi-K+1; i<=maxi; i++) {
    sumh += h(hh[i]);
  }
  printf("%lf\n", sumh);

  return 0;
}
double h(int n) {
  return (double)(n+1)/2.0;
}


Measured memory_bytes: 1024
package main

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

type deque struct {
	front, back []int
}

func (deq *deque) isEmptyFront() bool {
	return len(deq.front) == 0
}
func (deq *deque) isEmptyBack() bool {
	return len(deq.back) == 0
}

func (deq *deque) pushBack(v int) {
	deq.back = append(deq.back, v)
}
func (deq *deque) pushFront(v int) {
	deq.front = append(deq.front, v)
}
func (deq *deque) popBack(v *int) bool {
	r := true
	if !deq.isEmptyBack() {
		*v = deq.back[len(deq.back)-1]
		deq.back = deq.back[:len(deq.back)-1]
	} else if !deq.isEmptyFront() {
		*v = deq.front[0]
		deq.front = deq.front[1:]
	} else {
		r = false
	}
	return r
}
func (deq *deque) popFront(v *int) bool {
	r := true
	if !deq.isEmptyFront() {
		*v = deq.front[len(deq.front)-1]
		deq.front = deq.front[:len(deq.front)-1]
	} else if !deq.isEmptyBack() {
		*v = deq.back[0]
		deq.back = deq.back[1:]
	} else {
		r = false
	}
	return r
}

func (deq *deque) get(idx int) int {
	tot := len(deq.front) + len(deq.back)
	v := -1
	if idx < tot {
		if idx < len(deq.front) {
			v = deq.front[len(deq.front)-1-idx]
		} else {
			v = deq.back[idx-len(deq.front)]
		}
	}
	return v
}

func (deq *deque) printDeque() {
	fmt.Print("[")
	cnt := 0
	for i := len(deq.front) - 1; i >= 0; i-- {
		cnt++
		if i > 0 {
			fmt.Print(" ")
		}
		fmt.Print(deq.front[i])
	}
	if cnt > 0 {
		fmt.Print(" ")
	}
	for i := 0; i < len(deq.back); i++ {
		if i > 0 {
			fmt.Print(" ")
		}
		fmt.Print(deq.back[i])
	}
	fmt.Println("]")
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt(sc)
	ans := make([]int, 0)
	var deq deque
	for i := 0; i < n; i++ {
		op := nextInt(sc)
		if op == 0 || op == 2 {
			d := nextInt(sc)
			var x int
			if op == 0 {
				x = nextInt(sc)
				if d == 0 {
					deq.pushFront(x)
				} else {
					deq.pushBack(x)
				}
			} else {
				var v int
				if d == 0 {
					deq.popFront(&v)
				} else {
					deq.popBack(&v)
				}
			}
		} else {
			p := nextInt(sc)
			ans = append(ans, deq.get(p))
		}
	}
	for i := range ans {
		fmt.Println(ans[i])
	}
}



Measured memory_bytes: 13384
L=input()
DIV=10**9+7
# 桁数,未満フラグ
dp=[[0 for i in range(2)] for j in range(len(L))]

# その桁で1を選べるなら2種類(1,0 0,1)
# その桁で0を選べるなら1種類(0,0)
# 未満フラグが立っていたなら3種類(0,0 1,0 0,1)
# 初めて未満フラグを立てるならx==1である必要があり、1種類(0,0)
dp[0][0]=2
dp[0][1]=1

for i in range(1,len(L)):
  x=int(L[i])
  dp[i][0]=(dp[i-1][0]*2*(x==1)+dp[i-1][0]*1*(x==0))%DIV
  dp[i][1]=(dp[i-1][0]*1*(x==1)+dp[i-1][1]*3)%DIV

print((dp[-1][0]+dp[-1][1])%DIV)


Measured memory_bytes: 21228
import sys
input=sys.stdin.readline
n,q=map(int,input().split())
l=[]
for i in range(n-1):
  l.append(list(map(int,input().split())))
l2=[]
for i in range(q):
  l2.append(list(map(int,input().split())))
connection=[]
for i in range(n):
  connection.append([])
for i in range(n-1):
  connection[l[i][0]-1].append(l[i][1]-1)
 
L4=[]
for i in range(n):
  L4.append(0)
for i in range(q):
  L4[l2[i][0]-1]+=l2[i][1]
distance=[0 for i in range(n)]
distance[0]=L4[0]
ans=[0 for i in range(n)]
ans[0]=L4[0]
L=[0]
L2=[]
L3=[]
while len(L2)!=n and len(L)!=0:
  for j in range(len(L)):
    for k in range(len(connection[L[j]])):
      distance[connection[L[j]][k]]=distance[L[j]]+L4[connection[L[j]][k]]
      L3.append(connection[L[j]][k])
    L2.append(L[j])
  L=L3
  L3=[]
for i in range(len(distance)):
  distance[i]=str(distance[i])
print(' '.join(distance))

Measured memory_bytes: 148968
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    ll n;
    cin >> n;

    int m = 5;

    ll a[5];
    for (int i = 0; i < m; i++) {
        cin >> a[i];
        if (i > 0) a[i] = min(a[i], a[i - 1]);
    }

    cout << (n + a[m - 1] - 1) / a[m - 1] + m - 1 << endl;

    //aは広義単調減少としてよい

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define hhh printf("hhh\n")
#define see(x) (cerr<<(#x)<<'='<<(x)<<endl)
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
inline int read() {int x=0;char c=getchar();while(c<'0'||c>'9')c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x;}

const int maxn = 1e5+10;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-7;

int a[maxn];
struct P{
    int p, id;
    bool operator < (const P &rhs) const {
        return p<rhs.p;
    }
}p[maxn];

int main() {
    //ios::sync_with_stdio(false); cin.tie(0);
    int N=read();
    for(int i=1; i<=N; ++i) p[i].p=read(), p[i].id=i; sort(p+1,p+1+N);
    for(int i=1; i<=N; ++i) printf("%d%c", p[i].id, " \n"[i==N]);
}

Measured memory_bytes: 1536
/*
	  Chase
	   Your	
	  Legend

	英雄志逐传奇
*/

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

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

	if (D == 0 && N == 100) {
		cout << "101" << endl;
	}
	else if (D == 0 && N != 100) {
		cout << N << endl;
	}
	else if (D == 1 && N == 100) {
		cout << "10100" << endl;
	}
	else if (D == 1 && N != 100) {
		cout << 100 * N << endl;
	}
	else if (D == 2 && N == 100) {
		cout << "1010000" << endl;
	}
	else {
		cout << N * 10000 << endl;
	}
}

Measured memory_bytes: 764