akhauriyash/Code-Regression huggingface dataset:
#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>

auto& in = std::cin;
auto& out = std::cout;

#include <queue>
#include <vector>
#include <functional>
#include <utility>
#include <algorithm>
#include <iterator>


int32_t V, M, R;
int d[200][200]; // d[u][v]は辺e=(u,v)のコスト(存在しない場合はINF、ただしd[i][i]=0とする)
void warshall_floyd() {
	for (int k = 0; k < V; k++)
		for (int i = 0; i < V; i++)
			for (int j = 0; j < V; j++) d[i][j] = std::min(d[i][j], d[i][k] + d[k][j]);
}




template<typename T, typename U>
std::enable_if_t<std::rank<T>::value == 0> fill_all(T& arr, const U& v) {
	arr = v;
}
template<typename ARR, typename U>
std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR& arr, const U& v) {
	for (auto& i : arr) {
		fill_all(i, v);
	}
}

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);
	fill_all(d, 1000001000);
	in >> V>>M>>R;

	for (size_t i = 0; i < V; i++)
	{
		d[i][i] = 0;
	}
	int r[10];
	for (size_t i = 0; i < R; i++)
	{
		in >> r[i]; --r[i];
	}
	std::sort(r, r + R);
	for (size_t i = 0; i < M; i++)
	{
		int a, b, c;
		in >> a >> b >> c; --a; --b;
		d[a][b] = d[b][a] = c;
	}

	warshall_floyd();

	int32_t min = 2000001000;
	do {
		int32_t tmp = 0;
		for (size_t i = 1; i < R; i++)
		{
			tmp += d[r[i - 1]][r[i]];
		}
		min = std::min(min, tmp);
	} while (std::next_permutation(r, r + R));

	out << min << endl;
	return 0;
}
#endif

#if 0
#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>

auto& in = std::cin;
auto& out = std::cout;

std::unordered_set<int32_t> map;
int32_t N;

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

	in >> N;
	for (size_t i = 0; i < N; i++)
	{
		int a;
		in >> a;
		auto iter = map.find(a);
		if (map.end() == iter) {
			map.insert(a);
		}
		else {
			map.erase(iter);
		}
	}
	out << map.size() << endl;
	return 0;
}
#endif


Measured memory_bytes: 640
n, k = map(int, input().split())
mod = 10**9 + 7
def setFact(n, mod):
    global fact
    fact = [1]
    global ifact
    ifact = [1] * (n+1)
    for i in range(1, n+1):
        fact.append(fact[i-1]*i%mod)
    ifact[-1] = pow(fact[-1], mod-2, mod)
    for i in range(2, n+2):
        ifact[-i] = ifact[-i+1]*(n-i+2) %mod
def combination(n, k , mod):
    global fact
    global ifact
    if k < 0 or k > n:
        return 0
    else:
        return fact[n] * ifact[n-k] * ifact[k] % mod
setFact(n, mod)
ans = 0
for i in range(min(n+1, k+1)):
    ans += combination(n,i,mod) *combination(n-1,i, mod) %mod
    ans %= mod
print(ans)

Measured memory_bytes: 18988
module global_variables
end module global_variables
program main
  use global_variables
  implicit none
  integer::i,j,k,n,a,b,res
  read *, n,a,b
  res = 0
  do i=1,n
    j = sum((/(mod(i/(10**k),10),k=0,4)/))
    if (j < a .or. j > b) cycle
    res = res + i
  enddo
  print '(i0)', res
end program main



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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  map<int, int> mp;
  REP(i, n) {
    int a; cin >> a;
    mp[a]++;
  }

  bool ok = true;
  for(auto &e: mp) {
    ok &= e.second == 1;
  }

  cout << (ok ? "YES" : "NO") << endl;

}








Measured memory_bytes: 13000
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }

const ll MOD = ll(1e9) + 7;

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll modinv(ll i, ll mod){
    return modpow(i, mod-2, mod);
}

ll comb(ll n, ll a, ll mod) {
    ll ans = 1;
    rep(i,a) {
        ans = ans * (n - i) % mod;
        ans = ans * modinv(i+1, mod) % mod;
    }
    return ans;
}

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    ll ans = (modpow(2, n, MOD) - 1) % MOD;
    ans = (ans - comb(n, a, MOD)) % MOD;
    ans = (ans - comb(n, b, MOD)) % MOD;
    if (ans < 0) ans += MOD;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;
const int mod = 987654323;
const int ms = 100;
int a[ms], b[ms], c[ms];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    a[0] = mod;
    a[n] = mod;
    for (int i = 1; i < n; ++i) cin >> a[i];
    ll res = 0;
    for (int i = 1; i <= n; ++i)
    {
        res += min(a[i - 1], a[i]);
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
result = 0
cnt = 0
for n in range(N):
  a, b = map(int,input().split())
  if a == b:
    cnt += 1
  else:
    cnt = 0
  
  if cnt >= 3:
    result = 1 
    
print('Yes' if result else 'No')

Measured memory_bytes: 62280
A, B, C, D, E, F = map(int, input().split())

ans = -1
sugar = 0
sugar_water = 0
for a in range(F // (A * 100) + 1):
    for b in range((F - 100 * A * a) // (B * 100) + 1):
        for c in range((F - 100 * A * a - 100 * B * b) // C + 1):
            for d in range((F - 100 * A * a - 100 * B * b - C * c) // D + 1):
                x = a * A + b * B
                y = c * C + d * D
                if x == 0:
                    continue
                if x * E >= y and ans < (100 * y)/(x*100+y):
                    ans = (100 * y)/(x*100+y)
                    sugar = y
                    sugar_water = 100 * x + y
print(sugar_water,sugar)


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

if n % 2 == 1:
    print(0)
    exit()

if n < 9:
    print(0)
    exit()

need = n // 10

ans = need
tmp = need
start = 1
"""
while tmp != 0:
    ans += tmp // 10
    tmp = tmp // 10
    #print(tmp)
"""
tmp = need

while tmp != 0:
    ans += tmp // 5
    tmp = tmp // 5

print(ans)

Measured memory_bytes: 38384
N, x = map(int, input().split())
A = sorted(list(map(int, input().split())))

cnt = 0
for i in range(N):
  if i == N - 1:
    if x == A[i]:
      cnt += 1
      x -= A[i]
  else:
    if x >= A[i]:
      cnt += 1
      x -= A[i]

print(cnt)


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

using namespace std;

#define reps(i, n, m) for (int i = (int) (n); i < (int) (m); i++)
#define rep(i, n) reps(i, 0, (n))
#define all(v) (v).begin(), (v).end()

int main() {
    int n; cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    int q; cin >> q;
    while (q--) {
        int a; cin >> a;
        auto i = lower_bound(all(v), a);
        cout << (i != v.end() && *i == a) << endl;
    }
}


Measured memory_bytes: 3100
#include <stdio.h>

int main(void) {
  int n;
  int i;

  scanf("%d", &n);

  for (i = 1; i <= n; i++) {
    int x = i;
    /* 3の倍数を表示 */
    if (x % 3 == 0)
      printf(" %d", i);
    /* それ以外の場合でも、いずれかの桁に3が含まれていれば表示 */
    else {
      while (x) {
        if (x % 10 == 3) {
          printf(" %d", i);
          break;
        }
        x /= 10;
      }
    }
  }
  printf("\n");
  return 0;
}

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

using namespace std;

int main() {
   string s, t;
   bool flag = false;
   cin >> s >> t;
   sort(s.begin(), s.end());
   sort(t.begin(), t.end(), greater<char>());
 
   if (s < t)
       cout << "Yes";
   else
       cout << "No";
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int m,f,r,sum;
    while (true){
    cin >> m >> f >> r;
    sum=(m+f);
     if(m==-1&&f==-1&&r==-1){
            break;
    }
    if(m==-1||f==-1){
        cout << "F" <<endl;
    }
    else if(sum>=80){
        cout << "A"<<endl;
    }
    else if(sum>=65&&sum<80){
       cout << "B"<<endl;
    }
    else if(sum>=50&&sum<65){
        cout << "C"<<endl;
    }
    else if(r>=50){
        cout <<"C"<<endl;
    }
    else if (sum>=30&&sum<50){
        cout << "D"<<endl;
    }

    else {
        cout << "F"<< endl;
    }

    }
    return 0;
}



Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;

vector<int> to[200020];
vector<int> ans;
void dfs(int v, int p = -1) {
    for(int x : to[v]) {
        if(x==p) continue;
        ans[x] += ans[v];
        dfs(x, v);
    }
}
int main() {
    int n, q;
    cin >> n >> q;
    ans.assign(n, 0);
    rep(i,n-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    rep(i,q) {
        int p, x;
        cin >> p >> x;
        p--;
        ans[p] += x;   
    }
    dfs(0);
    rep(i,n) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 23424
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
int a[3];
int main() {
	int i, j, k;
	scanf("%d%d%d", &a[0], &a[1], &a[2]);
	int ans = 0;
	for(i = 0; i < 3; i++){
		for(j = i+1; j < 3; j++){
			k = 3-i-j;
			if((a[i]&1) == (a[j]&1) && (a[i]&1) != (a[k]&1)) a[i]++, a[j]++, ans++;
		}
	}
	sort(a, a+3);
	printf("%d\n", (a[2]-a[0])/2+(a[2]-a[1])/2+ans);
	return 0;
}

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

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			int N = int.Parse(Console.ReadLine());
            int[] A = new int[N];
            string[] str = Console.ReadLine().Split(' ');
            for(int i = 0; i < N; i++)
            {
                A[i] = int.Parse(str[i]);
            }
            int M = 0;
            int[] TMP = new int[N];
            int[] B = new int[N];

            for(int i = N; i > 0; i--)
            {
                int j = 1,count = 0;
                while (i*j <= N)
                {
                    if (B[i*j -1] == 1) count++;
                    j++;
                }
                if ((count + A[i - 1]) % 2 == 0) B[i - 1] = 0;
                else
                {
                    TMP[M] = i;
                    M++;
                    B[i - 1] = 1;
                }
            }

            Console.WriteLine(M);
            //for (int i = 0; i < M - 1; i++) Console.Write($"{B[i]} ");
            for (int i = 0; i < M - 1; i++) Console.Write($"{TMP[i]} ");
            if(M > 0) Console.WriteLine(TMP[M - 1]);
            Console.ReadLine();

		}
	}
}


Measured memory_bytes: 27484
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
template <typename T>
using V = std::vector<T>;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  V<i64> a(n);
  REP(i, n) cin >> a[i];
  V<i64> s = a;
  sort(s.begin(), s.end());

  multiset<i64> ms;

  REP(i, n) {
    auto it = ms.lower_bound(a[i]);
    if (it != ms.begin()) {
      --it;
      ms.erase(it);
    }
    ms.insert(a[i]);
  }

  cout << ms.size() << endl;
}


Measured memory_bytes: 9468
#include<stdio.h>
int main(){
  int m1,d1;
  scanf("%d %d",&m1,&d1);
  int m2,d2;
  scanf("%d %d",&m2,&d2);
  if(d2==1)
    printf("%d",1);
  else
    printf("%d",0);
  return 0;
}

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

int main(){
	double x1,y1,x2,y2,x,y,d;

	cin>>x1>>y1>>x2>>y2;
	x=abs(x1-x2);y=abs(y1-y2);

	d=sqrt(x*x+y*y);
	printf("%.10f\n",d);
	

}

Measured memory_bytes: 3200
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>


using namespace std;

// vector<vector<int>> mat(N, vector<int>(M, 0));

int main(int argc, const char *argv[])
{
    //ABC142

    int N;
    cin>>N;
    int count = 0;
    for (int i = 1; i <=N; i++)
    {
        if(i%2 == 1)
        {
            count++;
        }
    }

    double prob = double(count)/double(N);

    cout<<prob;
    

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long 
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) a.begin(),a.end()
#define ld long double
#define ub upper_bound
#define lb lower_bound
#define pii pair<int,int>
using namespace std;
signed main(){
    fast;
    int n,m;
    cin>>n>>m;
    int s[m+1],c[m+1];
    int ans[n+1];
    memset(ans,-1,sizeof(ans));
    for(int i=1;i<=m;i++){
        cin>>s[i]>>c[i];
        if(ans[s[i]] == -1)
            ans[s[i]] = c[i];
        else if(c[i]!=ans[s[i]]){
            cout<<-1;
            return 0;
        }
    }
    if(n>=2){
        if(ans[1] == 0){
            cout<<-1;
            return 0;
        }
    }
    if(n == 1){
        if(ans[1] == -1){
            cout<<0;
            return 0;
        }
    }
    for(int i=1;i<=n;i++){
        if(i == 1 && ans[i] == -1){
            cout<<1;
        }
        else if(ans[i] == -1)
            cout<<0;
        else cout<<ans[i];
    }

}

Measured memory_bytes: 256
N = int(input())
S = input()

ans_list = []

for s in S:
    new_ord = ord(s) + N
    if new_ord <= 90:
        ans_list.append(chr(new_ord))
    else:
        ans_list.append(chr(new_ord - 26))

ans = ''.join(ans_list)

print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n; cin>>n;
	int cnt=1;
	int mx; cin>>mx;
	int t;
	For(i,1,n-1)
	{
		cin>>t;
		if(t>=mx) cnt++;
		mx=max(mx,t);
	}
	cout<<cnt<<"\n";
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);

        int MOD = 2019;
        long l = sc.nextLong();
        long r = sc.nextLong();

        long nextLMOD = l + (MOD - (l % MOD));
        if (r >= nextLMOD) {
            System.out.println(0);
            return;
        }

        long min = Integer.MAX_VALUE;
        for (long i = l; i < r; i++) {
            for (long j = i + 1; j <= r; j++) {
                min = Math.min(min, (i % MOD) * (j % MOD) % MOD);
            }
        }

        System.out.println(min);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 21204
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(long long i=0;i<n;i++)
#define REP1(i,n) for(long long i=1;i<=n;i++)
#define REP2D(i,j,h,w) for(long long i=0;i<h;i++) for(long long j=0;j<w;j++)
#define REP2D1(i,j,h,w) for(long long i=1;i<=h;i++) for(long long j=1;j<=w;j++)
#define PER(i,n) for(long long i=((n)-1);i>=0;i--)
#define PER1(i,n) for(long long i=(n);i>0;i--)
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define FORE(i,a,b) for(long long i=(a);i<=(b);i++)
#define ITE(arr) for(auto ite=(arr).begin();ite!=(arr).end();++ite)
#define ALL(a) (a.begin()),(a.end())
#define RANGE(a) (a),(a+sizeof(a))
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define YNPRT(b) cout<<((b)?"Yes":"No")<<endl
#define REV(arr) reverse(ALL(arr))
#define PRT(a) cout<<a<<endl;
#define PRTLST(arr,num) REP(_i,num) cout<<_i<<" - "<<arr[_i]<<endl;
#define PRTLST2(arr2,d1,d2) REP(_i,d1) REP(_j,d2) cout<<_i<<","<<_j<<" : "<<arr2[_i][_j]<<endl;
#define PRTLST2D(arr2,d1,d2) do{cout<<"L\t";REP(_i,d2) cout<<_i<<"\t"; cout<<endl; REP(_i,d1){cout<<_i<<"\t";REP(_j,d2){cout<<arr2[_i][_j]<<"\t";}cout<<endl;}}while(0);
#define MIN(target,v1) (target)=min(target,v1)
#define MAX(target,v1) (target)=max(target,v1) 
#define P1 first
#define P2 second
#define PB push_back
#define UB upper_bound
#define LB lower_bound
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF_INT = 2147483647;
const ll INF_LL = 9223372036854775807LL;
const ull INF_ULL = 18446744073709551615Ull;
const ll P = 92540646808111039LL;
const int Move[4][2] = {-1,0,0,1,1,0,0,-1};
const int Move_[8][2] = {-1,0,-1,-1,0,1,1,1,1,0,1,-1,0,-1,-1,-1};
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p) {os<<"( "<<p.P1<<" , "<<p.P2<<" )";return os;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {ITE(v) os << (ite-v.begin()) << " : " << *ite <<endl;return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v) {os<<" { ";ITE(v) {os<<*ite;if(ite!=--v.end()){os<<" , ";}} os<<" } ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& m) {ITE(m) {os<<ite->P1<<"\t\t|->\t\t"<<ite->P2<<endl;} return os;}

//---------------------
#define MAXN 100000
//---------------------

ll n,a,b;

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

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()

int main(){
    cout << setprecision(20);
    ll t[2], a[2], b[2];
    cin >> t[0] >> t[1];
    cin >> a[0] >> a[1];
    cin >> b[0] >> b[1];

    ll x[2], y[2];
    rep(i, 2){
        x[i] = a[i]*t[i];
        y[i] = b[i]*t[i];
    }
    
    if(x[0]+x[1]==y[0]+y[1]){
        cout << "infinity" << endl;
    }
    else{
        if(x[0]+x[1]<y[0]+y[1]) swap(x, y);
        if(x[0]>y[0]) cout << 0 << endl;
        else{
            ll d = x[0]+x[1] - (y[0]+y[1]);
            ll c = (y[0]-x[0]-1) / d;
            c = c*2 + 1;
            if((y[0]-x[0])%d==0) ++c;
            cout << c << endl;
        }
    }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

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

        int plus = a + b;
        int minus = a - b;
        int mul = a * b;
        int max = Math.max(plus, Math.max(minus, mul));

        System.out.println(max);
    }
}


Measured memory_bytes: 22740
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
using namespace std;


#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>


ll n, m, ini;
#define PP pair<ll, P>
ll d[50][5000]; // 結果
struct edge { ll to, cost, ka; };
vector<edge> g[110000]; //隣接リスト to, cost
ll r[60], mi[60];

void dijkstra(ll a) { //実装汚いからそのうち直す
	priority_queue<PP, vector<PP>, greater<PP> > q; // cost, to, 条件
	REP(i, n)fill(d[i], d[i] + 5000, INF);

	d[a][min(ini, 2500ll)] = 0;
	q.push(PP(0, P(a, min(ini, 2500ll))));
	while (!q.empty()) {
		PP p = q.top();
		q.pop();
		ll v = p.second.first, gi = p.second.second;
		if (d[v][p.second.second] < p.first) continue;
		ll ne = min(2500ll, gi + r[v]);
		if (d[v][ne] > d[v][gi] + mi[v]) {
			d[v][ne] = d[v][gi] + mi[v];
			q.push(PP(d[v][ne], P(v, ne)));
		}
		REP(i, g[v].size()) {
			edge e = g[v][i];
			if (gi - e.ka < 0)continue;
			if (d[e.to][gi - e.ka] > d[v][gi] + e.cost) {
				d[e.to][gi - e.ka] = d[v][gi] + e.cost;
				q.push(PP(d[e.to][gi - e.ka], P(e.to, gi - e.ka)));
			}
		}
	}
}
int main() {
	cin >> n >> m >> ini;
	REP(i, m) {
		ll a, b, c, d;
		cin >> a >> b >> c >> d;
		a--;
		b--;
		g[a].push_back({ b, d, c });
		g[b].push_back({ a, d, c });
	}
	REP(i, n)cin >> r[i] >> mi[i];
	dijkstra(0);
	REPO(i, n - 1) {
		ll now = INF;
		REP(j, 5000) {
			now = min(now, d[i][j]);
		}
		cout << now << endl;
	}
}


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

int main() {
  long long x;
  cin >> x;

  int ans = 0;
  for (int i=1; i<=x; i++) {
    if (i * (i + 1) / 2 >= x) {
      ans = i;
      break;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<functional>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

double const INF = 1e18;
struct range { 
  double ma, mi;
  range(): ma(-INF), mi(INF) {}
  range(double hi, double lo): ma(hi), mi(lo) {}
  void update(double v) {
    ma = std::max(ma, v);
    mi = std::min(mi, v);
  }
void print() const { std::cout << "[" << mi << ", " << ma << "]\n"; }
};

void add_time(std::vector<double>& ts, range r[3]) {
  auto add_one = [&](std::vector<double>& t, double v)->void { if(v >= 0 && v <= 2e8) t.push_back(v); };
  //up to stop;
  add_one(ts, r[1].ma - r[2].ma);
  add_one(ts, r[1].ma - r[2].mi);
  add_one(ts, r[1].mi - r[2].ma);
  add_one(ts, r[1].mi - r[2].mi);
  //down to stop;
  add_one(ts, r[0].ma - r[1].ma);
  add_one(ts, r[0].ma - r[1].mi);
  add_one(ts, r[0].mi - r[1].ma);
  add_one(ts, r[0].mi - r[1].mi);
  // up to down
  add_one(ts, (r[0].ma - r[2].ma)*0.5);
  add_one(ts, (r[0].ma - r[2].mi)*0.5);
  add_one(ts, (r[0].mi - r[2].ma)*0.5);
  add_one(ts, (r[0].mi - r[2].mi)*0.5);
}

int main() {
  std::cout << std::setprecision(10) << std::fixed;
  int N; std::cin >> N;
  range x[3], y[3]; // 0:dec, 1:stop, 2:inc
  for(int i = 0; i < N; ++i) {
    double xx, yy; char d; std::cin >> xx >> yy >> d;
    switch(d) {
    case 'R': x[2].update(xx); y[1].update(yy); break;
    case 'L': x[0].update(xx); y[1].update(yy); break;
    case 'U': x[1].update(xx); y[2].update(yy); break;
    case 'D': x[1].update(xx); y[0].update(yy); break;
    }
  }
  std::vector<double> ts(1, 0);
  add_time(ts, x);
  add_time(ts, y);
  std::sort(ts.begin(), ts.end());
  ts.erase(std::unique(ts.begin(), ts.end()), ts.end());
  auto f = [&](double t) {
    auto calc = [](double t, range r[3]) {
      double ma = r[1].ma, mi = r[1].mi;
      ma = std::max(ma, r[0].ma - t);
      ma = std::max(ma, r[2].ma + t);
      mi = std::min(mi, r[0].mi - t);
      mi = std::min(mi, r[2].mi + t);
      return ma - mi;
    };
    return calc(t, x)*calc(t, y);
  };
  
  double ans = INF;
  for(auto const& t: ts) ans = std::min(ans, f(t));
  fin(ans);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

int main() {
    int h, w;
    cin >> h >> w;
    char s[h][w];
    for (int i = 0; i < h; i++)for (int j = 0; j < w; j++) cin >> s[i][j];
    int nx, ny, cnt;
    for (int cx = 0; cx < h; cx++) {
        for (int cy = 0; cy < w; cy++) {
            if (s[cx][cy] == '#') {
                cout << s[cx][cy];
                if (cy == w-1) cout << endl;
                continue;
            }
            cnt = 0;
            for (int dx = -1; dx <= 1; dx++) {
                for (int dy = -1; dy <= 1; dy++) {
                    nx = cx + dx, ny = cy + dy;
                    if (0 <= nx && nx < h && 0 <= ny && ny < w && s[nx][ny] == '#') cnt++;
                }
            }
            cout << cnt;
            if (cy == w-1) cout << endl;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <queue>
using namespace std;
int you[]={1,2,3,4,5,6,7,8,0};
int zuo[]={8,0,1,2,3,4,5,6,7};
int shang[]={3,4,5,6,7,8,0,1,2};
int xia[]={6,7,8,0,1,2,3,4,5};
int jiecheng[]={1,2,6,24,120,720,5040,40320};
int canto(string &s){
    int sum=0;
    int i,j;
    for(i=0;i<9;i++){
        int cnt=0;
        for(j=i+1;j<9;j++){
            if(s[i]>s[j])
                cnt++;
        }
        sum+=cnt*jiecheng[7-i];
    }
    return sum;
}
int vis[400000];
struct node{
    string a;
    int cost;
    node(string b,int c){
        a=b;
        cost=c;
    }
};
bool operator<(const node &a,const node &b){
    return a.cost>b.cost;
}
bool changeA(string &a,int p){
    swap(a[p],a[you[p]]);
}
bool changeB(string &a,int p){
    swap(a[p],a[zuo[p]]);
}
bool changeC(string &a,int p){
    swap(a[p],a[shang[p]]);
}
bool changeD(string &a,int p){
    swap(a[p],a[xia[p]]);
}

int ch,cv;
int bfs(string start,string end){
    int tar=canto(end);
    priority_queue<node> q;
    node temp(start,0);
    q.push(temp);
    int flag;
    int ans;
    while(!q.empty()){
        temp=q.top();
        q.pop();
        int index=canto(temp.a);
        if(index==tar){
            ans=temp.cost;
            break;
        }
        if(vis[index]==1)
            continue;
        vis[index]=1;
        int p;
        for(p=0;p<9;p++)
            if(temp.a[p]=='0')
                break;
        changeA(temp.a,p);
        temp.cost+=ch;
        q.push(temp);
        changeA(temp.a,p);
        changeB(temp.a,p);
        q.push(temp);
        temp.cost-=ch;
        changeB(temp.a,p);
        changeC(temp.a,p);
        temp.cost+=cv;
        q.push(temp);
        changeC(temp.a,p);
        changeD(temp.a,p);
        q.push(temp);
        temp.cost-=cv;
        changeD(temp.a,p);
    }

    return ans;
}
int main(){
    string aa="012345678";
    string bb="876543210";
    //cout<<canto(aa)<<' '<<canto(bb)<<endl;
    while(scanf("%d%d",&ch,&cv)!=EOF){
        if(ch==0&&cv==0)
            return 0;
        string a,b;
        int i;
        for(i=0;i<9;i++){
            int x;
            scanf("%d",&x);
            a+=(x+'0');
        }
        for(i=0;i<9;i++){
            int x;
            scanf("%d",&x);
            b+=(x+'0');
        }
        memset(vis,0,sizeof(vis));
        int ans=bfs(a,b);
        printf("%d\n",ans);
    }
}

Measured memory_bytes: 28752
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;let mut next =||{iter .next () .unwrap () } ;input_inner !{next ,$($r ) *} } ;($($r :tt ) *) =>{let stdin =std ::io ::stdin () ;let mut bytes =std ::io ::Read ::bytes (std ::io ::BufReader ::new (stdin .lock () ) ) ;let mut next =move ||->String {bytes .by_ref () .map (|r |r .unwrap () as char ) .skip_while (|c |c .is_whitespace () ) .take_while (|c |!c .is_whitespace () ) .collect () } ;input_inner !{next ,$($r ) *} } ;}
macro_rules !input_inner {($next :expr ) =>{} ;($next :expr ,) =>{} ;($next :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($next ,$t ) ;input_inner !{$next $($r ) *} } ;}
macro_rules !read_value {($next :expr ,($($t :tt ) ,*) ) =>{($(read_value !($next ,$t ) ) ,*) } ;($next :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($next ,$t ) ) .collect ::<Vec <_ >>() } ;($next :expr ,chars ) =>{read_value !($next ,String ) .chars () .collect ::<Vec <char >>() } ;($next :expr ,usize1 ) =>{read_value !($next ,usize ) -1 } ;($next :expr ,$t :ty ) =>{$next () .parse ::<$t >() .expect ("Parse error" ) } ;}

fn main() {
   input! {
      n: usize,
      m: usize
   }

   let s = n;
   let mut c = m;
   if s > c/2 {
      println!("{}", c/2);
      return;
   }
   let mut ans = s;
   c -= 2*s;
   ans += c/4;
   println!("{}", ans);
}


Measured memory_bytes: 4352
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(void)
{
    int r,d,x;

    cin >>r >>d >>x;

    for(int i = 0; i < 10; i++){
        x = x*r-d;
        printf("%d\n",x);
    }

    return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	io, flush := NewIO()
	defer flush()
	n := io.ScanInt()
	blocks := io.ScanInts(n)
	curNum := 1
	var count int
	for i := 0; i < n; i++ {
		if blocks[i] == curNum {
			curNum++
			continue
		}
		if blocks[i] != curNum {
			count++
		}
	}
	if curNum == 1 {
		io.Println(-1)
	} else {
		io.Println(count)
	}
}

type IO struct {
	scanner *bufio.Scanner
	writer  *bufio.Writer
}

func NewIO() (*IO, func()) {
	io := &IO{
		scanner: newScanner(),
		writer:  newWriter(),
	}
	return io, func() { io.writer.Flush() }
}

func newScanner() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Buffer(make([]byte, 10000000), 10000000)
	s.Split(bufio.ScanWords)
	return s
}

func newWriter() *bufio.Writer {
	return bufio.NewWriter(os.Stdout)
}

func (io *IO) ScanBytes() []byte {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Bytes()
}

func (io *IO) ScanString() string {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Text()
}

func (io *IO) ScanStrings(n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		strs[i] = io.ScanString()
	}
	return strs
}

func (io *IO) Scan2DStrings(y, x int) [][]string {
	strings := make([][]string, y)
	for i := 0; i < y; i++ {
		strings[i] = io.ScanStrings(x)
	}
	return strings
}

func (io *IO) Scan2DGraph(y int) [][]string {
	strs := make([][]string, y)
	for i := 0; i < y; i++ {
		strs[i] = strings.Split(io.ScanString(), "")
	}
	return strs
}

func (io *IO) ScanInt() int {
	return int(io.ScanInt64())
}

func (io *IO) ScanInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = io.ScanInt()
	}
	return ints
}

func (io *IO) Scan2DInts(y, x int) [][]int {
	ints := make([][]int, y)
	for i := 0; i < y; i++ {
		ints[i] = io.ScanInts(x)
	}
	return ints
}

func (io *IO) ScanInt64() int64 {
	i, err := strconv.ParseInt(io.ScanString(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *IO) ScanFloat64() float64 {
	i, _ := strconv.ParseFloat(io.ScanString(), 64)
	return i
}

func (io *IO) ScanFloat64s(n int) []float64 {
	floats := make([]float64, n)
	for i := 0; i < n; i++ {
		floats[i] = io.ScanFloat64()
	}
	return floats
}

func (io *IO) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


Measured memory_bytes: 7552
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    double t, x;
    cin >> t >> x;
    printf("%.10f\n", t / x);
}

Measured memory_bytes: 256
eval"H,W,*A="+`dd`.split*?,
B=A.pop H*W
d=[1<<12800]+[0]*~-W
H.times{
  t=A.shift(W).zip(B.shift W).map{|a,b|(a-b).abs}
  n=0;d=d.zip(t).map{|d,t|d|=n;n=d<<t|d>>t}
}
p (0..25600).map{|i|(12800-i*d[-1][i]).abs}.min


Measured memory_bytes: 30340
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <stdio.h>
int main()
{
    int n,k,itr,ans;
    //int a;
    //std::vector<int> v;
    itr = 0;
    ans = 0;
    std::cin >> n >> k;
    //for(int i=0;i<n;i++){
    //    std::cin >> a;
    //    v.push_back(a);
    //}
    while (itr < n-1){
        itr = itr + (k-1);
        ans++;
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
s = open(0).read()
sum = [0 for _ in range(26)]
for i in range(len(s)):
    for j in range(97,97+26):
        if s[i] == chr(j):
            sum[j-97] += 1
    for j in range(65,65+26):
        if s[i] == chr(j):
            sum[j-65] += 1
for i in range(26):
    print(f'{chr(i+97)} : {sum[i]}')



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

const int INF = 1 << 30;

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

    int K = 1 << N;

    std::vector<int> dp(K, INF);
    dp[0] = 0;

    for (int i = 0; i < M; i++) {
        int a, b;
        std::cin >> a >> b;

        int x = 0;
        for (int j = 0; j < b; j++) {
            int c;
            std::cin >> c;
            x += 1 << --c;
        }

        for (int j = K - 1; j >= 0; j--) {
            dp[j | x] = std::min(dp[j | x], dp[j] + a);
        }
    }

    std::cout << (dp[K - 1] == INF ? -1 : dp[K - 1]) << "\n";
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		List<String> s = new ArrayList<String>(Arrays.asList(sc.next().split("")));
		char ans = 'a';
		while (s.indexOf(String.valueOf(ans)) != -1)
			ans++;
		System.out.println((ans <= 'z')? ans : "None");
	}
}

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

int main() {
  int n,T;
  cin >> n >> T;
  vector<int> c(n),t(n);
  for(int i = 0; i < n ; i++){
    cin >> c.at(i) >> t.at(i) ;
  }
  
  int ans = 1001;
  for(int i = 0; i<n ; i++){
    if(t.at(i) <= T){
      if(ans > c.at(i)){
        ans = c.at(i);
      }
    }
  }
  
  if(ans == 1001){
    cout << "TLE" << endl;
  }
  else{
    cout << ans << endl;
  }
}

    


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

using namespace std;

int score(int select, char t, int r, int s, int p) {
  if (select == 0 && t == 's') return r;
  if (select == 1 && t == 'p') return s;
  if (select == 2 && t == 'r') return p;
  return 0;
}

int main() {
  int n, k, r, s, p;
  string t;
  cin >> n >> k >> r >> s >> p;
  cin >> t;
  
  // Kのモジュロごとに、
  // n回目でXを選んだときの最大累積点数は
  // Xのスコア + Xを選ばなかったときのn+K回目の最大累積点数
  long long sum = 0;
  int dp[n][3];
  for (int mod=0; mod<k; mod++) {
    int start = mod;
    while (start + k < n) {
      start += k;
    }
    for (int i=0; i<3; i++) dp[start][i] = score(i, t[start], r, s, p);
    for (int i=start-k; i >= 0; i-=k) {
      for (int j=0; j<3; j++) {
        dp[i][j] = score(j, t[i], r, s, p)
                 + max(dp[i+k][(j+1)%3], dp[i+k][(j+2)%3]);
      }
    }
    sum += max(dp[mod][0], max(dp[mod][1], dp[mod][2]));
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 1664
#include<stdio.h>
int main(){
  int a,b,c;
  int i = 0;
  scanf("%d %d %d",&a,&b,&c);
  for(a;a <= b;a++){
    if(c % a == 0){
      i++;
    }
  }
  printf("%d\n",i);
  return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <queue>
using namespace std;
int main() {
	int N, M;
	cin >> N >> M;
	priority_queue<int> Queue;
	for (int i = 0; i < N; i++) {
		int A;
		cin >> A;
		Queue.push(A);
	}
	for (int i = 0; i < M; i++) {
		int A = Queue.top();
		if (A == 0) break;
		Queue.pop();
		Queue.push(A / 2);
	}
	long long sum = 0;
	while (!Queue.empty()) {
		sum += Queue.top();
		Queue.pop();
	}
	cout << sum << endl;

}


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

cost = 0
num = 0

for i in range(N-1):
    cost = max(0, a[i] + a[i+1] - x)
    num += cost
    a[i+1] = max(0, a[i+1] - cost)

print(num)

Measured memory_bytes: 14052
import java.util.*;

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

        int n = scanner.nextInt();
        HashSet<String> set = new HashSet<>();

        for (int i = 0; i < n; ++i) {
            String command = scanner.next(), str = scanner.next();

            if (command.equals("insert")) set.add(str);
            else System.out.println((set.contains(str) ? "yes" : "no"));
        }
    }
}


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

bool hantei(int n){
    bool hantei;
    int cnt = 0;
    while(n>0){
        n/=10;
        cnt++;
    }
    if(cnt%2==0){
        hantei = false;
    }else{
        hantei = true;
    }
    return hantei;
}

int main(){
    int n;
    cin >> n;
    int ans = 0;
    for(int i=1;i<=n;i++){
        if(hantei(i)) ans++;
    }
    cout << ans << endl;
}

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

int main(){
    int x,n;
    cin>>x>>n;
    if(n==0){
        cout<<x<<endl;
    }else{
        vector<bool>a(102);
        int l;
        for(int i=0;i<n;i++){
            cin>>l;
            a[l]=true;
        }
        for(int i=0;i<=100;i++){
            if(a[x-i]==false){
                cout<<x-i<<endl;
                return 0;
            }else if(a[x+i]==false){
                cout<<x+i<<endl;
                return 0;
            }
        }
    }
    return 0;

}

Measured memory_bytes: 3640
package main

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

var (
	r  *N
	sc *bufio.Scanner = bufio.NewScanner(os.Stdin)
)

type N struct {
	Key        int
	Prev, Next *N
}

func Search(key int) *N {
	cur := r.Next
	for cur != r {
		if cur.Key == key {
			return cur
		}
		cur = cur.Next
	}
	return cur
}

func Insert(key int) {
	n := &N{
		Key: key,
	}
	n.Next = r.Next
	r.Next.Prev = n
	r.Next = n
	n.Prev = r
}

func DeleteNode(n *N) {
	n.Prev.Next = n.Next
	n.Next.Prev = n.Prev
}

func Delete(key int) {
	n := Search(key)
	if n == r {
		return
	}
	DeleteNode(n)
}

func DeleteFirst() {
	DeleteNode(r.Next)
}

func DeleteLast() {
	DeleteNode(r.Prev)
}

func Print() {
	cur := r.Next
	out := []string{}
	for cur != r {
		out = append(out, strconv.Itoa(cur.Key))
		cur = cur.Next
	}
	fmt.Println(strings.Join(out, " "))
}

func scanN() int {
	sc.Scan()
	n, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return n
}

func scanCommand() (string, int) {
	sc.Scan()
	cmd := strings.Split(sc.Text(), " ")
	if len(cmd) > 1 {
		key, err := strconv.Atoi(cmd[1])
		if err != nil {
			panic(err)
		}
		return cmd[0], key
	} else {
		return cmd[0], -1
	}
}

func main() {
	r = &N{}
	r.Prev = r
	r.Next = r

	n := scanN()

	for i := 0; i < n; i++ {
		cmd, key := scanCommand()
		if key < 0 {
			switch cmd {
			case "deleteFirst":
				DeleteFirst()
			case "deleteLast":
				DeleteLast()
			}
		} else {
			switch cmd {
			case "insert":
				Insert(key)
			case "delete":
				Delete(key)
			}
		}
	}
	Print()
}


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

int n,d,m[100],id[100],p[100],num;
int c[100][10000];

int main(){
  while(scanf("%d%d",&n,&d), n){
    num = 0;
    rep(i,n){
      scanf("%d",&m[i]);

      p[i] = 0;
      rep(j,m[i]){
	scanf("%d",&c[i][j]);
	p[i] += c[i][j];
      }

      num += m[i];
      id[i] = m[i]-1;
    }

    bool f = true;
    while(num--){
      int maxv = -1, secv = -1;
      rep(j,n){
	secv = max(secv,p[j]);
	if(secv > maxv)swap(secv,maxv);
      }

      f = false;
      rep(j,n){
	if(id[j]>=0){
	  if(p[j] == maxv){
	    if(secv<0 || secv-d<=p[j]-c[j][id[j]]){
	      p[j] -= c[j][id[j]];
	      id[j]--;
	      f = true;
	      break;
	    }
	  }else if(maxv-d<=p[j]-c[j][id[j]]){
	    p[j] -= c[j][id[j]];
	    id[j]--;
	    f = true;
	    break;
	  }
	}
      }

      if(!f)break;
    }
    printf(f?"Yes\n":"No\n");
  }
}

Measured memory_bytes: 1492
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
ll maxl(ll a, ll b){ return ((a<b)?b:a);}
ll minl(ll a, ll b){ return ((a>b)?b:a);}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin >> arr[i];
    }
    sort(arr,arr+n);
    ll ans = 0;
    for (int i=0;i<n-2;i++){
        for (int j=i+1;j<n-1;j++){
            for (int k=j+1;k<n;k++){
                if (arr[i] == arr[j] || arr[j] == arr[k] || arr[i] == arr[k])
                    continue;
                if (arr[i] + arr[j] > arr[k]){
                    ans++;
                }
            }
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 3656
//#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;


// 基本テンプレート
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// 型
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T>
constexpr int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F>
constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T>
void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C>
void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U>
constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U>
constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C>
constexpr void reverse(C& c) { reverse(ALL(c)); }
template<typename C>
constexpr void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred>
constexpr void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// 定数
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9+7)
#pragma endregion


int main()
{
    int a, b;
    cin >> a >> b;
    if (a==0||b==0||a<=0&&b>=0) {
        P("Zero");
        return 0;
    }
    else if (a<0&&(b-a)%2==0) {
        P("Negative");
        return 0;
    }
    else if(a<0) {
        P("Positive");
        return 0;
    }
    else
        P("Positive");
    return 0;
}



Measured memory_bytes: 256
from sys import stdin

if __name__ == "__main__":
  N = int(input())
  X = [int(i) for i in input().split()]
  
  min_total_cost = 10**7
  for p in range(1, 100+1):
    total_cost = 0
    for x in X:
      total_cost += (p-x)**2
    
    min_total_cost = min(total_cost, min_total_cost)

  print(min_total_cost)

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

using ll=long long;
const ll MOD=1000000007;

int main() {
  ll ans=0;
  map<string,int> Map;
  ll n;
  cin >> n;
  for(int i=0;i<n;i++){
    string s;
    cin >> s;
    Map[s]++;
  }
  ll m;
  cin >> m;
  for(int i=0;i<m;i++){
    string t;
    cin >> t;
    Map[t]--;
  }
  for(auto p:Map){
    ll k=p.second;
    ans=max(ans,k);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(c)       int(c.size())
#define rep(i,a,b)  for (int i=a; i<(b); ++i)
#define per(i,a,b)  for (int i=(b)-1; i>=(a); --i)
#define fore(c,...) for (auto __VA_ARGS__:(c))
using namespace std;
typedef long long ll;



int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cout<<fixed<<setprecision(10);

	int N,D,A;
	cin>>N>>D>>A;
	vector<pair<int,int>> a(N);
	fore(a,&p) cin>>p.first>>p.second;
	sort(a.begin(),a.end());

	vector<ll> sums(N+1);
	int r=0;
	ll cur=0,res=0;
	rep(l,0,N) {
		while (r<N && a[l].first+2*D>=a[r].first) r++;
		cur-=sums[l];
		a[l].second=(int)max(0ll,a[l].second-cur);
		res+=(a[l].second+A-1)/A;
		sums[r]+=A*((a[l].second+A-1)/A);
		cur+=A*((a[l].second+A-1)/A);
	}
	cout<<res<<'\n';
}


Measured memory_bytes: 3328