akhauriyash/Code-Regression huggingface dataset:
/// Author: Wang, Yen-Jen
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 200000 + 7;

inline int my_rand() {
  static int x = 880301;
  return x = (x * 0xdefacedll + 1) % 0x7fffffff;
}

int dp[MAX_N];
pair<int, int> hv[26];
map<pair<int, int>, int> bst;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 0; i < 26; i++) {
    hv[i] = make_pair(my_rand(), my_rand());
  }
  pair<int, int> v = make_pair(0, 0);
  bst.emplace(v, 0);
  string s;
  cin >> s;
  for (int i = 0; i < (int)s.size(); i++) {
    dp[i] = i + 1;
    v.first ^= hv[s[i] - 'a'].first;
    v.second ^= hv[s[i] - 'a'].second;
    for (int j = 0; j < 26; j++) {
      if (bst.count(make_pair(v.first ^ hv[j].first, v.second ^ hv[j].second))) {
        dp[i] = min(dp[i], bst[make_pair(v.first ^ hv[j].first, v.second ^ hv[j].second)] + 1);
      }
    }
    if (bst.count(v)) {
      dp[i] = min(dp[i], bst[v] + 1);
      bst[v] = min(bst[v], dp[i]);
    }
    else
      bst.emplace(v, dp[i]);
  }
  cout << dp[(int)s.size() - 1] << '\n';
  return 0;
}


Measured memory_bytes: 13716
#include<bits/stdc++.h>
using namespace std; 
typedef long long int ll;
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin >> n;
    ll temp = n;
    ll total = 0;
    vector<pair<string, ll>> vec;
    while(n--)
    {
        string str;
        cin >> str;
        ll t;
        cin >> t;
        vec.push_back(make_pair(str, t));
    }
    string x;
    cin >> x; 
    int flag = 0;
    for(ll i = 0; i < temp; i++)
    {
        if(flag == 1)
        {
            total += vec[i].second;
        }
        if(vec[i].first == x)
        {
            flag = 1;
        }
    }
    cout << total << endl;

    return 0;
}

Measured memory_bytes: 256
/*
------------------------------------------------------
 
    Dilon Mein Tum Apni Betaabiyan Leke Chal Rahe Ho,
    Toh Zinda Ho Tum.
       
    Nazar Mein Khwabon Ki Bijliyan Leke Chal Rahe Ho,
    Toh Zinda Ho Tum.
	
    Hawa Ke Jhokon Ke Jaise Aazad Rehno Sikho,
    Tum Ek Dariya Ke Jaise Lehron Mein Behna Sikho,
    Har Ek lamhe Se Tum Milo Khole Apni Bhaayein,
    Har Ek Pal Ek Naya Samha Dekhen Yeh Nigahaein,
    
    Jo Apni Aankhon Mein Hairaniyan Leke Chal Rahe Ho,
    Toh Zinda Ho Tum.
    
    Dilon Mein Tum Apni Betaabiyan Leke Chal Rahe Ho,
    Toh Zinda Ho Tum.   
 
    - Imran ( Zindagi Na Milegi Dobara )
 
-------------------------------------------------------	                                                                                                
 
	Author :- Gaurang_Kothiya
	Nirma University
 
*/ 
 
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
#include <bitset>
#include <cstdint>
#include <initializer_list>
 
using namespace std;
using namespace __gnu_pbds;  
 
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> data_set; 
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ld long double
#define f(i,x,n) for(auto i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(auto i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define rall(a)  a.rbegin(),a.rend()
#define b_s(a,b)   binary_search( all(a),b)
#define lb(v,n)  lower_bound(all(v) ,n )
#define ub(v,n)  upper_bound( all(v) , n)
#define gcd(a,b) __gcd(a,b)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define RE rend()
#define RB rbegin()
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair<a,b>
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map<a,b>
#define u_m(a,b) unordered_map<a,b>
#define mm(a,b) multimap<a,b>
#define s(a) set<a>
#define us(a) unordered_set<a>
#define ms(a) multiset<a>
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846
#define MOD 1000000007
 
 
 
 
 
void Solve()
{	
	ll a,ans;
	ld x;
	cin>>a>>x;
	ld tmp= a*x;
	ans= (ll) tmp;
	cout<<ans;
	
}
 
 
 
 
signed main() 
{
	speed	
	
	int q=1;
	//cin>>q;
	
	while(q--)
	Solve();
	
	//cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
	return 0;
} 

Measured memory_bytes: 3728
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(), x.end()

const ll mod = 1e9 + 7;
const ll N = 2005;
ll C[N][N];
void precalc() {
  for (ll i = 0; i < N; i++) C[i][0] = 1;
  for (ll i = 1; i < N; i++) {
    for (ll j = 1; j < N; j++) {
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
    }
  }
}

int main() {
  ll n, k, r;
  cin >> n >> k;
  r = n - k;
  precalc();
  for (ll i = 1; i <= k; i++) {
    ll ans = C[r + 1][i] * C[k - 1][i - 1] % mod;
    cout << ans << endl;
  }
}

Measured memory_bytes: 31744
import java.util.*;

public class Main {

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

        int n = sc.nextInt();
        List<String> valueList = new ArrayList<>();

        for (int i = 0; i < n; i++){
            valueList.add(sc.next());
        }

        List<String> bubbleSortList = bubbleSort(valueList, n);

        if (isStable(valueList, bubbleSortList, n)){
            System.out.println("Stable");
        }else {
            System.out.println("Not stable");
        }

        List<String> selectionSortList = selectionSort(valueList, n);

        if (isStable(valueList, selectionSortList, n)){
            System.out.println("Stable");
        }else {
            System.out.println("Not stable");
        }
    }

    private static int getValue(String valueString){
        return Integer.parseInt(valueString.substring(1,2));
    }

    private static List<String> bubbleSort(List<String> valueList, int n){
        List<String> sortedList = new ArrayList<>(valueList);

        for (int i = 0; i < n; i++){
            for (int j = n-1; j > i; j--){
                if (getValue(sortedList.get(j)) < getValue(sortedList.get(j - 1))){
                    String tempStr = sortedList.get(j);

                    sortedList.set(j, sortedList.get(j-1));
                    sortedList.set(j -1, tempStr);
                }
            }
        }

        System.out.println(String.join(" ", sortedList ));
        return sortedList;
    }

    private static boolean isStable(List<String> in, List<String> out, int n){
        for (int i = 0; i < n; i ++){
            for (int j = i + 1; j < n-1; j ++){
                for (int a=0; a< n; a ++){
                    for (int b = a+1; b < n; b ++){
                        if (getValue(in.get(i)) == getValue(in.get(j)) && in.get(i).equals(out.get(b)) && in.get(j).equals(out.get(a))){
                            return false;
                        }
                    }
                }
            }
        }

        return true;
    }

    private static List<String> selectionSort(List<String> valueList, int n){
        List<String> selectionSortList = new ArrayList<>(valueList);
        for (int i = 0; i < n; i++){
            int minj = i;
            for (int j = i; j < n; j ++){
                if (getValue(selectionSortList.get(j)) < getValue(selectionSortList.get(minj))){
                    minj = j;

                }
            }
            String tempStr = selectionSortList.get(i);
            selectionSortList.set(i, selectionSortList.get(minj));
            selectionSortList.set(minj, tempStr);
        }
        System.out.println(String.join(" ", selectionSortList ));
        return selectionSortList;

    }
}


Measured memory_bytes: 58628
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <map>
#include <queue>
#include <vector>
#include <unordered_set>
using namespace std;

int main() {
    int i = 0;
    int j = 0;
    string a;
    cin >> a;
    int i1,i2;
    i1 = i2 = -1;
    int len = a.size();
    for (i = 0; i<len; i++) {
        if(a[i]=='C' && i1 < 0)
            i1 = i;
        if (a[i]=='F') {
            i2 = i;
        }
    }
    
    if (i1 < i2 && i1>=0) {
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    
       return 0;
    
}

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

int main() {
  int H, N;
  cin >> H >> N;
  vector<int> attack(N);
  for(int i=0; i<N; i++){
    cin >> attack.at(i);
  }
  int sum = 0;
  for(int i=0; i<N; i++){
    sum += attack.at(i);
  }
  if(sum >= H){
    cout << "Yes" << endl;
  } else 
    cout << "No" << endl;
}

Measured memory_bytes: 640
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <regex>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using VL=vector<ll>;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
const long long INF =  99999999999;

ll dp[(1<<13)+2],N,M,d[1010],a[1010],b[1010];

int main(){
  cin>>N>>M;
  fill(d,d+N,0);
  REP(i,M){
    cin>>a[i]>>b[i];
    REP(j,b[i]){
      ll c;
      cin>>c;
      c--;
      d[i]|=(1<<c);
    }
  }

  dp[0]=0;
  FOR(i,1,(1<<13)+2)dp[i]=INF;

  REP(i,1<<N){
      if(dp[i]==INF)continue;
      REP(j,M){
        dp[i|d[j]]=min(dp[i|d[j]],dp[i]+a[j]);
      }
  }
  if(dp[(1<<N)-1]==INF) cout<<-1<<endl;
  else printf("%lld\n",dp[(1<<N)-1]);
}


Measured memory_bytes: 512
n = int(input())

data = input().split()

array = []

for i in data:
  array.append(int(i))

for i in range(1, n):
  print(*array)

  key = array[i]

  j = i - 1

  while j >= 0 and array[j] > key:
    array[j+1] = array[j]
    j -= 1

  array[j+1] = key 

print(*array)

  


Measured memory_bytes: 5976
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int64_t N,A,B;

int main()
{
    using std::endl;
    in.sync_with_stdio(false);
    out.sync_with_stdio(false);
    in.tie(nullptr);
    out.tie(nullptr);

    in >> N>>A>>B;
    int64_t res = A*(N / (A + B));
    res += std::min(A, (N % (A + B)));
    out << res << endl;

    return 0;
}
#endif


Measured memory_bytes: 384
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var afterLeaves = new long[a.Length];

        for (int i = a.Length - 2; i >= 0; i--)
            afterLeaves[i] = afterLeaves[i + 1] + a[i + 1];
        
        long nodeCount = 1;
        long res = 0;
        for (int i = 0; i < a.Length; i++)
        {
            var item = a[i];
            res += nodeCount;
            nodeCount -= item;
            if (nodeCount < 0)
            {
                Console.WriteLine(-1);
                return;
            }
            nodeCount *= 2;
            nodeCount = Min(nodeCount, afterLeaves[i]);
        }
        Console.WriteLine(res);
    }
}


Measured memory_bytes: 38240
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<string>
#include<queue>

using namespace std;

int modd=1e9+7;
int n;
vector<vector<int> >  adj_l;
vector<vector<long long> > dp;

void solve(int cur, int par){
    int noc=adj_l[cur].size();
    if(noc==1){ if(adj_l[cur][0]==par){ return; } }
    int next;
    for(int i=0; i<noc; i++){
        next=adj_l[cur][i];
        if(next!=par){
            solve(next,cur);
            dp[cur][1]*=(dp[next][1]+dp[next][0]); dp[cur][1]%=modd;
            dp[cur][0]*=dp[next][1]; dp[cur][0]%=modd;
        }
    }
    return ;
}

int main(){
    cin>>n;
    adj_l.resize(n+1);

    int x,y;
    for(int i=0; i<n-1; i++){
        cin>>x>>y;  adj_l[x].push_back(y); adj_l[y].push_back(x);
    }

    dp.resize(n+1);
    vector<long long> temp(2); temp[0]=1; temp[1]=1;
    for(int i=0; i<=n; i++) dp[i]=temp;

    solve(1,0);
    cout<<(dp[1][0]+dp[1][1])%modd<<endl;

}


Measured memory_bytes: 16768
#include <bits/stdc++.h>
#define rep(i,n) for(int i=1;i<=n;++i)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
using namespace std;

int main(){
  string str;
  cin >> str;
  str = str.substr(4,6);
  cout << "2018"+str << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
C = [[0]*10 for _ in range(10)]
for i in range(1,n+1):
    C[int(str(i)[0])][int(str(i)[-1])] += 1
ans = 0
for i in range(10):
    for j in range(10):
        ans += C[i][j]*C[j][i]
print(ans)

Measured memory_bytes: 9192
#include <iostream>
using namespace std;
typedef long long ll;
ll n,m,dp[1001][(1LL<<12)],a,b,v,L,INF=1e15;
int main(void){
    cin>>n>>m;
    for(int i=0;i<=m;i++){
        for(int j=0;j<(1LL<<n);j++){
            dp[i][j]=INF;
        }
    }
    dp[0][0]=0;
    for(int i=0;i<m;i++){
        cin>>v>>a;
        L=0;
        for(int j=0;j<a;j++){
            cin>>b;
            b--;
            L+=(1LL<<b);
        }
        for(ll j=0;j<(1LL<<n);j++){
            dp[i+1][j|L]=min(dp[i+1][j|L],dp[i][j]+v);
            dp[i+1][j]=min(dp[i][j],dp[i+1][j]);
        }
    }
    if(dp[m][(1LL<<n)-1]==INF){
        cout<<-1<<endl;
        return 0;
    }
    cout<<dp[m][(1LL<<n)-1]<<endl;
}


Measured memory_bytes: 32256
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


N = z()
A = zz()
c = collections.Counter(A)
ans = 0
for x in range(max(A)+1):
    tmp = c[x]
    try:
        tmp += c[x-1]
    except:
        pass
    try:
        tmp += c[x+1]
    except:
        pass
    ans = max(tmp, ans)
print(ans)


Measured memory_bytes: 53024
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  vector<int>p(n,0);
  for(int i=0;i<n;i++)
  	cin>>p[i];
  sort(p.begin(),p.end());
  int s=0;
  for(int i=0;i<k;i++)
    s+=p[i];
  cout<<s;
}

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

int main() {
  int a, b, c, x;
  cin >> a >> b >> c >> x;
  int cnt = 0;
  for (int i = 0; i <= a; i++) {
    for (int j = 0; j <= b; j++) {
      for (int k = 0; k<= c; k++) {
        if (500*i + 100*j + 50*k == x) cnt++;
      }
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int power(int b){
  int j=0;
  while(b%2==0){
    b=b/2;
    j++;
  }
  return j;
}

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n;
  cin>>n;
  int a[250];
  int c[250];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    
      c[i]=power(a[i]);
    
  }
  sort(c,c+n);
  cout<<c[0];
  
}


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
const long long Mod=1e9+7;
long long n,a[200005],b[200005],f[8005][8005],inv[8005],ans,fac[8005];
long long quipow(long long a,long long b)
{
	long long ret=1;
	while(b){
		if(b&1) ret=(ret*a)%Mod;
		b>>=1;
		a=(a*a)%Mod;
	}
	return ret;
}
int main()
{
	fac[0]=fac[1]=1;
	for(int i=2;i<=8000;i++) fac[i]=(fac[i-1]*i)%Mod;
	inv[8000]=quipow(fac[8000],Mod-2);
	for(int i=7999;i>=0;i--)inv[i]=(inv[i+1]*(i+1))%Mod;
	scanf("%lld",&n);
	for(int i=1;i<=n;i++) scanf("%lld%lld",&a[i],&b[i]),f[2001-a[i]][2001-b[i]]++;
    for(int i=1;i<4002;i++) for(int j=1;j<4002;j++) f[i][j]=(f[i][j]+f[i-1][j]+f[i][j-1])%Mod;
    for(int i=1;i<=n;i++) ans=(ans+f[2001+a[i]][2001+b[i]])%Mod;
    for(int i=1;i<=n;i++) ans=(ans-(fac[(a[i]+b[i])<<1]*inv[a[i]<<1]%Mod*inv[((a[i]+b[i])<<1)-(a[i]<<1)]%Mod)+Mod)%Mod;
    ans=(ans*quipow(2,Mod-2))%Mod;
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 255360
#include <bits/stdc++.h>
using namespace std;
#define LL long long
const int N = 200000;
int n, q;
LL s[N], top;
LL f[N], g[N];
int main()
{
    cin >> n >> q;
    top = 1; s[1] = n;
    for (int i = 1; i <= q; ++ i)
    {
        LL x;
        cin >> x;
        while (s[top] >= x) s[top --] = 0;
        s[++ top] = x;
    }
    f[top] = 1;
    for (int i = top; i > 1; -- i)
    {
        LL x = s[i];
        while (x > s[1])
        {
            int t = lower_bound(s + 1, s + top + 1, x) - s - 1;
            f[t] += (x / s[t]) * f[i];
            x %= s[t];
        }
        g[x] += f[i];
        f[i] = 0;
    }
    g[s[1]] += f[1];
    for (int i = n; i >= 1; -- i) g[i] += g[i + 1];
    for (int i = 1; i <= n; ++ i) cout << g[i] << endl;
}


Measured memory_bytes: 4992
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := next()
	a := next()
	b := next()
	fmt.Print(do(n, a, b))
}

func next() int64 {
	sc.Scan()
	i, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func do(n, a, b int64) int64 {
	num0 := n
	div := num0 / (a + b)
	mod := num0 % (a + b)
	num1 := div * a
	num2 := min(mod, a)
	return num1 + num2
}

func min(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}


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

int main() {
    int x; cin >>x;
    vector<int> nums;
    nums.push_back(1); // 1は何乗しても1だから
    for (int i = 2; i <= 31; i++) {
        int tmp = i;
        while (tmp*i<=1000) {
            nums.push_back(tmp*i);
            tmp *= i;
        }
    }
    sort(nums.begin(), nums.end());
    int ret = 1;
    for (auto i: nums) {
        if (i>x) {break;} else {ret=i;}
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
d = {}
flag = 0
for i in range(m):
    s,c = map(int,input().split())
    if s in d:
        if d[s] == c:
            continue
        else:
            flag = -1
    else:
        d[s] = c
ans = 0
if flag == -1:
    print(-1)
else:
    if n == 1:
        if 1 in d:
            print(d[1])
        else:
            print(0)
    elif n == 2:
        if 1 in d:
            if d[1] == 0:
                print(-1)
            else:
                if 2 in d:
                    print(d[1]*10+d[2])
                else:
                    print(d[1] * 10)
        else:
            if 2 in d:
                print(10 + d[2])
            else:
                print(10)
    elif n == 3:
        if 1 in d:
            if d[1] == 0:
                print(-1)
            else:
                if 2 in d:
                    if 3 in d:
                        print(d[1] * 100 + d[2] * 10 + d[3])
                    else:
                        print(d[1] * 100 + d[2] * 10)
                else:
                    if 3 in d:
                        print(d[1] * 100 + d[3])
                    else:
                        print(d[1] * 100)
        else:
            if 2 in d:
                if 3 in d:
                    print(100 + d[2] * 10 + d[3])
                else:
                    print(100 + d[2] * 10)
            else:
                if 3 in d:
                    print(100 + d[3])
                else:
                    print(100)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define For(i,a,b) for(int i = a; i <= b; ++i)
#define maxN 500005
#define ll long long
#define fast_read ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int n;
ll ans = 0, f[maxN];
vector<int>a[maxN];
string s;
bool visit[maxN];
void dfs(int u)
{
    visit[u] = true;
    for(int v : a[u])
    {
        if(!visit[v])dfs(v);
        f[u] = max(f[u], f[v] + 1);
    }
}
int main()
{
    fast_read;
    cin>>s;
    for(int i = 0; i < s.size(); i++)
    {
        if(s[i] == '>')a[i].push_back(i + 1);
        else
            a[i + 1].push_back(i);
    }
    n = s.size() + 1;
    For(i,0,n - 1)
        if(!visit[i])dfs(i);
    For(i,0,n - 1)ans += f[i];
    cout<<ans;
}


Measured memory_bytes: 55964
#include<bits/stdc++.h>
//#include<stdint-gcc.h>

using namespace std;

map<int,int> mp;

bool sortcol(const vector<int>& v1, const vector<int>& v2 )
{
    return v1[1] < v2[1];
}

long long int a[3000];
long long int dp[3000][3000][2];
bool checker[3000][3000][2];

long long int recursion(int start, int ender, int turn)
{
    if(start>ender)
        return 0;
    if(checker[start][ender][turn]==true)
        return dp[start][ender][turn];
    if(turn==1)
    {
        dp[start][ender][turn]=max(recursion(start+1,ender,0)+a[start],recursion(start,ender-1,0)+a[ender]);
        checker[start][ender][turn]=true;
    }
    else
    {
        dp[start][ender][turn]=min(recursion(start+1,ender,1)-a[start],recursion(start,ender-1,1)-a[ender]);
        checker[start][ender][turn]=true;
    }
    return dp[start][ender][turn];
}

int main()
{
    int test=1;
    //cin>>test;
    while(test--)
    {
        int n;
        cin>>n;
        for(int i=0;i<n;++i)
        {
            for(int j=0;j<n;++j)
            {
                for(int k=0;k<2;++k)
                {
                    checker[i][j][k]=false;
                    dp[i][j][k]=0;
                }
            }
        }
        for(int i=0;i<n;++i)
            cin>>a[i];
        cout<<recursion(0,n-1,1);
    }

    return 0;
}



Measured memory_bytes: 158720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  char c;
  cin >> c;
  if ('A' <= c && c <= 'Z') {
    cout << "A" << endl;
  } else {
    cout << "a" << endl;
  }
}

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

using namespace std;

typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef long long ll;

const int inf = 1e9;
const ll inf64 = 1e18;

int main() {

#ifdef debug
    freopen("input.txt", "r", stdin);
#endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, m;

    cin >> n >> m;

    vector<vector<int>> a(n, vector<int>(m)), dist = a;

    queue<pii> q;

    vector<pii> ds = {
            {-1, 0}, {+1, 0}, {0, -1}, {0, +1}
    };

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            dist[i][j] = inf;
            char c;
            cin >> c;
            a[i][j] = c == '#';
            if (a[i][j]) {
                q.push({i, j});
                dist[i][j] = 0;
            }
        }
    }

    while (!q.empty()) {
        int vi, vj;
        tie(vi, vj) = q.front();
        q.pop();
        for (pii dir : ds) {
            int ti, tj;
            tie(ti, tj) = dir;
            ti += vi;
            tj += vj;
            if (ti < 0 || ti >= n || tj < 0 || tj >= m) continue;
            if (dist[ti][tj] > dist[vi][vj] + 1) {
                dist[ti][tj] = dist[vi][vj] + 1;
                q.push({ti, tj});
            }
        }
    }

    int res = 0;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            res = max(res, dist[i][j]);
        }
    }

    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 16400
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
const int Q=1<<19;
int las[Q],e[Q<<1],nn[Q<<1],inc=1,tt=0;
int si[Q],fl=0;
int sid[2]={-1,-1},sv=0;
int vis[Q];
int opt[Q];
int sig=0;
void dfs(int x,int last,int dep)
{
    vis[x]=1;
    si[x]=dep?1:-1;
    for(int i=0;i<2;i++)
        if(sid[i]==x)si[x]+=sv,opt[x]+=1-2*i;
    for(int t=las[x];t;t=nn[t]){
        int y=e[t];
        if(y==last||(t>>1)==tt)continue;
        if((!fl)&&vis[y]){
            tt=t>>1;
            fl=1;
            sid[0]=x,sid[1]=y;
            continue;
        }
        dfs(y,x,dep^1);
        si[x]+=si[y];
        opt[x]+=opt[y];
    }
    for(int i=0;i<2;i++)
        if(sid[i]==x)
            sig^=dep;
}
void ins(int x,int y)
{
    e[++inc]=y;
    nn[inc]=las[x];
    las[x]=inc;
}
#define ll long long
int n,m;
ll Abs(ll a)
{return a>0?a:-a;}
void Gans(ll als)
{
    for(int i=1;i<=n;i++)
        als+=Abs(si[i]);
    cout<<als;
    exit(0);
}
int cmp[Q];
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1,x,y;i<=m;i++)
        scanf("%d%d",&x,&y),ins(x,y),ins(y,x);
    dfs(1,0,1);
    if(m<n){
        if(si[1])return 0&puts("-1");
        Gans(0);
    }
    if(!sig){
        if(si[1]%2!=0)return 0&puts("-1");
        sv=-si[1]/2;
        dfs(1,0,1);
        Gans(Abs(sv));
    }
    if(si[1])return 0&puts("-1");
    dfs(1,0,1);
    int tp=1;
    ll als=0;
    cmp[1]=0;
    for(int i=1;i<=n;i++)
        if(opt[i])cmp[++tp]=opt[i]>0?-si[i]:si[i];
    nth_element(cmp+1,cmp+((tp+1)>>1),cmp+tp+1);
    int val=cmp[(tp+1)>>1];
    for(int i=1;i<=n;i++)
        als+=Abs(opt[i]*val+si[i]);
    cout<<als+Abs(val);
    return 0;
}

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

class Cube{
public:
    int f[6];

    Cube(){}

    void roll_z(){ roll(1, 2, 4, 3);}
    void roll_y(){ roll(0, 2, 5, 3);}
    void roll_x(){ roll(0, 1, 5, 4);}
    void roll(int i, int j, int k, int l){
        int t = f[i]; f[i] = f[j]; f[j] = f[k]; f[k] = f[l]; f[l] = t;
    }
};

int getRight(Cube c1, int f1, int f2){
    for(int i=0; i<6;i++){
        for(int j=0; j<4; j++){
            if(c1.f[0] == f1 && c1.f[1] == f2) return c1.f[2];
            c1.roll_z();
        }
        if(i % 2 == 0) c1.roll_y();
        else c1.roll_x();
    }
    return -1;
}

int main(){
    Cube c1, c2;

    for(int i=0; i<6; i++) cin >> c1.f[i];
    for(int i=0; i<6; i++) cin >> c2.f[i];

    if(getRight(c2, c1.f[0], c1.f[1]) == c1.f[2]) cout << "Yes";
    else cout << "No";
    cout << endl;

    return 0;
}


Measured memory_bytes: 3124
# Recursion / Divide and Conquer - Koch Curve
import math
cos60, sin60 = math.cos(math.pi/3),math.sin(math.pi/3)
class Point():
    def __init__(self, x, y):
        self.x = x
        self.y = y
    def __str__(self):
        return str(self.x)+' '+str(self.y)

def koch_curve(n, p1,p2):
    if n <= 0:
        return
    # Divide a given segment (p1, p2) into three equal segments.
    s = Point((2*p1.x + p2.x) / 3, (2*p1.y + p2.y) / 3)
    t = Point((p1.x + 2*p2.x) / 3, (p1.y + 2*p2.y) / 3)
    # p1 < s < t < p2 ????????£??????
    # u???????????????????????§?±??????????u???t???s????§???????60????????¢???????????????????¬????????????¢??????????????¨??????
    # Replace the middle segment by the two sides of
    # an equilateral triangle (s, u, t) of
    # the same length as the segment.
    ux = (t.x-s.x)*cos60 - (t.y-s.y)*sin60 + s.x
    uy = (t.x-s.x)*sin60 + (t.y-s.y)*cos60 + s.y
    u = Point(ux, uy)
    # Repeat this procedure recursively for
    # new segments (p1, s), (s, u), (u, t), (t, p2).
    koch_curve(n-1,p1,s)
    print(s)
    koch_curve(n-1,s,u)
    print(u)
    koch_curve(n-1,u,t)
    print(t)
    koch_curve(n-1,t,p2)

n = int(input())
ps = Point(0,0)
pe = Point(100,0)
print(ps)
koch_curve(n,ps,pe)
print(pe)


Measured memory_bytes: 8012
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <ctype.h>
#include <algorithm>
#include <cmath>

#define REP(i, n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define square(x) (x) * (x)
#define cube(x) (x) * (x) * (x)

const int INF = 1e9;

using namespace std;

bool judge(int n){
    REP(i, sqrt(n) + 1){
        if(i == 0 || i == 1)
            continue;
        if(n % i == 0)
            return false;
    }
    return true;
}

int main() {
    int n;
    cin >> n;
    int a[n];
    int count = 0;
    REP(i, n) cin >> a[i];
    REP(i, n) if(judge(a[i])) count++;

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 1196
#include <stdio.h>


int main(void){
  int n,q;
  int a,v;
  int i,j;
  int p[1000001];
  int max=-1,mn=-1;
  scanf("%d %d",&n,&q);
  for(i=0;i<=1000000;i++) p[i]=0;
  for(i=0;i<q;i++){
    scanf("%d %d",&a,&v);
    p[a]+=v;
    if(i==0){
      mn=a; max=p[a];
      printf("%d %d\n",mn,max);
      continue;
    }
    if(v>0){
      if(max<p[a]){
	max=p[a]; mn=a;
      }else if(max==p[a]){
	if(mn>a) mn=a;
      }
    }else{
      if(mn==a){
	max=-1; mn=-1;
	for(j=1;j<=n;j++){
	  if(max<p[j]){
	    max=p[j]; mn=j;
	  }else if(max==p[j]){
	    if(mn>j) mn=j;
	  }
	}
      }
    }
    printf("%d %d\n",mn,max);
  }
  return 0;
}

Measured memory_bytes: 4504
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <unordered_map>
#include <complex>
#include <algorithm>

using namespace std;
using i64 = int_fast64_t;
using u64 = uint_fast64_t;
using i32 = int_fast32_t;
using u32 = uint_fast32_t;

#define int i64

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; }
const int INF = 1LL << 60;

signed main() {
	u64 h;
	cin >> h;

	u64 x = 1;
	while(true) {
		if(x * 2 > h) break;
		x *= 2;
	}

	cout << x + x - 1 << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define strall(v) (v).cbegin(),(v).cend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
//const long long INF = 1LL << 60;
 int INF = 500000;
 int MAX = 1e5+10;
 ll mod = 1e9+7;


int main(){
  int n,a,b;
  cin >> n >> a >> b;
  int ans = min(a*n,b);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int h1, m1, h2, m2, k;
	scanf("%d %d %d %d %d", &h1, &m1, &h2, &m2, &k);
	if(h1>h2){
		h1-=24;
	}
	if(h2 == 0 && h1 != 0){
		h2 = 24;
	}
	if(m2<m1){
		m2 += 60;
		h2--;
	}
	int mins = (h2-h1)*60 + (m2-m1);
	mins-=k;
	
	printf("%d\n", mins);
	
	return 0;
}

Measured memory_bytes: 1712
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define INF = numeric_limits<long long>::max();
#define intf int_fast64_t
int main(){
    intf n,ans=0;
    cin >>n;
    vector<intf> a(3*n);
    for(auto &e:a) cin >>e;

    sort(a.begin(),a.end(),std::greater<intf>());

    for(int i=1;i<2*n;i+=2){
        ans +=a[i];
    }
    cout << ans <<endl;
}

Measured memory_bytes: 2560
import numpy as np

N, M = map(int, input().split())

like_total = np.zeros(M)
cnt = 0
for _ in range(N):
    l = [v for v in map(int, input().split())]
    #print(l)
    for i in range(1, l[0]+1, 1):
        like_total[l[i]-1] += 1

#print(like_total, N)
#print(like_total[4], like_total[9], like_total[-1])
ans = len(np.where(like_total==N)[0])

print(ans)


Measured memory_bytes: 13144
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val N = nextInt()
    val A = nextLongList().toMutableList()
    var ans = 0L
    var base = 1L
    for (d in 1..60) {
        var one = 0L
        var zero = 0L
        for (i in A.indices) {
            if (A[i] and 1 == 0L) {
                zero++
            } else {
                one++
            }
            A[i] = A[i] shr 1
        }
        ans = ((ans + ((one * zero) % 1000000007L) * base) % 1000000007L) % 1000000007L
        base = (base * 2) % 1000000007L
    }
    println(ans)
}

Measured memory_bytes: 102400
import java.util.Scanner;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    while(true){
      int n = sc.nextInt();
      int x = sc.nextInt();
      int kumiawase = 0;
      if(n == 0 && x == 0){
        break;
      }

      for(int p = 1; p <= n; p++){
        for(int q = p+1; q <= n; q++){
          for(int r = q+1; r <= n; r++){
            if(p+q+r == x){
              kumiawase = kumiawase + 1;
            }
          }
        }
      }
      System.out.println(kumiawase);
    }
  }
}


Measured memory_bytes: 26380
#include<bits/stdc++.h>
using namespace std;
 
int seat[100000];
int ok(string s){
	if(s == "Vacant") return 0;
	else if(s == "Male") return 1;
	else return 2;
}
 
int main()
{
	int n;
	cin >> n;
	int l = 0, r = n - 1, a;
	string val;
	cout << l << endl;
	fflush(stdout);
	cin >> val;
	seat[l] = ok(val);
	cout << r << endl;
	fflush(stdout);
	cin >> val;
	seat[r] = ok(val);
	if(!seat[l] || !seat[r]) return 0;
		while(l != r - 1){
		int mid1 = (l + r) / 2;
		cout << mid1 << endl;
		fflush(stdout);
		cin >> val;
		seat[mid1] = ok(val);		
		if(abs(seat[mid1] - seat[l]) != (mid1 - l) % 2) r = mid1;
		else l = mid1;
	}
	cout << l << endl;
	fflush(stdout);
	cin >> val;
	cout << r << endl;
	fflush(stdout);
	cin >> val;
}

Measured memory_bytes: 976
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main(){
    char N;
    cin >> N;
    if(N=='A') cout << "T" << endl;
    if(N=='T') cout << "A" << endl;
    if(N=='C') cout << "G" << endl;
    if(N=='G') cout << "C" << endl;
}

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

int main(void){
	char num[9];
	char max[9];
	char min[9];
	int n;
	int max_v, min_v;
	
	scanf("%d", &n);
	for(int i=0; i<n; i++){
		scanf("%s", num);
		strcpy(max, num);
		for(int j=7; j>0; j--){
			for(int k=0; k<j; k++){
				if(max[k] < max[k+1]){
					char temp = max[k];
					max[k] = max[k+1];
					max[k+1] = temp;
				}
			}
		}
		sscanf(max, "%d", &max_v);

		strcpy(min, num);
		for(int j=7; j>0; j--){
			for(int k=0; k<j; k++){
				if(min[k] > min[k+1]){
					char temp = min[k];
					min[k] = min[k+1];
					min[k+1] = temp;
				}
			}
		}
		sscanf(min, "%d", &min_v);

		printf("%d\n", max_v-min_v);
	}


	return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

/*
0-index
functionの中を書いて使う
segtree<ll> seg(n, [](ll a, ll b){return a + b;}, 0);
*/
template<typename T>
struct segtree{
	int n;
	vector<T> dat;
	T ZERO;
	function<T(T,T)> func;//要素と要素をマージする関数

	segtree(int n_, function<T(T,T)> func_, T zero):func(func_), ZERO(zero){
	  n = 1;
	  while(n < n_)n*=2;
	  dat.resize(2*n);
	  for(int i = 0;i < 2*n;i++)dat[i] = ZERO;
	}

	void update(int k, T a){
	  k += n - 1;dat[k] = a;
	  while(k > 0){
		k = (k-1)/2;
		dat[k] = func(dat[k*2+1],dat[k*2+2]);
	  }
	}

	void set(int k, T a) {
		k += n - 1;dat[k] = a;
	}

	void build(){
		for(int i = n - 2;i >= 0;i--){
			dat[i] = func(dat[2 * i + 1], dat[2 * i + 2]);
		}
	}

	T get(int k){return dat[k+n-1];}

	T que(int a,int b){
		T L = ZERO,R = ZERO;
		int A = a + n - 1;
		int B = b + n - 1;
		while(A < B){
			if((A & 1) == 0)L = func(L,dat[A++]);
            if((B & 1) == 0)R = func(dat[--B],R);
            A = A >> 1;
            B = B >> 1;
		}
		return func(L,R);
	}
};


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

    ll n, k;cin >> n >> k;
    segtree<ll> seg_max(n, [](ll a, ll b){return max(a, b);}, 0);
    segtree<ll> seg_min(n, [](ll a, ll b){return min(a, b);}, INF);
    REP(i, n){
        ll a;cin >> a;
        seg_max.update(i, a);
        seg_min.update(i, a);
    }

    segtree<ll> seg_sum(n, [](ll a, ll b){return (a + b);}, 0);
    REP(i, n-1)if(seg_max.get(i) > seg_max.get(i+1))seg_sum.update(i, 1);

    ll ans = 0;
    bool no_change = false;
    REP(i, n){
        bool ok = true;
        if(i + k > n)break;
        if(seg_sum.que(i, i+k-1) == 0){
            no_change = true;
            ok = false;
        }
        if(i != 0){
            int cou = 0;
            if(seg_max.que(i, i+k) == seg_max.get(i+k-1))cou++;
            if(seg_min.que(i-1, i+k-1) == seg_min.get(i-1))cou++;
            if(cou == 2)ok = false;
        }
        if(ok)ans++;
        //cout << i << " " << ok << endl;
    }

    cout << ans+no_change << endl;

	return 0;
}


Measured memory_bytes: 12544
n = int(input())
d = {}
for i in range(n):
    a = int(input())
    if a in d:
        d[a] += 1
    else:
        d[a] = 1
c = 0
for i in d:
    if d[i] % 2 == 1:
        c += 1
print(c)

Measured memory_bytes: 19460
#include<stdio.h>

#define INFTY 777777

int Min(int,int);
int MatrixChain(int);

int a[1000][1000],p[1000];

int main(){

  int num,i;

  scanf("%d",&num);

  for(i = 1; i <= num; i++){
    scanf("%d %d",&p[i-1],&p[i]);
  }
  MatrixChain(num);
  printf("%d\n",a[1][num]);

  return 0;
}


int Min(int x,int y){
  if(x >= y)return y;
  else return x;
}


int MatrixChain(int num){

  int i,j,l,k;
  for(i = 1; i <= num; i++){
    a[i][i] = 0;
  }

  for(l = 2; l <= num; l++){
    for(i = 1; i <=num; i++){
      j = i + l - 1;
      a[i][j] = INFTY;
      for(k = i; k <= j; k++){
	a[i][j] = Min(a[i][j], a[i][k] + a[k+1][j] + p[i-1]*p[k]*p[j]);
      }
    }
  }
}

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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define inf 1000000100
ll sum(ll i)
{
    return i*(i+1)/2;
}

int main()
{
    ll x;
    cin >> x;
    ll i = -1;
    for(ll b = 1000000000; b >= 1; b/=2)
    {
        while(sum(i+b) < x)
        {
            i += b;
        }
    }
    i++;
    cout << i << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
typedef long long ll;
typedef pair<ll, ll> P;
map<long long, long long> cnt;
void primeFactors(long long n) {
    while (n % 2 == 0) {
        cnt[2]++;
        n = n / 2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2) {
        while (n % i == 0) {
            cnt[i]++;
            n = n / i;
        }
    }
    if (n > 2) {
        cnt[n]++;
    }
}
bool bitcheck(int x, int y) { return (x >> y) & 1; }
signed main() {
    ll d, g;
    cin >> d >> g;
    vector<ll> p(d);
    vector<ll> c(d);
    REP(i, d) {
        cin >> p[i];
        cin >> c[i];
    }
    ll mnproblems = 1000000;
    REP(i, 1 << d) {
        ll sum = 0;
        ll problems = 0;
        REP(j, d) {
            if (bitcheck(i, j)) {
                sum += p[j] * (j + 1) * 100 + c[j];
                problems += p[j];
            }
        }
        for (int j = d - 1; j >= 0; j--) {
          	if(sum >= g) break; 
            if (!bitcheck(i, j)) {
                ll c = min(p[j]-1,(((g - sum + (j + 1) * 100) - 1) / ((j + 1) * 100)));
                problems += c;
              
                sum += c * (j + 1) * 100;
            }
        }
                if (sum >= g) {
                    mnproblems = min(mnproblems, problems);
                }
    }
    cout << mnproblems << endl;
}


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

int main(){
    long long a,b,k;
    cin >> a >> b >> k;
    //cout << a << " " << b << " " << k << endl;

    if(a - k > 0)
        a -= k;
    else{
        k -= a;
        a = 0;
        b -= k;
        if(b < 0)
            b = 0;
    }

    cout << a << " " << b << endl;
}

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

int main() {
  int N;
  cin >> N;
  if (N<10){
    cout << N <<endl;
  }
  if(N>=10 && N<100){
    cout << "9" <<endl;
  }
  if(N>=100 && N<1000){
    cout << N-90 <<endl;
  }
  if(N>=1000 && N<10000){
    cout << "909" <<endl;
  }
  if(N>=10000 && N<100000){
    cout << N-9090 <<endl;
  }
  if(N==100000){
    cout << 90909 <<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    // (を１, )を−１として、2つの配列にいれる
    int N;
    cin >> N;
    vector<P> plus;
    vector<P> minus;
    rep(i, N) {
        string S;
        cin >> S;
        int cur = 0, mi = 0;
        for (char c : S) {
            if (c == '(') cur++;
            else cur--;
            mi = min(mi, cur);
        }
        if (cur >= 0) plus.emplace_back(mi, cur);
        else minus.emplace_back(mi-cur, -cur);
    }
    sort(plus.rbegin(), plus.rend());
    int left = 0;
    for (auto p : plus) {
        int mi = p.first, end = p.second;
        if (left + mi < 0) {
            puts("No");
            return 0;
        }
        left += end;
    }
    // 逆から
    int right = 0;
    sort(minus.rbegin(), minus.rend());
    for (auto p : minus) {
        int mi = p.first, end = p.second;
        if (right + mi < 0) {
            puts("No");
            return 0;
        }
        right += end;
    }
    if (left != right) {
        puts("No");
        return 0;
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 11120
#include <bits/stdc++.h>
//F6編譯，右上三角形執行，ctrl+c強制停止執行  F5開啟exe
#define ll long long
#define maxn 200005
#define mod 998244353
using namespace std;

typedef pair<int, int> P;

ll n;

int main()
{
    cin >> n;
    ll now = 100;
    for (int i = 1;; i++)
    {
        now += now / 100;
        if (now >= n)
        {
            printf("%d\n", i);
            return 0;
        }
    }
    return 0;
}


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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int n, m;
	cin >> n >> m;
	
	int a[n];
	for(int i = 0; i < n; i++)
		cin >> a[i];
	
	sort(a, a + n);
	int min = a[0];
	
	vector<pair<int, int>> b;
	for(int i = 0, x, y; i < m; i++){
		cin >> x >> y;
		if(y > min)
			b.push_back({x, y});
	}
	
	sort(b.begin(), b.end(), [](auto x, auto y){
		return x.second > y.second;
	});
	
	for(int i = 0, x = 0; i < n && x < b.size(); i++){
		if(b[x].second > a[i]){
			a[i] = b[x].second;
			b[x].first--;
		}
		if(b[x].first == 0)
			x++;
	}
	
	unsigned long long sum = 0;
	for(int i:a)
		sum += i;
	
	cout << sum << endl;
}

Measured memory_bytes: 1784
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        String op = "";

        if (a < b) {
            op = "<";
        } else if (a > b) {
            op = ">";
        } else {
            op = "==";
        }
        System.out.println("a " + op + " b");
        sc.close();
    }
}


Measured memory_bytes: 26240
#include <cstdio>
#include <cmath>

using namespace std;

int main(void){
	int m, n, l, ans1 = 0, ans2 = 0;
	double sm, sn, sl;
	while(scanf("%d%*c%d%*c%d",&m,&n,&l) != EOF){
		sm = pow((double)m,2.0), sn = pow((double)n,2.0), sl = pow((double)l,2.0);
		if(sm + sn == sl){
			ans1++;
		}else if(m == n && 2 * m > l){
			ans2++;
		}
	}
	printf("%d\n%d\n",ans1,ans2);
	return 0;
}

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

int main() {
    //配列の宣言
    vector<int> vec(5);

    for (int i=0; i<5; i++) {
        cin >> vec.at(i);
    }

    int answer;
    //配列vecの中から0にあたる部分を探す
    for (int i=0; i<5; i++) {
        if (vec.at(i) == 0) {
            answer = i+1;
        }
    }
    cout << answer;
    return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll x;
    cin >> x;

    ll mem = x % 500, res = (x / 500) * 1000 + (mem / 5) * 5;

    cout << res << endl;
    return 0;
}

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

vector<int> bfs(vector<vector<int>> &adj_list)
{
    vector<int> res(adj_list.size(), -1);
    vector<bool> visit(adj_list.size(), 0);
    queue<int> q;
    q.push(0);
    visit[0] = 1;
    res[0] = 0;

    while (!q.empty())
    {
        int u = q.front();
        q.pop();
        for (int i = 0; i < adj_list[u].size(); i++)
        {
            int v = adj_list[u][i];
            if (visit[v] == 0)
            {
                visit[v] = 1;
                res[v] = res[u] + 1;
                q.push(v);
            }
        }
    }

    return res;
}

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

    vector<vector<int>> adj_list(n);
    for (int i = 0; i < n; i++)
    {
        int id, k;
        cin >> id >> k;
        for (int j = 0; j < k; j++)
        {
            int u;
            cin >> u;
            adj_list[id - 1].push_back(u - 1);
        }
    }

    // for (int i = 0; i < n; i++)
    // {
    //     for (int j = 0; j < adj_list[i].size(); j++)
    //     {
    //         cout << adj_list[i][j] << ", ";
    //     }
    //     cout << endl;
    // }

    vector<int> res = bfs(adj_list);
    for (int i = 0; i < n; i++)
    {
        cout << i + 1 << " " << res[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3120