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

typedef long long int ll;
//Factors of an num
/*
vector<ll> fact(ll n){
	vector<ll>v;
	for(int i=1;i*i<=n;i++){
		if(n%i ==0){
			v.push_back(i);
		
		if(i!=n/i)
			v.push_back(n/i);
	    }
	}

	return v;
}
*/


/*
Seive Of Eratos..
int N=1e5;
vector<bool> isprime(N+1,true);
void pri(int n){
	for(int i=2;i*i<=n;i++){
		if(isprime[i]){
			for(int j=i*i;j<=n;j+=i){
				isprime[j]=false;
			}
		}
	}
	return;
}
*/

/*
//Prime Factors
vector<bool> isprime(1e6+1,true);
 vector<int> primes;
 void sieve()
 {

    ll  i,j;
    isprime[0] = false;
    isprime[1] = false;

    for(i=2; i<=1e6 ;i++)
  {

    if(isprime[i])
    {

      primes.push_back(i);

      for(j=i*i; j<=1e6; j+=i)
      {
        isprime[j]=false;
      }

    }

  }
}

vector<int> primefactors(int  N)

 {

    vector<int> factors;
    ll pf_idx = 0, pf=primes[pf_idx];

    while(pf*pf<=N)
    {
        while(N % pf == 0)
        {
            N/=pf;
            factors.push_back(pf);
        }
        pf = primes[++pf_idx];
    }
    
    if(N != 1) factors.push_back(N);
    return factors;
}
 */   




int main(){
	 
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     double d,s,t;
  
  cin>>d>>t>>s;
  if((d/s)<=t){
  	cout<<"Yes\n";
  }
  else{
  	cout<<"No\n"<<endl;
 }
 return 0;
}


Measured memory_bytes: 3740
import sys
def input(): return sys.stdin.readline().strip()
mod = 10**9+7

class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv


def factorization(n):
    if n <= 1:
        print("Input must be over 2!!!!!!")
        return
    arr = []
    temp = n
    for i in range(2, int(round(n ** 0.5)) + 1):
        cnt = 0
        while temp % i == 0:
            cnt+=1
            temp //= i
        if cnt > 0: arr.append([i, cnt])
    if temp!=1: arr.append([temp, 1])
    if arr==[]: arr.append([n, 1])
    return arr


def main():
    S = int(input())
    comb = Combination(5000)
    ans = 0
    for n in range(1, S):
        total = S - n * 3
        if total < 0: continue
        ans += comb(total + n - 1, total)
        ans %= mod
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 67760
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;


public class Main{
	
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    }
	//static long INF = (Long.MAX_VALUE/2);
	static List<Integer> ar[];
	static boolean vis[];
	static int dp[];
	static int dfs(int s)
	{
		Iterator<Integer> itr = ar[s].iterator();
		if(!itr.hasNext())
		{
			dp[s] = 1;
			return 1;
		}
		while(itr.hasNext())
		{
			int n = itr.next();
			if(!vis[n])
			{
				vis[n] = true;
				dp[s] = Math.max(dp[s], dfs(n)+1);
			}
			else
			{
				dp[s] = Math.max(dp[s],dp[n]+1);
			}
			
		}
		return dp[s];
		
	}
	public static void main(String[] args) 
	{
		OutputStream outputStream = System.out;
        FastReader sc = new FastReader();
        PrintWriter out = new PrintWriter(outputStream);
        int n = sc.nextInt();
        int m = sc.nextInt();
        dp = new int[n];
        ar = new List[n];
        
        for(int i = 0; i < n; i++)
        {
        	ar[i] = new ArrayList<>();
        }
        vis = new boolean[n];
        Arrays.fill(vis,false);
        for(int i = 0; i < m; i++)
        {	
        	int f = sc.nextInt();
        	int t = sc.nextInt();
        	ar[f-1].add(t-1);
        }
        for(int i = 0; i < n; i++)
        {	
        	if(!vis[i])
        	dfs(i);
        }
        int ans = 0;
        for(int i = 0; i < n; i++)
        {
        	ans = Math.max(ans,dp[i]);
        }
        out.println(ans-1);
        out.close();
	}

}


Measured memory_bytes: 55912
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

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

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

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

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

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class CMultipleGift {
public:
    void solve(std::istream &in, std::ostream &out) {
        ll x, y;
        in >> x >> y;
        int res = __lg(y / x) + 1;
        out << res << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    CMultipleGift solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 5e5 + 10;

vector<int> g[N];
bool viss[N];
int vis[N];

// Normal DFS
void dfs(int curr, int par)
{
  for(auto x: g[curr])
    if(x != par)
      dfs(x, curr);
}

// DFS with visiting status
void dfs1(int curr, int par)
{
  viss[curr] = 1;
  for(auto x: g[curr])
    if(!viss[x])
      dfs1(x, curr);
}

// DFS with strongly connected component
void dfs2(int curr, int par, int num)
{
  vis[curr] = num;
  for(auto x: g[curr])
    if(vis[x] == 0)
      dfs2(x, curr, num);
}

// XOR from 0 to n
ll fxor(ll n)
{
  if(n < 0) return 0;
  if(n % 4 == 3) return 0;
  else if(n % 4 == 0) return n;
  else if(n % 4 == 1) return n^(n-1);
  else if(n%4 == 2) return n^(n-1)^(n-2);
}

// Power in logn with mod 1000000007
llt ppow(llt x, llt y)
{
  llt res = 1;
  while(y > 0){
    if(y&1)
      res = (res * x)%M;
    y = y >> 1;
    x = (x * x)%M;
  }
  return res;
}

// Factorial with dp
llt factdp[N];
llt fact(llt x)
{
  if(x == 0) return 1;
  if(x == 1) return 1;
  if(factdp[x] != -1) return factdp[x];
  return factdp[x] = (x*fact(x-1))%M;
}

// String return to base b
string ansConv ="";
void convert10tob(llt N, int b)
{
     if (N == 0)
        return;
     int x = N % b;
     N /= b;
     if (x < 0)
        N += 1;
     convert10tob(N, b);
     ansConv += to_string(x);
     return;
}

// Convert string to num wiht base b
llt convertstrtob(string a, int b)
{
  llt aa = 0;
  llt mul = 1;
  for(int i=a.length()-1; i>=0; i--)
  {
    int curr = a[i] - '0';
    aa += (curr * mul);
    mul *= b;
  }
  return aa;
}

// Union Find algo with array
// Find()
int findpar(int curr, int arr[])
{
  while(arr[curr] != curr) curr = arr[curr];
  return curr;
}
// Union()
void Union(int b, int spa, int arr[])
{
  while(arr[b] != b)
  {
    int c = arr[b];
    arr[b] = spa;
    b = c;
  }
  arr[b] = spa;
}

// Main Code

int main()
{
  int a, b;
  cin>>a>>b;
  int ans = (a+b)%24;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 12160
#!/usr/bin/env python

from collections import deque, defaultdict
import itertools as ite
import sys
import math
import decimal

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = map(int, raw_input().split())
S = raw_input()

cnt = 0
for i in range(N - 1):
    if S[i] != S[i + 1]:
        cnt += 1

cnt -= K * 2
cnt = max(cnt, 0)
print N - 1 - cnt

Measured memory_bytes: 7084
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define F first
#define S second
#define bitcnt(v) __builtin_popcount(v)
#define all(v) v.begin(), v.end()


void solution(){
	int n; cin >> n;
	vector<int> a(n),b(n);
	for(auto& x : a) cin >> x;
	for(auto& x : b) cin >> x;	
	reverse(all(b));
	int l = n, r = -1, e = -1e9;
	for(int i = 0; i < n; i++){
		if(a[i] == b[i]){
			e = a[i];
			l = min(l, i);
			r = max(r, i);
		}
	}
	if(e == -1e9){
		cout << "Yes\n";
		for(int x : b) cout << x << " ";
		cout << endl;
		return;
	}
	int j = l;
	for(int i = 0; i < l && j <= r; i++){
		if(a[i] != e && b[i] != e){
			swap(b[i],b[j]);
			j++;
		}
	}
	for(int i = n-1; i > r && j <= r; i--){
		if(a[i] != e && b[i] != e){
			swap(b[i],b[j]);
			j++;
		}
	}
	if(j > r){
		cout << "Yes\n";
		for(int x : b) cout << x << " ";
		cout << endl;
	}
	else{
		cout << "No\n";
	}
}	


int main(){ 
	fio;
	int t;
	t = 1;
	// cin >> t;
	for(int i = 1; i <= t; i++){
		// cout << "Case #" << i << ": ";
		solution();
	} 
	return 0;
}

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

int main()
{
    int n,k;
    cin>>n>>k;
    
    int arr[n],arr1[n];
    for(int i=0;i<n;i++)
    cin>>arr[i];
    
    arr1[n-1]=0;
   
    
    for(int i=n-2;i>=0;i--)
    {
        int l=min(k+i,n-1);
        int min1=abs(arr[l]-arr[i])+arr1[l];
       for(int j=i+1;j<l;j++)
       {
           min1=min(min1,abs(arr[j]-arr[i])+arr1[j]);
       }
       arr1[i]=min1;
    }
    cout<<arr1[0];
    
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define pb push_back
#define ii pair<int,int>
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define int long long int
using namespace std;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
 //     freopen("q.gir","r",stdin);
 //     freopen("q.cik","w",stdout);
      int n,k;
      cin>>n>>k;
      vector<int>arr(n+1,0);
      for(int i=1;i<=n;i++)cin>>arr[i];
      vector<int>dp(n+1,INF);
      dp[0]=0;
      dp[1]=0;
      for(int i=2;i<=n;i++){
            for(int j=1;j<=k&&j<i;j++)
            dp[i]=min(dp[i-j]+abs(arr[i]-arr[i-j]),dp[i]);
      }
      cout<<dp[n];
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,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; }

ll MOD = 1000000007;

int main(void){
  int n; cin >> n;
  char c[n];
  int red = 0, white = 0;
  rep(i,n){
    cin >> c[i];
    if(c[i] == 'R') red++;
    else white++;
  }
  int ans = 0;
  rep(i,red){
    if(c[i] == 'W'){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3820
use std::cmp::min;
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident) => {
        $it.next().unwrap().parse().unwrap()
    };
    ($it: ident,2) => {
        (parse!($it), parse!($it))
    };
    ($it: ident,3) => {
        (parse!($it), parse!($it), parse!($it))
    };
    ($it: ident,4) => {
        (parse!($it), parse!($it), parse!($it), parse!($it))
    };
    ($it: ident, $n: ident) => {
        (&mut $it).take($n).map(|e| e.parse().unwrap()).collect();
    };
}

fn dfs(
    g: &Vec<Vec<usize>>,
    s: usize,
    t: usize,
    parents: &mut Vec<usize>,
    seen: &mut Vec<bool>,
) -> bool {
    seen[s] = true;
    if s == t {
        true
    } else {
        let n = g.len();
        for v in 0..n {
            if !seen[v] && g[s][v] > 0 && dfs(g, v, t, parents, seen) {
                parents[v] = s;
                return true;
            }
        }
        false
    }
}
fn calc_maxflow(g: &Vec<Vec<usize>>, s: usize, t: usize) -> usize {
    let n = g.len();
    let mut ret = 0;
    let mut parents = vec![0; n];
    let mut seen = vec![false; n];
    let mut rg = g.clone();
    while dfs(&rg, s, t, &mut parents, &mut seen) {
        let mut d = std::usize::MAX;
        let mut v = t;
        while v != s {
            let u = parents[v];
            d = min(d, rg[u][v]);
            v = u;
        }
        ret += d;
        let mut v = t;
        while v != s {
            let u = parents[v];
            rg[u][v] -= d;
            rg[v][u] += d;
            v = u;
        }
        seen = vec![false; n];
    }
    ret
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    let mut it = s.split_whitespace();
    let (x, y, e): (usize, usize, usize) = parse!(it, 3);
    let n = x + y + 2;
    let mut g = vec![vec![0; n]; n];
    for i in 0..x {
        g[0][i + 1] = 1;
    }
    for j in 0..y {
        g[1 + x + j][n - 1] = 1;
    }
    for _ in 0..e {
        let (xi, yi): (usize, usize) = parse!(it, 2);
        let xi = 1 + xi;
        let yi = 1 + x + yi;
        g[xi][yi] = 1;
    }
    println!("{}", calc_maxflow(&g, 0, n - 1));
}



Measured memory_bytes: 5056
def f(n, s):
    if n % 2 != 0: return "No"
    p1 = 0
    p2 = n//2
    while p2 < n:
        if s[p1] != s[p2]: return "No"
        p1+=1
        p2+=1
    return "Yes"


n = int(input())
s = input()

print(f(n, s))

Measured memory_bytes: 3060
#include<iostream>
#include <algorithm>
#include <string>
using namespace std;
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
typedef long long ll;
const int INF = numeric_limits<int>::max();
const int MOD = (1e9 + 7);


int main(){
  string S;
  cin >> S;
  int ans, left, right;
  rep(i, S.size()){
    if(S[i] == 'A'){
      left = i;
      break;
    }
  }
  rep(i, S.size()){
    if(S[i] == 'Z'){
      right = i;
    }
  }
  ans = right - left + 1;
  cout << ans << endl;
 }

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n,a,b;
	cin>>n>>a>>b;
	ll x;
	if(n%(a+b)==0)
		x=n/(a+b);
	else
		x=(n/(a+b))+1;
	//cout<<"x="<<x<<endl;
	ll t=n/(a+b);
	//cout<<"t="<<t<<endl;
	ll count_b=0;
	count_b+=a*t;
	//cout<<"count_b="<<count_b<<endl;
	n-=(a+b)*t;
	if(n>=a)
		count_b+=a;
	else
		count_b+=n;
	cout<<count_b<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll h, w;
    cin >> h >> w;
    string grid[h];
    for (ll i = 0; i < h; i++) cin >> grid[i];
    ll dx[8] = {1, 1, 1, -1, -1, -1, 0, 0};
    ll dy[8] = {0, 1, -1, 0, -1, 1, 1, -1};
    vector<string> ans(h);
    for (ll i = 0; i < h; i++) {
        for (ll j = 0; j < w;j++){
            ll cnt = 0;
            if (grid[i][j] == '#') {
                ans[i].push_back('#');
                continue;
            }
            for (ll k = 0; k < 8; k++) {
                ll newx = j + dx[k];
                ll newy = i + dy[k];
                if (newx >= w || newx < 0 || newy >= h || newy < 0) {
                if (k == 7){
                    char tmp = cnt + '0';
                    ans[i].push_back(tmp);
                    }                    
                    continue;
                }
                if (grid[newy][newx] == '#') cnt++;
                if (k == 7){
                    char tmp = cnt + '0';
                    ans[i].push_back(tmp);
                    }

            }
        }
    }
    for (ll i = 0; i < h; i++) cout << ans[i] << endl;
}

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

using namespace std;

int main() {
    int n;
    string s;
    cin >> n >> s;
    vector<int> E(n + 5);
    vector<int> W(n + 5);
    E[0] = 0;
    W[0] = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'W') {
            W[i + 1] += W[i] + 1;
            E[i + 1] = E[i];
        } else {
            E[i + 1] += E[i] + 1;
            W[i + 1] = W[i];
        }
    }
    int ans = INT32_MAX;
    for (int i = 1; i <= n; i++) {
        if (i == 1) ans = E[n] - E[1];
        else if (i == n) ans = min(ans, W[n - 1]);
        else ans = min(W[i - 1] + E[n] - E[i], ans);
    }
    printf("%d", ans);
    return 0;
}
        


Measured memory_bytes: 2948
#include <iostream>
using namespace std;
int main ()
{
	int result=0, a;
	cin>>a;
	int tako[a];
	for (int i=0; i<a; i++) cin>>tako[i];
	for (int j=0; j<a; j++)
	{
		for (int k=j+1; k<a; k++) result+=(tako[j]*tako[k]); 
	}
	cout<<result<<endl;
	return 0;
}

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

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> vec(N);
  for (int i = 0; i < N; ++i) {
    cin >> vec.at(i);
  }
  
  int sum = 0;
  for (int i = 0; i < N; ++i) {
    sum += vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  
  int count = N-1;
  while (sum <= X) {
    sum = sum + vec.at(0);
    count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
int main(){
    int H,W,i,j;
    while(true){
        std::cin >> H >> W;
        if(H==0 && W==0) break;
        for(i = 0; i< H ; i++){
            for(j=0;j<W;j++){
               if((i+j)%2==0) std::cout << "#";
               else std::cout << ".";
            }
            std::cout << std::endl;
        }
        std::cout  << std::endl;
    }
    return 0;
}


Measured memory_bytes: 3124
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main(){
  int N, W;
  cin >> N >> W;
  vector<int> value(N), weight(N);
  rep(i, N) cin >> value[i] >> weight[i];
  vector<int> dp(W+1, 0);
  
  rep(i, W+1)rep(j, N){
    if (i >= weight[j])
      dp[i] = max(dp[i], dp[i-weight[j]] + value[j]);
  }
  cout << dp[W] << endl;
  
  return 0;
}


Measured memory_bytes: 3144
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[] s = new int[m];
    char[] c = new char[m];
    for(int i = 0; i < m; i++) {
      s[i] = sc.nextInt() - 1;
      c[i] = (sc.next()).charAt(0);
    }
    int ans = -1;
    for(int i = (int)Math.pow(10, n - 1); i < (int)Math.pow(10, n); i++) {
      String d = String.valueOf(i);
      int p = 0;
      for(int j = 0; j < m; j++) {
        if(d.charAt(s[j]) != c[j]) p++;
      }
      if(p == 0) {
        ans = i;
        break;
      }
    }
    if(n == 1) {
      String d = String.valueOf(0);
      int p = 0;
      for(int j = 0; j < m; j++) {
        if(d.charAt(s[j]) != c[j]) p++;
      }
      if(p == 0) ans = 0;
    }
    System.out.println(ans);
  }
}

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

constexpr size_t DENOM = 1000000007;

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

  std::vector<size_t> a(m);
  for (auto&& ai : a) std::cin >> ai;

  std::vector<bool> ok(n, true);
  for (auto&& ai : a) ok[ai - 1] = false;

  std::vector<size_t> count(n);
  count[0] = ok[0] ? 1 : 0;
  if (n > 1) count[1] = ok[1] ? (count[0] + 1) : 0;
  for (size_t i = 2; i < n; ++i)
    count[i] = ok[i] ? ((count[i - 1] + count[i - 2]) % DENOM) : 0;
  std::cout << count[n - 1] << std::endl;
}


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main(void){
    int N,A,B;
    cin >> N >> A >> B;
    
    int count = 0;
    int memA0, memB0;
    int memA1, memB1;
    
    memA0 = A-1; memA1 = A-1;
    memB0 = B+1; memB1 = B+1;
    
    while(1){
        
    if(!count%2) {
        if(A==memA0 && B==memA0) { cout << "Draw"; return 0; }
        memA0 = A; memB0 = B;
    }
    
    else {
        if(A==memA1 && B==memB1) { cout << "Draw"; return 0; }
        memA1 = A; memB1 = B;
    }
    
    if(A+1 != B) A += 1;
    else if(A-1 != 0) A -= 1;
    else {cout << "Borys"; return 0;}
    
    if(B-1 != A) B -= 1;
    else if(B+1 != N+1) B += 1;
    else {cout << "Alice"; return 0;}
    
    count++;
    
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://arc081.contest.atcoder.jp/tasks/arc081_b>
問題文============================================================
 2×N のマス目があります． すぬけ君は，このマス目に N 個のドミノを，重ならないように敷き詰めました．
 ここで，ドミノは，1×2 または 2×1 のマス目を覆うことができます．
 
 すぬけ君は，赤色，水色，緑色の 3 色を使って，これらのドミノを塗ることにしました．
 このとき，辺で接しているドミノは異なる色で塗るようにします．
 ここで，必ずしも 3 色すべてを使う必要はありません．
 
 このような塗り方が何通りあるかを mod 1000000007 で求めてください．
 
 ただし，ドミノの敷き詰め方は，文字列 S1,S2 を用いて，次のようにして与えられます．
 
 各ドミノは，それぞれ異なる英小文字または英大文字で表される．
 Si の j 文字目は，マス目の上から i 番目，左から j 番目のマスにどのドミノがあるかを表す．
 
 制約
 1≤N≤52
 |S1|=|S2|=N
 S1,S2 は英小文字または英大文字からなる
 S1,S2 は正しいドミノの敷き詰め方を表している

=================================================================

解説=============================================================
直前のドミノがどのようになっているかで、今見ているドミノの塗り方が限られるので、
 パターンを全部確認して、かけていけば良い
================================================================
*/

const ll MOD = 1e9 + 7;
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll N; cin >> N;
    string S1,S2; cin >> S1 >> S2;
    ll ans = 1;
    ll i = 0;
    if(S1[i] == S2[i]){
        /*
         X
         X
         */
        ans *= 3;
        i++;
    }else{
        /*
         X X
         Y Y
         */
        ans *= 6;
        i+=2;
    }
    for(;i<N;){
        if(S1[i] == S2[i]){
            if(S1[i-1] == S2[i-1]){
                /*
                 X Y
                 X Y
                 */
                ans *= 2;
            }else{
                /*
                 YY X
                 ZZ X
                 */
                ans *= 1;
            }
            i++;
        }else{
            if(S1[i-1] == S2[i-1]){
                /*
                 Y XX
                 Y YY
                 */
                ans *= 2;
            }else{
                /*
                 AA XX
                 BB YY
                 */
                ans *= 3;
            }
            i += 2;
        }
        ans%=MOD;
    }
    cout << ans << endl;
	return 0;
}


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

using namespace std;
int sm[101];
int main(){
 int n; cin >> n;
 for(int i=1; i<=n; ++i){
    int x;
    cin >> x;
    sm[i] = x+sm[i-1];
 }
 int res = 100000000;
 for(int i=1; i<=n; ++i){
  res = min(res, abs(sm[n]-2*sm[i]));
 }
 cout << res << "\n";
 return 0;
}


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

int main(){
  int k;
  vector<long> a(3);
  cin >> a[0] >> a[1] >> a[2] >> k;
  sort(a.begin(), a.end());
  for(int i=0; i<k; i++){
    a[2]*=2;
  }
  cout << a[0]+a[1]+a[2];
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  string s;
  cin >> s;
  string abc = "ABC";
  long long dp[100000][4] = {};
  dp[s.size()][3] = 1;
  dp[s.size()][0] = 0;
  dp[s.size()][1] = 0;
  dp[s.size()][2] = 0;
  for(int i = s.size()-1 ; i >= 0; i--){
    for(int j = 0; j < 4; j++){
      if(j == 3){
        if(s[i] == '?') dp[i][3] = dp[i+1][3]*3;
        else dp[i][3] = dp[i+1][3];
      }
      else{
        dp[i][j] = (s[i] == '?' ? 3 : 1) * dp[i+1][j] + ((s[i] == '?' || s[i] == abc[j]) ? 1 : 0) * dp[i+1][j+1];
      }
      dp[i][j] %= 1000000007;
    }
  }
  cout << dp[0][0] << endl;
}


Measured memory_bytes: 3584
#include <iostream>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
//#include <string>
//typedef long long LL;
using namespace std;

int main(){
    int a;
    int b;
    int ans=0;
    cin >> a >> b;
    for(int i=0; i<2;i++){
        if(a>b){
            ans += a;
            a--;
        }else{
            ans += b;
            b--;
        }
    }
    cout << ans << endl;
}

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

#define INFTY 1000000001

class Graph{
public:
	std::vector< std::vector<int> > A;
	int n;

	Graph(int n);

	void SetEdge(int a, int b, int weight);
	void SortEdge();
	void SortEdge_Rec1(int left, int right);
	void SortEdge_Rec2(int left, int mid, int right);

	int Kruskal();

};

Graph::Graph(int n){;
	this->n = n;
}

void Graph::SetEdge(int a, int b, int weight){
	std::vector<int> x;
	x.push_back(a); x.push_back(b); x.push_back(weight);
	A.push_back(x);
	return;
}

void Graph::SortEdge(){
	SortEdge_Rec1(0, A.size());
}

void Graph::SortEdge_Rec1(int left, int right){
	if (left + 1 < right){
		int mid = (left + right) / 2;
		SortEdge_Rec1(left, mid);
		SortEdge_Rec1(mid, right);
		SortEdge_Rec2(left, mid, right);
	}
}

void Graph::SortEdge_Rec2(int left, int mid, int right){
	int n1 = mid - left;
	int n2 = right - mid;
	std::vector< std::vector<int> > L(n1 + 1);
	for (int i = 0; i < n1; i++) L[i] = A[left + i];
	std::vector< std::vector<int> > R(n2 + 1);
	for (int i = 0; i < n2; i++) R[i] = A[mid + i];
	std::vector<int> x;
	x.push_back(0); x.push_back(0); x.push_back(INFTY);
	L[n1] = x;
	R[n2] = x;
	int i = 0;
	int j = 0;
	for (int k = left; k < right; k++){
		if (L[i][2] <= R[j][2]){
			A[k] = L[i];
			i = i + 1;
		}
		else{
			A[k] = R[j];
			j = j + 1;
		}
	}
}

int Graph::Kruskal(){
	std::vector<int> f(n);
	for (int i = 0; i < n; i++) f[i] = i;
	int branch = 0;

	while (!A.empty()){
		std::vector<int> e = A[0];
		A.erase(A.begin());
		if (f[e[0]] != f[e[1]]){
			int tmp = f[e[1]];
			for (int i = 0; i < n; i++) if (f[i] == tmp) f[i] = f[e[0]];
			branch += e[2];
		}
	}
	return branch;
}

int main(){
	int n, e;
	scanf("%d", &n);
	Graph G(n);
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			scanf("%d", &e);
			if (j >= i && e != -1) G.SetEdge(i, j, e);
		}
	}

	G.SortEdge();

	printf("%d\n", G.Kruskal());

	return 0;
}


Measured memory_bytes: 3420
#include<cstdio>
#include<algorithm>
int n,a[100005];
bool comp(int a,int b){return a>b;}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	std::sort(a+1,a+1+n,comp);
	for(int i=2;i<=n;i++)if(a[i]<i)
	{
		//从(i-1,i-1)向上走
		if((a[i-1]-i+1)&1){printf("First\n");return 0;}
		int j=i;while(a[j]==i-1)j++;
		if((j-i)&1){printf("First\n");return 0;}
		printf("Second\n");return 0;
	}if((a[n]-n)&1)printf("First\n");else printf("Second\n");
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<int>> adj; // Outside main
    adj.resize(n); // Inside main
    rep(i, 0, m)
    {
        int a, b;
        cin >> a >> b;
        a--; b--; // To have graph indexed from 0
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    // int n; // number of nodes
    int s = 0; // source vertex

    queue<int> q;
    vector<bool> used(n);
    vector<int> d(n), p(n, -1);

    q.push(s);
    used[s] = true;
    p[s] = -1;
    while (!q.empty()) {
        int v = q.front();
        q.pop();
        for (int u : adj[v]) {
            if (!used[u]) {
                used[u] = true;
                q.push(u);
                d[u] = d[v] + 1;
                p[u] = v;
            }
        }
    }
    bool res = true;
    rep(i, 1, n)
        if (p[i] == -1)
            res = false;
    if (res == true)
    {
        cout << "Yes" << endl;
        rep(i, 1, n)
            cout << p[i] + 1 << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 10640
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
	"strings"
)

const (
	TooLarge = math.MaxInt64
	TooSmall = math.MinInt64
)

func main() {
	scanner := makeWordScanner()
	a := eGetInt(scanner)
	b := eGetInt(scanner)
	c := math.Ceil(100.0 * float64(a) / 8.0)
	if int(math.Floor(float64(c)*0.10)) == b {
		fmt.Println(int(c))
		return
	}
	x := c + 1
	for int(math.Floor(float64(x)*0.08)) == a {
		if int(math.Floor(float64(x)*0.10)) == b {
			fmt.Println(int(x))
			return
		}
		x++
	}
	fmt.Println(-1)
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeCharScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanRunes)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func pow(a, n int) int {
	if n == 0 {
		return 1
	}
	if n == 1 {
		return a
	}
	if n%2 == 1 {
		return pow((a*a), n/2) * a
	}
	return pow((a * a), n/2)
}
func powMod(a, n, mod int) int {
	if n == 0 {
		return 1 % mod
	}
	if n == 1 {
		return a % mod
	}
	if n%2 == 1 {
		return powMod((a*a)%mod, n/2, mod) * a % mod
	}
	return powMod((a*a)%mod, n/2, mod)
}

func factoricalMod(n, count, mod int) int {
	if count == 1 {
		return n % mod
	}
	return (n % mod) * (factoricalMod(n-1, count-1, mod)) % mod
}

func combinationMod(n, a, mod int) int {
	x := factoricalMod(n, a, mod)
	y := factoricalMod(a, a, mod)
	y = powMod(y, mod-2, mod)
	return ((x % mod) * (y % mod)) % mod
}
func countBitOfOn(i, numbits int) int {
	count := 0
	var bit uint64
	for bit = 0; bit < uint64(numbits); bit++ {
		t := 1 << bit
		if i&t > 0 {
			count++
		}
	}
	return count
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll unsigned long long
#define md 1000000007
#define pb push_back
#define ff first
#define ss second
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rep(i,start,end) for(ll i=start;i<end;i++) 
using namespace std;
using namespace __gnu_pbds;
typedef priority_queue<int, vector<int>, greater<int> > min_pq;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> OST;
#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...);
    }


int main(){
    fio();
    string s;
    cin>>s;
    if(s[0]==s[1] and s[0]==s[2])
    cout<<"No";
    else
        cout<<"Yes";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fst first
#define snd second
#define pb push_back
#define IO ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'
using namespace std;
string a,b;
int x,y;

int main()
{
	IO
	cin>>a>>b;

	if(a[0] == 'H')
		x = 1;
	
	if(b[0] == 'H')
		y = 1;
		
	x = x^y;
	if(!x)
		cout<<"H"<<endl;
	else
		cout<<"D"<<endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<(n);i++)
#define all(x) (x).begin(),(x).end()
constexpr auto INF = 5000000000000000;
constexpr auto MOD = 1000000007;
 
int main() {
	string s;
	cin >> s;
	bool k = false;
	if (s[0] == '7')k = true;
	if (s[1] == '7')k = true;
	if (s[2] == '7')k = true;
 
	if (k)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
 
}

Measured memory_bytes: 3596
# coding: utf-8


def main():
    tax8, tax10 = map(int, input().split())

    rate8 = 0.08
    rate10 = 0.1
    value8 = tax8 / rate8
    value10 = tax10 / rate10

    price_min = int(min(value8, value10))
    price_max = int(max(value8, value10)) + 1

    # print('price_min, price_max', price_min, price_max)

    for price in range(price_min, price_max + 1):
        # print(int(price / (1 - rate8)), int(price / (1 - rate10)))
        if int(price * rate8) == tax8 and int(price * rate10) == tax10:
            print(price)
            return 0
    
    print('-1')

    return 0


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
  	cin>>a>>b;
  	for(int i=0;i<=a;i++){
    	if (2*i+4*(a-i)==b){
        	cout<<"Yes"<<endl;
          	return 0;
        }
    }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
ll res[1025][100010],dp[12][100010],v[270000] = {},w[270000] = {};
void dfs(int s,int h,int l){
    if(s>=1024) return;
    int i;
    for(i=0;i<=l;i++){
        dp[h][i] = -1;
    }
    for(i=0;i<=l;i++){
        dp[h][i] = max(dp[h][i],dp[h - 1][i]);
        if(i + w[s]<=l) dp[h][i + w[s]] = max(dp[h][i + w[s]],dp[h - 1][i] + v[s]); 
    }
    res[s][0] = dp[h][0];
    for(i=1;i<=l;i++){
        res[s][i] = max(res[s][i - 1],dp[h][i]);
    }
    dfs(2*s,h + 1,l); dfs(2*s + 1,h + 1,l);
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int i,j,k,n,q;
    cin >> n;
    for(i=1;i<=n;i++){
        cin >> v[i] >> w[i];
    }
    dp[0][0] = 0;
    dfs(1,1,100002);
    cin >> q;
    for(i=0;i<q;i++){
        int ver,l; cin >> ver >> l;
        if(ver<1024){
            cout << res[ver][l] << endl;
        }else{
            vector<int> vect;
            vect.clear();
            while(ver>=1024){
                if(ver>=1024) vect.push_back(ver);
                ver /= 2;
            }
            int sz = vect.size();
            ll ans = 0;
            for(j=0;j<(1<<sz);j++){
                ll val = 0,hev = 0;
                for(k=0;k<sz;k++){
                    if(j & (1<<k)){
                        if(vect[k]<1024) exit(1);
                        val += v[vect[k]]; hev += w[vect[k]];
                    }
                }
                if(hev>l) continue;
                ans = max(ans,res[ver][l - hev] + val);
            }
            cout << ans << endl;
        }
    }
}

Measured memory_bytes: 814836
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,count=0,k=0;
   cin>>n;
   for(int i=1;i<n;i++)
   {
      for(int j=1;j<n;j++)
      {
         if(i*j<n)
         {
            count++;
         }
         else
         {
            goto tag1;
         }
         
      }
      tag1:
      k++;
   }
   cout<<count;
   return 0;
}

Measured memory_bytes: 3620
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include<cmath>
#include<set>
#include<stack>

using namespace std;
typedef unsigned long long ll;

map<string, int>ma;
vector<pair<int, string> >vec;

struct sortVec{
    bool operator()(string m1, string m2){
        return ma[m1]<ma[m2];
    }
}sv;

int main(){
    int n,p;
    while(cin>>n,n){
        ma.clear();
        vec.clear();
        string s;
        for(int i=0;i<n;i++){
            int day,time;
            cin>>s>>day>>time;
            time=(time/100)*60+time%100+day*24*60;
            ma[s]=time;
            vec.push_back(make_pair(time,s));
        }
        sort(vec.begin(),vec.end());
        cin>>p;
//        set<string>fav;
//        for(int i=0;i<p;i++){
//            cin>>s;
//            fav.insert(s);
//        }
//        int p=-100000;
//        bool m=false;
//        int c=0;
//        for(int i=0;i<n;i++){
//            if(p+30>vec[i].first){
//                if(fav.count(vec[i].second)){
//                    if(m){
//                        c=-1;
//                        break;
//                    }else{
//                        m=true;
//                        p=vec[i].first;
//                    }
//                }
//            }else{
//                c++;
//                p=vec[i].first;
//                m=fav.count(vec[i].second);
//            }
//        }
//        cout<<c<<endl;
        vector<string>fav;
        for(int i=0;i<p;i++){
            cin>>s;
            fav.push_back(s);
        }
        sort(fav.begin(),fav.end(),sv);
        vector<string>res;
        res.push_back(fav[0]);
        bool nex=false;
        for(int i=1;i<fav.size();i++){
            if(ma[fav[i]]<ma[fav[i-1]]+30){
                cout<<-1<<endl;
                nex=true;
                break;
            }
            res.push_back(fav[i]);
            sort(res.begin(),res.end(),sv);
        }
        if(nex){
            continue;
        }
        for(int i=0;i<vec.size();i++){
            int start=vec[i].first;
            int resi=0;
            while(resi<res.size()&&ma[res[resi]]+30<=start){
                resi++;
            }
            if(resi==res.size()||start+30<=ma[res[resi]]){
                if(resi>0&&ma[res[resi-1]]+30>start){
                    continue;
                }
                res.push_back(vec[i].second);
                sort(res.begin(),res.end(),sv);
            }
        }
        cout<<res.size()<<endl;
    }
    return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int mod = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n;
  cin >> n;
  
  vector<string> s(n);
  REP(i, n)
    cin >> s[i];
  sort(s.begin(), s.end());
  unique(s.begin(), s.end());
  
  map<char, int> c_index;
  c_index['M'] = 0;
  c_index['A'] = 1;
  c_index['R'] = 2;
  c_index['C'] = 3;
  c_index['H'] = 4;

  vector<ll> count(5, 0);
  REP(i, n){
    char c = s[i][0];
    if(c != 'M' && c != 'A' && c != 'R' && c != 'C' && c != 'H')
      continue;
    else
      count[c_index[c]]++;

  }

  ll sum = 0;
  REP(i, (1<<5)){
    ll num = 0;
    ll tmp = 1;
    REP(j, 5){
      if((i>>j) & 1){
        num++;
        tmp *= count[j];
      }
    }
    //cout << tmp << endl;
    if(num == 3)
      sum += tmp;
  }
  cout << sum << "\n";  
}


Measured memory_bytes: 5760
#include <stdio.h>

int main(int argc, char *argv[])
{
    int		n, i;
    int		min_val, val;
    int		max_profit, profit;

    max_profit = 0x80000000;
    min_val = 0x7fffffff;

    scanf("%d\n", &n);
    for(i = 0; i < n; i++)
    {
	scanf("%d\n", &val);
	profit = val - min_val;

	if (profit > max_profit)
	{
	    max_profit = profit;
	}

	if (val < min_val)
	{
	    min_val = val;
	}
    }

    printf("%d\n", max_profit);

    return 0;
}

Measured memory_bytes: 600
#include <stdio.h>

int main(void) {
  int i,saidai;
  long long int n,ans;
  long long int a[1000000];
  ans=0;
  scanf("%lld",&n);
  for(i=0;i<n;i++)
  {
    scanf("%lld",&a[i]);
  }
  saidai=a[0];
  for(i=0;i<n;i++)
  {
    if(a[i]<saidai)
    {
      while(a[i]<saidai)
      {
        a[i]++;
        ans++;
      }
    }
    else
    {
      saidai=a[i];
    }
  }
  printf("%lld",ans);
  
  return 0;
}

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

x = 0

for i in range(N+1):
    #print(i)
    if i % 15 == 0:
        #FB
        pass
    elif i % 3 == 0:
        #F
        pass
    elif i % 5 == 0:
        #B
        pass
    else:
        x += i

print(x)


Measured memory_bytes: 9164
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	public static long l=0,l2=0;
	public static void main(String[] args) throws IOException {
		l = System.currentTimeMillis();
		new Main().exec();
		l2 = System.currentTimeMillis();
		
	}

	public void exec() throws IOException {
		InputUtil in = new InputUtil();
		PrintWriter out = new PrintWriter(System.out);
		int N = (int)in.nextInt();
		long[] T= in.nextLong(new long[N],N);
		out.println(getLcm(T));
		out.flush();
	}
	private long gcd(long a, long b){
		return b == 0 ? a : gcd(b, a % b);
	}
	private long lcm(long a, long b){
		return a / gcd(a, b) * b;
	}
//	private long getGcd(long a, long b){
//		if(a<b)
//			return getGcd(b,a);
//		long tmp = 0;
//		while (a%b!=0) {
//			tmp = b;
//			b = a%b;
//			a = tmp;
//		}
//		return b;
//	}
//	
//	private long getLcm(long a, long b){
//		if(a<b)
//			return getLcm(b,a);
//		long gcd = getGcd(a,b);
//		return (a/gcd)*b;
//	}
	
	private long getLcm(long[] T) {
		long ans = 1;
		for(int i=0; i<T.length; i++) {
			ans = lcm(ans,T[i]);
		}
		return ans;
	}
}




class InputUtil {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    public int nextInt() throws NumberFormatException, IOException{
    	return Integer.parseInt(br.readLine());
    }
    
    public long[] nextLong(long[] a, int num) throws NumberFormatException, IOException{
        int i=0;
        while(i<num) {
            for(String s: br.readLine().split(" ")){
            	if(i<num) {
                    a[i++] = Long.parseLong(s);
            	}
            }
        }
        return a;
    }

}

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

#define ll long long int
#define hell 998244353
#define vi vector <ll>
#define pb push_back
#define pii pair<ll,ll>
#define vii vector <pii>
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define sep(i,a,b)  for(ll i=a-1;i>=b;i--)
#define inf (ll)(1e16)

using namespace std;

void solve(){
    ll n;
    cin>>n;
    vi a(n),dp(n);
    rep(i,0,n)
        cin>>a[i];
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    rep(i,2,n)
    {
        dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    }
    cout<<dp.back();
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>

int main(){
    ll D, T, S;
    cin >> D >> T >> S;
    long double ans = (long double)(D)/(long double)(S);
    //cout << (long double)(ans);
    if((long double)(ans) <= (long double)(T))cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3632