akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
 
#define MAXX 10005
 
#define PI   3.14159265358979323846264338327950
 
#define F first
#define S second
 
#define ll 	 long long int
 
#define mod  1000000007



int main()
{
	FAST;
	ll n;
	cin >> n;
	ll k;
	cin >> k; 
	vector< pair<ll, ll> > v;
	for(ll i = 0; i < k; i++){
		ll a, b;
		cin >> a >> b;
		v.push_back({b, a});
		
	}
	sort(v.begin(), v.end());
	ll x = 0;
	ll ans = 0;
	for(ll i = 0; i < v.size(); i ++){
		if(x <= v[i].S){
			ans ++;
			x = v[i].F;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 5404
#!/usr/env/bin ruby


while (r = gets.chomp.to_i) != 0
  sheet = []
  r.times do
    sheet << gets.chomp.split.map(&:to_i)
  end

  sheet.map{|e| e << e.inject(:+)}.transpose.map{|e| e << e.inject(:+)}.transpose.map{|e| puts e.map{|ee| ee.to_s.rjust(5) }.join}
end

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

#define int long long
#define IOS ios::sync_with_stdio(false); cin.tie(nullptr);                                                        
#define endl "\n"
#define ld long double

const long double pi = acos(-1);

int32_t main()
{
	IOS;
	#ifdef LOCAL
	freopen("input.txt","rt",stdin);
	#endif

	long double a,b,x;
	cin >> a >> b >> x;                    
	ld theta;
	if (x > a * a *b / 2.0) {
		ld y = 2 * x / (a * a) - b;
		theta = atan((b - y) / a);
		//cout << theta << endl;
	}
	else {
		ld y = 2 * x / (a*b);
		theta = atan(b / y);
		//cout << theta << endl;
	}
	ld ans = 360 * theta / (2 * pi);
	cout << setprecision(20) << ans << endl;
 
	#ifdef LOCAL
	cerr << "Time elapsed : " << 1.0*clock()/CLOCKS_PER_SEC << " s.\n";
	#endif
    return 0;
}   

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

int main() {
    int A,B;
  	int a,b,c,d,i;
    cin >> A >> B;
  	b = B*10;
  	a = A*13;
  	for(i=b;i<a+1;i++){
      c = i/12.5;
      d = i/10;
      	if(c==A&&d==B){
        	cout << i << endl;
        	return 0;
        }
    }
  	cout << -1 << endl;
	}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }

signed main() {
  int n;
  cin >> n;
  string s = "";
  rep(i, n) {
    string t;
    cin >> t;
    s += t;
  }
  int ans = 0;
  while (1) {
    string t;
    t = to_string(ans);
    int len = t.size();
    bool match = false;
    rep(i, s.size() - len + 1) {
      if (s.substr(i, len) == t) {
        match = true;
        break;
      }
    }
    if (!match) {
      cout << ans << endl;
      return 0;
    }
    ans++;
  }

  return 0;
}



Measured memory_bytes: 3292
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mat = lambda x, y, v: [[v]*y for _ in range(x)]
ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)]
mod = 1000000007
sys.setrecursionlimit(1000000)

N, K = rl()
S = rs()

ans = ''
for i, c in enumerate(S):
	if i == K-1:
		c = c.lower()
	ans += c
print(ans)



Measured memory_bytes: 68504
N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
p_v = {i:sum([1/i*j for j in range(1,i+1)]) for i in range(1, 1001)}
p = [p_v[one] for one in p]

sums = [sum(p[:K])]
for i in range(1,N-K+1):
    sums.append(sums[-1]-p[i-1]+p[i+K-1])
print(max(sums))

Measured memory_bytes: 77960
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>

using namespace std;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<int>;


int main()
{
	int N, A, B, C, D;
	string S;
	cin >> N >> A >> B >> C >> D;
	cin >> S;

	--A; --B; --C; --D;

	for (int i = 0; i < N-1; ++i)
	{
		if (S[i] == '#'&&S[i + 1] == '#')
		{
			if (A < i && (i < C || i < D))
			{
				cout << "No" << endl;
				return 0;
			}
		}
	}

	if (C < D)
	{
		cout << "Yes" << endl;
		return 0;
	}

	for (int i = 0; i < N - 2; ++i)
	{
		if (S[i] == '.'&&S[i + 1] == '.' && S[i + 2] == '.')
		{
			if (B-2 < i && i < D)
			{
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 640
#pragma GCC optimize("O3")

#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/rope"

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define f first
#define s second

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

struct custom_hash 
{
    static uint64_t splitmix64(uint64_t x) 
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const 
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
int n;
vector<int> a;
vector<int> res;
int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    a.assign(n, 0);
    res.assign(n, 0);
    F0R(i, n) cin >> a[i];
    for(int i = n - 1; i >= 0; --i)
    {
        int tot = 0, x = i;
        while(x < n)
        {
            tot += res[x];
            x += i + 1;
        }
        if(a[i] != (tot%2)) res[i] = 1;
    }
    int cnt = 0;
    F0R(i, n) if(res[i] == 1) cnt++;
    cout << cnt << "\n";
    F0R(i, n)
    {
        if(res[i] == 1) cout << i + 1 << " ";
    }
    return 0;
}

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

int main(){
 int X[5]={1,2,3,4,5};
 
  int Y[5];
 for(int i=0;i<5;i++){
    cin >> Y[i];   
  }
 
  for(int i=0;i<5;i++){
    if(X[i]==Y[i]){}
    else cout<<i+1<<endl;
    }
 
return 0;
}


Measured memory_bytes: 3596
N,T = map(int,input().split())
A = list(map(int,input().split()))
B = []
buy = A[0]
for i in A:
    buy = min(i,buy)
    B.append(i-buy)
B.sort(reverse=True)
i = 0
while B[0] == B[i]:
    i += 1
print(i)

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

int main(){

    string num;
    long long int k;

    cin>>num>>k;

    // int n =  strlen(num);

    long long int mod = 0;

    for(int i = 0 ; i < num.size() ; i++){

        int digit = num[i] - '0';
        mod = mod*10 + digit;
        mod = mod%k;
    }

    // int num1 = stoi(num);
 
 if(mod>abs(k-mod)){
     cout<<abs(k-mod);
 }

 else{
     cout<<mod;
 }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "No" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

signed main(void){
    string S;
    int x,y;
    cin >> S;
    cin >> x >> y;
    int N=S.size();
    vector<int> X,Y;
    int Xsum=0,Ysum=0;
    int now=0,mode=0;
    REP(i,N+1){
        if(i==N || S[i]=='T'){
            if(mode==0){
                X.push_back(now);
            }else{
                Y.push_back(now);
            }
            now=0;
            mode^=1;
        }else{
            now++;
        }
    }
    x-=X[0];
    X[0]=0;
    REP(i,X.size()){
        Xsum+=X[i];
    }
    REP(i,Y.size()){
        Ysum+=Y[i];
    }
    x+=Xsum;y+=Ysum;
    //cout << x MM y << endl;
    if(abs(x)%2==1 || abs(y)%2==1){
        GOODBYE;
    }
    x/=2;y/=2;
    
    int xb[18514][2]={};
    xb[0][0]=1;
    REP(i,X.size()){
        REP(j,10000){
            if(xb[j][0]==1){
                xb[j][1]=1;
                xb[j+X[i]][1]=1;
            }
        }
        REP(j,10000){
            xb[j][0]=xb[j][1];
            xb[j][1]=0;
        }
    }
    
    int yb[18514][2]={};
    yb[0][0]=1;
    REP(i,Y.size()){
        REP(j,10000){
            if(yb[j][0]==1){
                yb[j][1]=1;
                yb[j+Y[i]][1]=1;
            }
        }
        REP(j,10000){
            yb[j][0]=yb[j][1];
            yb[j][1]=0;
        }
    }
    //cout << x MM y << endl;
    //REP(i,X.size()){cout << X[i] << " ";}cout << endl;
    //REP(i,Y.size()){cout << Y[i] << " ";}cout << endl;
    //cout << x MM y << endl;
  	if(x<0 || y<0){GOODBYE;}
  	if(xb[x][0]==1 && yb[y][0]==1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}



Measured memory_bytes: 896
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long N, A[1000], Odd = 0, Even = 0;
	vector<int> ANS;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		if (A[i] > 0) i % 2 == 0 ? Even += A[i] : Odd += A[i];
	}
	if (Even == 0 && Odd == 0) {
		long long MAX = -1000000000000, MAXA = -1;
		for (int i = 0; i < N; i++) {
			if (MAX <= A[i]) MAX = A[i], MAXA = i;
		}
		cout << MAX << endl << N - 1 << endl;
		for (int i = 0; i < MAXA; i++) cout << 1 << endl;
		for (int i = N - MAXA; i > 1; i--) cout << i << endl;
		return 0;
	}
	if (Even >= Odd) {
		for (int i = 0; i < N; i += 2) if (A[i] > 0) ANS.push_back(i);
	}
	else {
		for (int i = 1; i < N; i += 2) if (A[i] > 0) ANS.push_back(i);
	}
	cout << max(Even, Odd) << endl;
	cout << N - (ANS[ANS.size() - 1] - ANS[0]) / 2 - 1 << endl;
	for (int i = N - 1; i > ANS[ANS.size() - 1]; i--) cout << i + 1 << endl;
	for (int i = ANS.size() - 2; i >= 0; i--) {
		for (int j = (ANS[i + 1] + ANS[i]) / 2; j > ANS[i]; j--) cout << j + 1 << endl;
	}
	for (int i = 0; i < ANS[0]; i++) cout << 1 << endl;
}

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

#define PI 3.141592653589
#define ll long long int
#define ld long double
#define vi vector<int>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
#define vv vector
int MOD=1e9+7;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
ll min(ll a,ll b){return (a>b)?b:a;}
ll max(ll a,ll b){return (a>b)?a:b;}
bool prime[1000001];
vi primes;
void SieveOfEratosthenes(int n) 
{ 
    memset(prime, true, sizeof(prime)); 
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
    for(int p=2;p<1000001;p++)
        if(prime[p])
            primes.pb(p);
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

    int t=1;
	//cin>>t;
	//SieveOfEratosthenes(1000000);
    while(t--){
        int n;
        string x;
        cin>>n>>x;
        int dp[200001]={0};
        for(int i=1;i<=200000;i++){
            int j=i,cnt=0;
            while(j){
                if(j&1)
                    cnt++;
                j=j>>1;
            }
            dp[i]=1+dp[i%cnt];
        }
        int cnt=0;
        for(int i=0;i<n;i++)
            if(x[i]=='1')
                cnt++;
        ll a=0,b=0;
        if(cnt>1){
            MOD=cnt-1;
            for(int i=n-1;i>=0;i--){
                if(x[i]=='1')
                    a+=power(2,n-1-i),a%=MOD;
            }
        }
        if(cnt!=n){
            MOD=cnt+1;
            for(int i=n-1;i>=0;i--){
                if(x[i]=='1')
                    b+=power(2,n-1-i),a%=MOD;
            }
        }
        for(int i=0;i<n;i++){
            if(x[i]=='0'){
                MOD=cnt+1;
                cout<<1+dp[(b+power(2,n-i-1))%MOD]<<'\n';
            }
            else if(cnt>1){
                MOD=cnt-1;
                cout<<1+dp[(a-power(2,n-i-1)+MOD)%MOD]<<'\n';
            }
            else
                cout<<0<<'\n';
        }
    }
}

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

using namespace std;

int main(void)
{
    unsigned long long int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for(int i = 0; i < N; i++)  {
        cin >> A[i];
    }
    
    vector<int> order(N, -1);
    int crossNum, modNum;
    for(int i = 0, num = 0; true ; i = A[i] - 1, num++){
        if(order[i] == -1){
            order[i] = num;
        }
        else{
            modNum = num - order[i];
            crossNum = order[i];
            break;
        }
    }
    int ans = 0;
    int maxv = K <= crossNum ? K : (crossNum + (K - crossNum) % modNum);
    for(int i = 0; i < maxv; i++){
        ans = A[ans] - 1;
    }
    cout << ans + 1 << endl;
	return 0;
}

Measured memory_bytes: 4836
import sys

def solve():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    penalty = [0] * N
    accepted = [False for _ in range(N)] 
    totalPenalty = 0
    totalAccepted = 0
    for _ in range(M):
        p, s = map(str, input().strip("\n").split())
        if s == "WA" and not accepted[int(p) - 1]: penalty[int(p) - 1] += 1
        else:
            if not accepted[int(p) - 1]:
                accepted[int(p) - 1] = True
                totalAccepted += 1
                totalPenalty += penalty[int(p) - 1]
    print(totalAccepted, totalPenalty)

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 4784
#include <cstdlib>
#include <iostream>
#include <algorithm>

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

    std::string a;
    while (std::getline(std::cin, a)) {
        reverse(a.begin(), a.end());
        std::cout << a << std::endl;
    }
    return EXIT_SUCCESS;
}


Measured memory_bytes: 3192
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stdio.h>
#include<deque>
#include<map>
#include<queue>

typedef long long ll;

#define debug(x) cout << #x << "=" << x << endl;
#define debug_arr(a, n) for(ll i = 0; i < n; i++)cout << a[i] << " "
#define inf 100000000000
#define loop(i,n) for(ll i = 0; i < n; i++)

using namespace std;

pair<int,int> getPair(ll n){
    int last = n % 10;
    int top = 0;
    while(n){
        top = n;
        n /= 10;
    }

    pair<int,int> result = make_pair(top, last);

    return result;
}

int main(){
    ll n;
    vector<ll> a(100);
    map<pair<int,int>,int> freq;
    cin >>n;

    loop(i,n){
        ll ii = n-i;
        pair<int,int> a = getPair(ii);
        freq[a]++;
    }

    ll ans = 0;

    loop(i,n){
        ll ii = n-i;
        pair<int,int> a = getPair(ii);
        pair<int,int> b(a.second,a.first);

        ans += freq[b];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
import sys
N, M, X = map(int, sys.stdin.readline().split())
CA = [list(map(int, sys.stdin.readline().split())) for i in range(N)]
C = [CA[i][0] for i in range(N)]
A = [CA[i][1:] for i in range(N)]
ans = 10 ** 20
for i in range(2 ** N):
    TMP = [0] * M
    op = [0] * N
    c = 0
    for j in range(N):
        if (i >> j) & 1:
            op[j] = 1
    for k in range(len(op)):
        if op[k]:
            TMP = list(map(lambda x,y: x + y, TMP, A[k]))
            c += C[k]
    TMP_2 = [l for l in TMP if l >= X]
    if len(TMP_2)== M:
        ans = min(ans, c)
if ans == 10 ** 20:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 9264
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    N = Scanner.int()
    M = set()
    for _ in range(N):
        S = Scanner.string()
        M.add(S)
    print(len(M))


def main():
    # sys.stdin = open("sample.txt")
    solve()


if __name__ == "__main__":
    main()


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

int main()
{
    string S, T;
    cin >> S >> T;

    int A, B;
    cin >> A >> B;

    string U;
    cin >> U;

    if (S == U)
    {
        A--;
    }

    if (T == U)
    {
        B--;
    }

    cout << A << ' ' << B << endl;
}

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

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> changes;
    for (int i = 1; i <= m; ++i) {
        int u, v;
        cin >> u >> v;
        if (u > v) {
            swap(u, v);
        }
        changes.push_back({u, -i});
        changes.push_back({v - 1, i});
    }
    sort(changes.begin(), changes.end());
    vector<int> buff;
    int res = 0;
    set<int> done;
    for (int i = 0; i < changes.size(); ++i) {
        int ind = abs(changes[i].second);
        if (changes[i].second > 0) {
            if (!done.count(ind)) {
                ++res;
                for (auto& r : buff) {
                    done.insert(r);
                }
                buff.clear();
            }
        } else {
            buff.push_back(ind);
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 6640
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 105
#define INF 100000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 100005;
const int MOD = 1000000007;

int main(){
    int n;
    cin>>n;
    double ans=0;
    REP(i,n){
        double x;
        string u;
        cin>>x>>u;
        if(u=="JPY"){
            ans+=x;
        }else{
            ans+=(double)x*380000.0;
        }
    }
    printf("%.10lf\n",ans);
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int> vec(N);
  for (int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  int Alice, Bob;
  Alice=0;
  Bob=0;
  
  for (int i=0; i<N; i++){
    if (i%2==0){
      Alice+=vec.at(i);
    }
    else{
      Bob+=vec.at(i);
    }
  }
  cout << Alice-Bob << endl;
 }

Measured memory_bytes: 256
package main

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

var s = bufio.NewScanner(os.Stdin)

func nextLine() string {
	s.Scan()
	return s.Text()
}

func main() {
	s := nextLine()
	var f bool = true
	sSplit := strings.Split(s, "")
	for i, c := range sSplit {
		if i % 2 == 0{
			if c != "R" && c != "U" && c != "D" {
				f = false
			}
		} else {
			if c != "L" && c != "U" && c != "D" {
				f = false
			}
		}
	}
	if f {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 640
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(K):
    c = 0
    for i in range(1, 10**6+1):
        c *= 10
        c += 7
        c %= K
        if c == 0:
            return i
    return -1


def main():
    K = read_int()
    print(slv(K))


if __name__ == '__main__':
    main()


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

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

    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;

    int japanese = 0, overseas = 0;
    for(int i = 0; i < n; ++i) {
        if (s[i] == 'c') {
            cout << "No\n";
        } else if (s[i] == 'a') {
            if (a + b > japanese) {
                cout << "Yes\n";
                ++japanese;
            } else {
                cout << "No\n";
            }
        } else {
            ++overseas;
            if (a + b > japanese && overseas <= b) {
                ++japanese;
                cout << "Yes\n";
            } else cout << "No\n";
        }
    }

    return 0;
}


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

int main(){
  int n ;
  cin >> n;
  int saidai = 0;
  int count = 0;
  vector<long long int> h(120000,9999999999) ;
  
  for(int i=0;i<n;i++){
    cin >> h[i];
  }
  for(int i=0;i<n;i++){
    if(h[i]>=h[i+1]){
      count++;
    }
    else {
      saidai = max(saidai,count);
      count = 0;
    }
  }
  
  cout << saidai << endl;
}
  



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

int main()
{
    string x;
    cin >> x;
    int q;
    cin >> q;
    int t, f;
    char c;
    list<char> ans;
    for (int i = 0; i < x.size(); i++) ans.push_back(x[i]);
    bool rev = false;
    while (q--) {
        cin >> t;
        if (t == 1) {
            rev = !rev;
        }
        else {
            cin >> f >> c;
            if (f == 1) {
                if (rev) ans.push_back(c);
                else ans.push_front(c);
            }
            else {
                if (rev) ans.push_front(c);
                else ans.push_back(c);
            }
        }
    }
    if (rev) reverse(ans.begin(), ans.end());
    for (auto a : ans) cout << a;
    cout << "\n";
}


Measured memory_bytes: 9984
#include<stdio.h>
#include<string.h>
int main()
{  int n,i,f=1;
   char s[100];
   gets(s);
   n=strlen(s);
   for(i=0;i<n/2;i++)
   {  if(s[i]!=s[n-1-i])
      f=0;
      if(f==0) i=n;
   }
   if(f)
   for(i=0;i<n/2;i++)
   {  if(s[i]!=s[(n-3)/2-i]) f=0;
      if(f==0) i=n;
   }
   if(f)
   for(i=(n+1)/2;i<n;i++)
   {  if(s[i]!=s[n-1-i]) f=0;
      if(f==0) i=n;
   }
   if(f) printf("Yes");
   else printf("No");
} 

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

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

    int D; cin >> D;
    vector<int> C(26); vector<vector<int>> S(D, vector<int>(26));
    REP(i, 0, 26) cin >> C[i];
    REP(i, 0, D) REP(j, 0, 26) cin >> S[i][j];


    vector<int> T(D);
    REP(i, 0, D) {
        int max_idx = 0;
        REP(j, 0, 26) {
            if (S[i][max_idx] < S[i][j]) max_idx = j;
        }
        T[i] = max_idx + 1;
    }

    vector<vector<int>> last(26, vector<int>(D, 0));
    vector<ll> ret(26, 0);
    REP(i, 0, D) {
        ret[T[i] - 1] += S[i][T[i] - 1];
        last[T[i] - 1][i] = i + 1;
        REP(j, 0, 26) {
            if (i > 0 && !last[j][i]) last[j][i] = last[j][i - 1];
            ret[j] -= C[j] * (i + 1 - last[j][i]);
        }
    }

    ll best = accumulate(ALL(ret), 0LL);
    mt19937_64 mt(random_device{}());
    REP(i, 0, 100000) {
        int d = mt() % D;
        int next = mt() % 26;
        int prev = T[d] - 1;
        T[d] = next + 1;
        last[prev].assign(D, 0);
        last[next].assign(D, 0);
        ret[prev] = 0;
        ret[next] = 0;
        REP(i, 0, D) {
            if (T[i] == prev + 1 || T[i] == next + 1) {
                ret[T[i] - 1] += S[i][T[i] - 1];
                last[T[i] - 1][i] = i + 1;
            }
            if (i > 0) {
                if (!last[prev][i]) last[prev][i] = last[prev][i - 1];
                if (!last[next][i]) last[next][i] = last[next][i - 1];
            }
            ret[prev] -= C[prev] * (i + 1 - last[prev][i]);
            ret[next] -= C[next] * (i + 1 - last[next][i]);
        }
        if (best >= accumulate(ALL(ret), 0LL)) {
            T[d] = prev + 1;
        } else {
            best = accumulate(ALL(ret), 0LL);
        }
    }
    
    for (auto t : T) cout << t << endl;
    return 0;
}

Measured memory_bytes: 3724
#include<stdio.h>
#include<stdlib.h>

int main(int argc,char** argv)
{
	int N, A, B, x, y;
	scanf("%d%d%d", &N, &A, &B);
	A = A * N;
	if(A > B){
		printf("%d\n",B);
	}
	else if(B > A){
		printf("%d\n", A);
	}
	else if(A == B){
		printf("%d\n", A);
	}
	return(0);

}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
#include<deque>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	int n;
	cin >> n;
	vi a(n * 3);
	rep(i, 0, n * 3) {
		cin >> a[i];
	}
	i64 sum = 0;
	sort(all(a));
	reverse(all(a));
	int cou = 1;
	rep(i, 0, n) {
		sum += a[cou];
		cou += 2;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1408
while True:
    n = input().split()
    h = int(n[0])
    w = int(n[1])
    switch = 0
    switch2 = 1
    if h == 0 and w == 0:
        break
    for i in range(h):
        line = ''
        if switch2:
            switch = 0
            switch2 = 0
        else:
            switch = 1
            switch2 = 1
        for j in range(w):
            if switch == 0:
                line += '#'
                switch = 1
            else:
                line += '.'
                switch = 0
        print(line)
        

    print()

Measured memory_bytes: 7660
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion
#pragma region chminmax
template <typename T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
#pragma endregion

int main()
{
    vector<string> s(3);
    rep(i, 3) cin >> s[i];
    sort(s.begin(), s.end());

    bool d[3][3][2001];

    int ans = 8000;
    do
    {
        rep(i, 3) rep(j, 3) rep(k, s[i].size())
        {
            if (i >= j)
                break;

            bool ok = true;
            for (int ni = k; ni < s[i].size(); ni++)
            {
                int nj = ni - k;
                if (nj >= s[j].size())
                    break;
                if (s[i][ni] == '?' || s[j][nj] == '?')
                    continue;

                if (s[i][ni] != s[j][nj])
                    ok = false;
            }
            d[i][j][k] = ok;
        }

        auto f = [&](int i, int j, int k) {
            if (k >= s[i].size())
                return true;

            return d[i][j][k];
        };

        rep(x, 2001) rep(y, 2001)
        {
            if (!f(0, 1, x))
                continue;
            if (!f(1, 2, y))
                continue;
            if (!f(0, 2, x + y))
                continue;

            int now = 0;
            now = max<int>(now, s[0].size());
            now = max<int>(now, x + s[1].size());
            now = max<int>(now, x + y + s[2].size());
            ans = min(ans, now);
        }
    } while (next_permutation(s.begin(), s.end()));

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
// Problem : B - Trick or Treat
// Contest : AtCoder - AtCoder Beginner Contest 166
// URL : https://atcoder.jp/contests/abc166/tasks/abc166_b?lang=en
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)n;i++)
#define REP(i,n) for(int i=0;i<(int)n;i++)
#define ll long long
#define mod 1000000007
int lcm(int x,int y){
	return x/__gcd(x,y)*y;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    int ans=0;
    set<int>arr;
    while(k--){
    	int v;
    	cin>>v;
    	for(int i=1;i<=v;i++){
    		int z=0;
    		cin>>z;
    		arr.insert(z);
    	}
    }
    cout<<n-arr.size()<<endl;
    return 0;
}


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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector< ii >
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }

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

int32_t main(){
  DESYNC;
  int n,m;
  cin >> n >> m;
  priority_queue<int> pq;
  for(int i=0; i<n; i++){
    int x;
    cin >> x;
    pq.push(-x);
  }
  vector<ii> cb;
  for(int i=0; i<m; i++){
    int b,c;
    cin >> b >> c;
    cb.pb(ii(-c,b));
  }
  sort(cb.begin(), cb.end());
  for(ii p : cb){
    int c = -p.ff;
    int b = p.ss;
    int cnt = 0;
    while(cnt < b){
      if(-pq.top() >= c){
        break;
      }
      cnt++;
      pq.pop();
      pq.push(-c);
    }
  }
  int ans = 0;
  while(pq.size() > 0){
    ans += pq.top();
    pq.pop();
  }
  cout << -ans << endl;
}



Measured memory_bytes: 3188
#include <stdio.h>

int main(){
  int x, y, r=1;

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

  if(x<y){
    r=x;
    x=y;
    y=r;
  }

  while(r!=0){
    r=x%y;
    x=y;
    y=r;
  }

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

  return 0;
}



Measured memory_bytes: 2140
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF =1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define pb push_back
int main(){
    int n;
    cin>>n;
    if(n<1200){
        cout << "ABC" << endl;
    }else if(n<2800){
        cout << "ARC" << endl;
    }else{
        cout << "AGC" << endl;
    }
    return 0;
}

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

using namespace std;

int main(){
    float sm,sp,bm,bp; cin>>sm>>sp>>bm>>bp;
    bool enc=false;
    if(bm<=sp){cout<<"Yes"; enc=true;}
    else if(sm<=bp){ cout<<"No"; enc=true;}
    float stook=ceil(bm/sp), btook=ceil(sm/bp);
    if(!enc){
        if(stook<=btook) cout<<"Yes";
        else cout<<"No";
    }
 return 0;
}


Measured memory_bytes: 3744
#include<iostream>

int main()
{
	int n;
	std::cin >> n;
	
	while( n-- ){
		int a, b = 0, c = 0;
		bool f = true;
		
		for( int i = 0; i < 10; i++ ){
			std::cin >> a;
			
			if( b < a ){
				b = a;
			}
			else if( c < a ){
			 	c = a;
			}
			else{
			 	f = false;
			}
		}
		
		std::cout << ( f ? "YES" : "NO" ) << std::endl;
	}

 	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <stdio.h>
#include <cctype>
#include <cmath>
#include <math.h>
using namespace std;

float myabs(float a){
  return a>0 ? a : -a;    
}

int main(){
  double x1,x2,y1,y2,a;
  cin >> x1 >> y1 >> x2 >> y2;  
  a = abs(x2-x1)*abs(x2-x1)+abs(y2-y1)*abs(y2-y1);
  printf("%.8f\n",sqrt(a));
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

vector<P> prime_factor(int num) {
  vector<P> ret;
  for (int i=2; i*i<=num; ++i) {
    int count = 0;
    while (num%i == 0) {
      num /= i;
      ++count;
    }
    if (count != 0) ret.push_back(P(i, count));
  }
  if (num != 1) ret.push_back(P(num, 1));
  return ret;
}

vi divisor(int &num) {
  vi ret;
  ret.push_back(1);
  for (auto p : prime_factor(num)) {
    int sz = ret.size();
    int x, y;
    tie(x,y) = p;
    rep(i,sz) {
      int d = ret[i];
      rep(j,y) {
        d *= x;
        ret.push_back(d);
      }
    }
  }
  sort(ret.begin(), ret.end());  // , greater<int>()
  ret.erase(ret.begin());
  return ret;
}

ll combination(int n, int r) {
  if (n-r < r) r = n-r;
  if (r == 0) return 1;
  if (r == 1) return n;
  vi numerator(r), denominator(r);
  rep(i,r) {
    numerator[i] = n-r+i+1;
    denominator[i] = i+1;
  }
  for (int p=2; p<=r; ++p) {
    int pivot = denominator[p-1];
    if (pivot > 1) {
      int offset = (n-r)%p;
      for (int j=p-1; j<r; j+=p) {
        numerator[j-offset] /= pivot;
        denominator[j] /= pivot;
      }
    }
  }
  ll ret = 1;
  rep(i,r) (ret *= numerator[i]) %= MOD;
  return ret;
}

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

  map<int, map<int, int>> dp;  // P(length, permutation)
  for (auto d : divisor(M)) {
    dp[d][1] = 1;
    for (auto nd : divisor(d)) {
      if (nd == d) continue;
      for (auto p : dp[nd]) (dp[d][p.first+1] += p.second) %= MOD;
    }
  }

  ll ans = 0;
  if (M == 1) ans = 1;
  for (auto p : dp[M]) {
    if (p.first > N) continue;
    (ans += combination(N, p.first) * p.second) %= MOD;
  }

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


Measured memory_bytes: 640
#include <stdio.h>

int fib(int);

int a[50]={0};

int main(void)
{
	int n;
	
	scanf("%d",&n);
	
	printf("%d\n",fib(n));
	
	return 0;
}

int fib(int n)
{
	a[1]=a[0]=1;
	if(a[n]!=0) return a[n];
	a[n] = fib(n-1) + fib(n-2);
	return a[n];
}

Measured memory_bytes: 596
import fractions

A,B,C,D =map(int,input().split())
c_i =  ((A+C-1)//C)
c_f = B//C
c_dis = c_f-c_i+1 if c_f-c_i >= 0 else 0

d_i = ((A+D-1)//D)
d_f = B//D
d_dis = d_f-d_i+1 if d_f-d_i>= 0 else 0

cd = C*D//fractions.gcd(C,D)
cd_i = ((A+cd-1)//cd)
cd_f = B//cd
cd_dis = cd_f-cd_i+1 if cd_f-cd_i >= 0 else 0

ans = B-A+1 - c_dis - d_dis+ cd_dis

print(ans)




Measured memory_bytes: 5076
#include<iostream>


using namespace std;

int main()
{
	int n,m;
	cin>>n>>m;
	int all=0;
	for(int i=0;i<m;i++){
		int x;cin>>x;
		all+=x;
	}
	if(n-all>=0){
		cout<<n-all<<endl;
	}else {
		cout<<-1<<endl;
	}
}

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

from fractions import gcd
# from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

import copy

N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for i in range(M)]

road = [ [] for i in range(N) ]

for ab in AB:
    road[ab[0]-1] += [ab[1]-1]
    road[ab[1]-1] += [ab[0]-1]

rets = [0 for i in range(N)]
visited = [0] * N
visited[0] = 1

D = deque([0])

while D:
    v = D.popleft()
    for i in road[v]:
        if visited[i]: continue
        visited[i] = 1
        rets[i] = v
        D.append(i)

print("Yes")
for i in rets[1:]:
    print(i+1)

Measured memory_bytes: 69584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

template<class T>
struct SegmentTree {
private:
    int n;
    vector<T> node;
    T def;
    function<T(T,T)> lop;
    function<T(T,T)> out;
    
public:
    SegmentTree() {}
    SegmentTree(const vector<T> &v, T _def, function<T(T,T)> _lop, function<T(T,T)> _out) {
        int vl = (int)v.size();
        n = 1;
        while(n < vl) n *= 2;
        def = _def; lop = _lop; out = _out;
        node = vector<T>(2 * n - 1, def);
        for(int i = 0; i < vl; i++) node[i + n - 1] = v[i];
        for(int i = n - 2; i >= 0; i--) node[i] = out(node[i * 2 + 1], node[i * 2 + 2]);
    }
    
    void update(int idx, T val) {
        idx += (n - 1);
        node[idx] = lop(node[idx], val);
        while(idx > 0) {
            idx = (idx - 1) / 2;
            node[idx] = out(node[idx * 2 + 1], node[idx * 2 + 2]);
        }
    }
    
    T query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = n;
        if ((r <= a) || (b <= l)) return def;
        if ((a <= l) && (r <= b)) return node[k];
        return out(query(a, b, 2 * k + 1, l, (l + r) / 2), query(a, b, 2 * k + 2, (l + r) / 2, r));
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, q;
    cin >> n >> q;
    auto lop = [](ll a, ll b){ return b; };
    auto out = [](ll a, ll b){ return min(a, b); };
    SegmentTree<ll> st(vector<ll>(n, INT_MAX), INT_MAX, lop, out);
    rep(i, q) {
        ll com;
        cin >> com;
        if (com == 0) {
            ll x, y;
            cin >> x >> y;
            st.update(x, y);
        }
        else {
            ll x, y;
            cin >> x >> y;
            cout << st.query(x, y + 1) << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 5668
//============================================================================
// Name        : hoba.cpp :)
// Author      : (O_O Diab) (Why_not) (el 3AQ)
// Version     :
// Copyright   : please, Don't touch me :(
// Description : problem in C++
// MAIN IDEA   :
//============================================================================
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define rw freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (int i=a;i<=(int)b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define p(x) cerr<<#x<<" = { "<<x<<" } \n"
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define EPS 1e-6
// to convert string to number use int a = stoi(string);
// to convert number to string use string s = to_string(int);
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define clr(c,x) memset(c,x,sizeof(c));
using namespace __gnu_pbds;
using namespace std;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int N = 5e3 + 1, mod = (int) 1e9 + 7, INF = 0x3f3f3f3f;
vi v;
int n, k, x, ig, dp1[N][N] = { }, dp2[N][N] = { };
int rig(int idx, int rem) {
	if (rem <= 0)
		return 0;
	if (idx >= (int) v.size())
		return 1e9;
	int &ret = dp1[idx][rem];
	if (ret != -1)
		return ret;
	ret = 1e9;
	ret = min(ret, rig(idx + 1, rem - v[idx]) + v[idx]);
	ret = min(ret, rig(idx + 1, rem));
	return ret;
}
int lef(int idx, int rem) {
	if (rem <= 0)
		return 0;
	if (idx < 0)
		return 1e9;
	int &ret = dp2[idx][rem];
	if (ret != -1)
		return ret;
	ret = 1e9;
	ret = min(ret, lef(idx - 1, rem - v[idx]) + v[idx]);
	ret = min(ret, lef(idx - 1, rem));
	return ret;
}
int main() {
#ifdef ONLINE_JUDGE
	FAST
#endif
	clr(dp1, -1);
	clr(dp2, -1);
	cin >> n >> k;
	lp(i,1,n)
	{
		cin >> x;
		if (x >= k) {
			ig++;
			continue;
		}
		v.pb(x);
	}
	sort(all(v));
	lp(i,0,v.size()-1)
	{
		x = k - v[i];
		lp(j,0,x)
		{
			ll l = lef(i - 1, j);
			ll r = rig(i + 1, x - j);
			if (i - 1 < 0)
				l = 0;
			if (i + 1 >= (int) v.size())
				r = 0;
//			if (i == 1) {
//				p(l);
//				p(r);
//			}
			if ((l + r < (ll) k) && (l + r + (ll) v[i] >= (ll) k)) {
				ig++;
				//			p(i);
				break;
			}
		}
	}
	cout << n - ig << "\n";
	return 0;
}

Measured memory_bytes: 195968
#include <iostream>

using namespace std;

int main(){
    int M, D;
    cin >> M >> D;
    int ans = 0;
    for(int i = 1; i <= M; i++){
        for(int j = 1; j <= D; j++){
            if(j <= 9) continue;
            int d1 = j%10;
            int d2 = (j-d1)/10;
            if(d1 == 1 || d2 == 1) continue;
            if(d1*d2 == i) {
                ans++;
                //cout << i << ' ' << j << ' ' << d1 << ' ' << d2 << endl;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
public static void main(String[] args){
  
int[] data = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  
Scanner sc = new Scanner(System.in);
// 整数の入力
int a = sc.nextInt();
// スペース区切りの整数の入力
//int b = sc.nextInt();
//int c = sc.nextInt();
// 文字列の入力
//String s = sc.next();
// 出力
System.out.println(data[a-1]);
}
}

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

int main(){
  int a; cin>>a;
  if(a == 111)
    cout<<999<<endl;
  else if(a == 119)
    cout<<991<<endl;
  else if(a == 191)
    cout<<919<<endl;
  else if(a == 911)
    cout<<199<<endl;
  else if(a == 199)
    cout<<911<<endl;
  else if(a == 919)
    cout<<191<<endl;
  else if(a == 991)
    cout<<119<<endl;
  else if(a == 999)
    cout<<111<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1e9
#define MOD 1e9+7
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x,y;
    cin>>x>>y;
    if(abs(x-y)<=1) cout<<"Brown"<<endl;
    else cout<<"Alice"<<endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var h, w, k int
	fmt.Scanf("%d %d %d", &h, &w, &k)

	cells := [][]int{}
	for i := 0; i < h; i++ {
		var s string
		fmt.Scanf("%s", &s)
		line := []int{}
		for j := 0; j < w; j++ {
			if s[j] == '.' {
				line = append(line, 0)
			} else {
				line = append(line, 1)
			}
		}
		cells = append(cells, line)
	}

	max := int(math.Pow(2, float64(h+w)))
	answer := 0
	for x := 0; x < max; x++ {
		c := countBlack(paint(cells, h, w, x), h, w)
		if c == k {
			answer++
		}
	}
	fmt.Printf("%d\n", answer)
}

func countBlack(cells [][]int, h, w int) int {
	count := 0
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if cells[i][j] == 1 {
				count++
			}
		}
	}
	return count
}

func paint(cells [][]int, h, w, choice int) [][]int {

	result := [][]int{}
	for i := 0; i < h; i++ {
		line := []int{}
		for j := 0; j < w; j++ {
			line = append(line, cells[i][j])
		}
		result = append(result, line)
	}

	for i := 0; i < h; i++ {
		if (choice>>uint64(i))%2 == 1 {
			for j := 0; j < w; j++ {
				result[i][j] = 0
			}
		}
	}
	choice = choice >> uint64(h)
	for j := 0; j < w; j++ {
		if (choice>>uint64(j))%2 == 1 {
			for i := 0; i < h; i++ {
				result[i][j] = 0
			}
		}
	}

	return result
}


Measured memory_bytes: 5976