akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
int main() {
	ll N, M;
	cin >> N >> M;
	ll k = (M - 1) / N + 1;
	while (1) {
		if (M % k == 0)break;
		k--;
	}
	printf("%lld\n", k);
	return 0;
}

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

#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define rep0(i,n) rep(i,0,n)
#define rep1(i,n) rep(i,1,n+1)
#define repR(i,s,n) for(ll i = (n-1); i >= (s); i--)
#define repR0(i,n) repR(i,0,n)
#define repR1(i,n) repR(i,1,n+1)

#define BR "\n"
#define SP " "

int main() {
  ll N, V;
  cin >> N >> V;
  vector<ll> A(N), B(N), C(N), D(N);

  rep0(i, N) cin >> A[i];
  rep0(i, N) cin >> B[i];
  rep0(i, N) cin >> C[i];
  rep0(i, N) cin >> D[i];

  vector<ll> AB(N * N), CD(N * N);
  rep0(i, N) {
    rep0(j, N) {
      AB[i * N + j] = A[i] + B[j];
      CD[i * N + j] = C[i] + D[j];
    }
  }
  sort(AB.begin(), AB.end());
  sort(CD.begin(), CD.end());

  ll ans = 0, r = N * N - 1;
  rep0(i, N * N) {

    while (r >= 0 && AB[i] + CD[r] >= V) {
      if (AB[i] + CD[r] == V) {
        ll ab = upper_bound(AB.begin(), AB.end(), AB[i])
                - lower_bound(AB.begin(), AB.end(), AB[i]);
        ll cd = upper_bound(CD.begin(), CD.end(), CD[r])
                - lower_bound(CD.begin(), CD.end(), CD[r]);

        ans += ab * cd;
        i += (ab - 1);
        r -= cd;
      } else if (r > 0) {
        r--;
      } else break;
    }
    if (r < 0) break;
  }

  cout << ans << BR;
  return 0;
}


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

int main() {
	int n;
	while (cin >> n) {
		int number = 1;
		rep(i, n) number += i + 1;
		cout << number << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3068
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, a[200005] = {}, b[200005] = {}, c[600005] = {}, d[600005] = {};
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    a[n] = a[0]; b[n] = b[0];
    for (int i = 0; i < n; i++) c[i] = b[i] ^ b[i + 1];
    c[n] = -1;
    for (int i = n + 1; i <= n + n; i++) c[i] = a[i - n - 1] ^ a[i - n];
    for (int i = n + n + 1; i <= n + n + n; i++) c[i] = c[i - n];
    for (int i = 1; i <= n + n + n + 1; i++) {
        int x = i - 1;
        while (x && d[x] != i - 1 && c[d[x]] != c[i - 1]) x = d[x];
        if (x) d[i] = d[x] + 1;
    }
    for (int i = n + n + 1; i <= n + n + n; i++) if (d[i] == n) cout << i - n - n - 1 << ' ' << (a[i - n - n - 1] ^ b[0]) << '\n';
}


Measured memory_bytes: 9924
#include<bits/stdc++.h>
#define ll long long int 
using namespace std;
double solve(double x ,double y)
{
	double r = 0;
	r+=sqrt(x*x + y*y);
	return r;
}
int main()
{
		ll n,d;
		ll count = 0;
		cin>>n>>d;
		for(ll i=0;i<n;i++)
		{
			ll x,y;
			cin>>x>>y;
			double q = solve(x,y);
			if(q<=d)count++;
		}
		cout<<count<<endl;
	
}

Measured memory_bytes: 3592
#include <stdio.h>

int gcd(int, int);

int main(void) {
  int a, b, n;

  while(scanf("%d %d", &a, &b) != EOF) {
    n = gcd(a, b);
    printf("%d %d\n", n, (a/n)*b);
  }

  return 0;
}

int gcd(int x, int y) {
  int tmp, r;

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

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

  return x;
}



Measured memory_bytes: 2032
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 30000000000000000LL
#define GOLD 1.61803398874989484820458
#define MOD 1000000007
#define MAX_MOD 998244353
#define REP(a,b) for(long long a = 0;a < b;++a)
long long powering(long long now,long long now_go) {
	long long ans = 1;
	while (now_go != 0) {
		if (now_go % 2 == 1) {
			ans *= now;
			ans %= MOD;
		}
		now *= now;
		now %= MOD;
		now_go /= 2;
	}
	return ans;
}
long long inv(long long now) {
	return powering(now, MOD - 2);
}
long long gogo[300000] = {};
long long gyaku[300000] = {};
int main() {
	long long n, a, b, c;
	cin >> n >> a >> b >> c;
	gogo[0] = 1;
	gyaku[0] = 1;
	for (long long q = 1; q < 300000; ++q) {
		gogo[q] = gogo[q - 1] * q;
		gogo[q] %= MOD;
		gyaku[q] = inv(gogo[q]);
	}
	long long geko = inv(a + b);
	a *= geko;
	b *= geko;
	a %= MOD;
	b %= MOD;
	long long ans = 0;
	for (long long q = n; q < 2 * n; ++q) {
		long long nya = gogo[q - 1] * gyaku[n - 1];
		nya %= MOD;
		nya *= gyaku[q - n];
		nya %= MOD;
		long long ta = powering(a, n) * powering(b, q - n);
		ta += powering(a, q - n) * powering(b, n);
		ta %= MOD;
		ta *= 100LL * q;
		ta %= MOD;
		ta *= inv(100 - c);
		ta %= MOD;
		ans += (ta * nya) % MOD;
		ans %= MOD;
	}
	cout << ans << endl;
}

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

int main() {
  char b,x;
  cin >> b;
  if (b == 'A') x = 'T';
  else if (b == 'T') x = 'A';
  else if (b == 'G') x = 'C';
  else x = 'G';
  cout << x << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.Map;
import java.util.HashMap;

public class Main {
    public static void main(String[] args) throws Exception {
        // Here your code !
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int X = sc.nextInt();
        int Y = sc.nextInt();
        int sum = 0;
        
        if(K<N){
            sum = X*K + Y*(N-K);
        }else{
            sum = X*N;
        }
        
        System.out.println(sum);
        
    }
}


Measured memory_bytes: 9684
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#define ll long long
using namespace std;
int main(){
	int N;
	cin >> N;
	int A,B;
	cin >> A >> B;
	int P[N];
	int AA=0,BB=0,CC=0;
	for(int i=0;i<N;i++){
		cin >> P[i];
		if(P[i]<=A){
			AA++;
		}else if(P[i]<=B){
			BB++;
		}else{
			CC++;
		}
	}
	int ans=0;
	while(1){
		if(AA>0&&BB>0&&CC>0){
			ans++;
			AA--;
			BB--;
			CC--;
		}
		if(AA==0||BB==0||CC==0){
			break;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(17) << res << endl;
 
#define M 1000000007

ll
mpow(ll x, ll n)
{
    ll ans = 1;
    while (n > 0){
        if (n & 1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}

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

    vector<ll> v(k+1, 0);

    ll sum = 0;
    for (ll i = k; i >= 2; --i) {
        ll p = k/i;
        v[i] = mpow(p, n);
        //cerr << i << "," << p << "," << v[i] << endl;
        for (ll j = i +i; j <= k; j = j + i) {
            //cerr << j << endl;
            v[i] -= v[j];
            v[i] = (v[i] + M)%M;
        }
        //cerr << i << "," << p << "," << v[i] << endl;
        sum += v[i];
        sum %= M;
    }
    v[1] = mpow(k, n) - sum;
    v[1] = (v[1] + M)%M;

    ll res = 0;
    for (ll i = 1; i <= k; ++i) {
        //cerr << i << ":" << v[i] << endl;
        res += i * v[i];
        res %= M;
    }

    cout << res << endl;
}


Measured memory_bytes: 4052
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main()
{
    int p[3]; cin>>p[0]>>p[1]>>p[2];
    sort(p, p+3);
    cout<<p[0]+p[1]<<endl;
    return 0;
}

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

using namespace std;

//#define int long long

using ll = long long;
using pii =  pair<int, int>;

const int IINF =  0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
const ll MOD = 1e9+7;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)

#define rep(i,n) for_(i,0,n)
#define rrep(i,n) rfor_(i,0,n)

#define pb push_back
//#define eb emplace_back
#define mp make_pair
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))

#define endl '\n'

const int limit = 100007;

char str[limit], result[limit];
int j;

bool ord(int i) {
        return i / 2 == i / 2.0;
}

int main(int argc, char const* argv[])
{
        cin >> str;
        j = 0;
        for (int i = 0; i < strlen(str); i++) {
                if (ord(i)) {
                        result[j] = str[i];
                        j++;
                }
        }

        cout << result << endl;
        return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 7;

#define lson (rt << 1)
#define rson (rt << 1 | 1)
int T[MAXN << 2];
void pushup(int rt) {T[rt] = max(T[lson], T[rson]);}
void update(int rt, int l, int r, int pos, int v){
    if (l == r) {T[rt] = v; return;}
    int mid = (l + r) >> 1;
    if (pos <= mid) update(lson, l, mid, pos, v);
    else update(rson, mid + 1, r, pos, v);
    pushup(rt);
}
int query(int rt, int l, int r, int L, int R){
    if (L <= l && r <= R) return T[rt];
    int mid = (l + r) >> 1, res = 0;
    if (L <= mid) res = max(res, query(lson, l, mid, L, R));
    if (mid <  R) res = max(res, query(rson, mid + 1, r, L, R));
    return res;
}

int N;
vector<int>vec;
vector<int>G[MAXN];
int a[MAXN], ans[MAXN];
void dfs(int u, int fa){
    assert(a[u] <= N);
    int backup = query(1, 1, N, a[u], a[u]);
    int now = query(1, 1, N, 1, a[u] - 1) + 1;
    update(1, 1, N, a[u], now);
    ans[u] = T[1];
    assert(now >= backup);
    for (int v : G[u]) if (v != fa) 
        dfs(v, u);
    update(1, 1, N, a[u], backup);
}

inline int getid(int x) {return lower_bound(vec.begin(), vec.end(), x) - vec.begin() + 2;}
int main(){
    int n; scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]), vec.push_back(a[i]);
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    for (int i = 1; i <= n; i++) a[i] = getid(a[i]);
    for (int i = 1, u, v; i < n; i++){
        scanf("%d%d", &u, &v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    N = vec.size() + 1;
    dfs(1, 0);
    for (int u = 1; u <= n; u++) printf("%d\n", ans[u]);
    for (int i = 1; i <= 4 * N; i++) assert(T[i] == 0);
    return 0;
}

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

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N);

    for(int i=0;i<N;i++){
        cin >> A[i];
        A[i]--;
    }
    for(int i=0;i<N;i++){
        cin >> B[i];
    }
    for(int i=0;i<N-1;i++){
        cin >> C[i];
    }

    int sum = 0;
    for(int i=0;i<N;i++){
        sum += B[A[i]];
        if(i != 0 && A[i-1]+1 == A[i]){
            sum += C[A[i-1]];
        }
    }

    cout << sum << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <stack>

using ll = long long;

int main() {
    int N;
    ll K;
    std::cin >> N >> K;
    std::vector<int> a(N), b(N);
    for (int i = 0; i < N; i++) {
        std::cin >> a[i] >> b[i];
    }

    std::map<ll, ll> arr;
    for (int i = 0; i < N; i++) {
        arr[a[i]] += b[i];
    }

    ll cnt = 0;
    for (auto& it : arr) {
        cnt += it.second;
        if (cnt >= K) {
            std::cout << it.first << std::endl;
            return 0;
        }
    }

}

Measured memory_bytes: 4992
import heapq

n,m=map(int,input().split())

A=list(map(int,input().split()))

A=[i*-1 for i in A]

heapq.heapify(A)

for i in range(m):
    x=heapq.heappop(A)
    if x%2==0:
        heapq.heappush(A,x//2)
    else:
        heapq.heappush(A,x//2+1)
print(-1*sum(A))

Measured memory_bytes: 14184
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	int x, y, z; cin >> x >> y >> z;
    cout << (x-z)/(y+z) << endl;
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
Llist = []
Rlist = []

for i in range(M):
    l, r = map(int, input().split())
    Llist.append(l)
    Rlist.append(r)

if min(Rlist)-max(Llist)+1 > 0:
    print(min(Rlist)-max(Llist)+1)
else:
    print(0)


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

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

int n, s;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> s >> n;
  vector<int> a(n);
  range(i, 0, n) {
    cin >> a[i];
  }
  vector<long long> pref(n);
  vector<long long> rev(n);
  range(i, 0, n) {
    pref[i] = a[i];
    if(i > 0) pref[i] += pref[i - 1];
  }
  husk(i, n - 1, -1) {
    rev[i] = s - a[i];
    if(i < n - 1) rev[i] += rev[i + 1];
  }
  auto get = [&](int p, int c, int z) {
    if(c == 0) return 0LL;
    if(!z) {
      return pref[p] - (c <= p ? pref[p - c] : 0);
    } else {
      return rev[p] - (p + c < n ? rev[p + c] : 0);
    }
  };
  long long res = 0;
  range(p, 0, n) {
    int x = min(p, n - p - 1);
    long long cur = max(a[p], s - a[p]);
    cur += get(p - 1, x, 0) * 2;
    cur += get(p + 1, x, 1) * 2;
    res = max(res, cur);
    cur = a[p];
    x = min(p, n - p - 2);
    if(x > -1) {
      cur += get(p + 1, x + 1, 1) * 2;
      cur += get(p - 1, x, 0) * 2;
    }
    res = max(res, cur);
    cur = s - a[p];
    x = min(p - 1, n - p - 1);
    if(x > -1) {
      cur += get(p - 1, x + 1, 0) * 2;
      cur += get(p + 1, x, 1) * 2;
    }
    res = max(res, cur);
  }
  cout << res;
  return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define MP make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int N = 1e5 + 5;

int n;
vector <pii> v;

multiset <int> s;

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++) {
        int x; cin >> x;
        v.push_back(MP(x, i));
    }
    s.insert(0), s.insert(0);
    s.insert(n + 1), s.insert(n + 1);
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    ll ans = 0;
    for(auto i : v) {
        int num = i.fi, p = i.se;
        auto it = s.lower_bound(p);
        int R1 = *it++;
        int R2 = *it--;
        --it;
        int L1 = *it--;
        int L2 = *it;
        if(L1) ans += 1ll * num * (L1 - L2) * (R1 - p);
        if(R1 <= n) ans += 1ll * num * (p - L1) * (R2 - R1);
        s.insert(p);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 5748
#include<bits/stdc++.h>
#define MAX 200010
#define inf 1<<29
#define linf 1e16
#define eps (1e-8)
#define mod 1000000007
#define pi acos(-1)
#define phi (1.0+sqrt(5))/2.0
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
typedef vector<int> vi;
typedef vector<pii> vpi;
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

int n,m;
int a[MAX];
bool used[MAX]={};
stack<int> s;

void solve(){
  RFOR(i,m,0){
    if(used[a[i]])continue;
    cout<<a[i]<<endl;
    used[a[i]]=true;
  }
  FOR(i,1,n+1)if(!used[i])cout<<i<<endl;
}

int main()
{
  cin>>n>>m;
  FOR(i,0,m)cin>>a[i];
  solve();
  return 0;
}

Measured memory_bytes: 3688
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <complex>
#include <bitset>
#include <functional>

using namespace std;
using ll=long long int;

int main() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;

    int m = 1;
    for (int i = 1; i < n; ++i) {
        if (s[i] != s[i-1]) ++m;
    }

    int d = max(1, m - 2*k);
    int ans = n-d;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
L = int(input())
N = L.bit_length()
res = []
for i in range(N - 1):
    res.append((i + 1, i + 2, 0))
    res.append((i + 1, i + 2, 2**i))
rem = L - 2**(N - 1) 
k = 2**(N - 1)
for i in range(rem.bit_length())[::-1]:
    if (rem >> i) & 1:
        res.append((i + 1, N, k))
        k += 2**i
print(N, len(res))
for r in res:
    print(*r)

Measured memory_bytes: 9212
#include<iostream>
#include<string>
#include<iomanip>
#define M 1000

using namespace std;
void swap(int *x, int *y) {
	int temp = *x;
	*x = *y;
	*y = temp;
}
int main(void) {
	int n, k;
	int p[M];
	int i,j;
	int x = 0;
	cin >> n; cin >> k;
	for (i = 0; i < n; i++) {
		cin >> p[i];
	}
	for (j = 0; j<n; j++) {
		for (i = n - 1; i>0; i--) {

			if (p[i - 1]>p[i]) {
				swap(&p[i], &p[i - 1]);
			}

		}
	}
	for (i = 0; i < k; i++) {
		x += p[i];
	}
	cout << x;

	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
ll dp[2005];
ll dfs(int t) {
    if (dp[t] != -1) return dp[t];
    if (t <= 2) {
        dp[t] = 0;
        return 0;
    }
    dp[t] = 0;
    for (int i = 3; i <= t; i++) {
        dp[t] += dfs(t - i);
        dp[t] = dp[t] % mod;
    }
    return dp[t];
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll s;
    cin >> s;
    memset(dp, -1, sizeof(dp));
    dp[0] = 1;
    cout << dfs(s) << endl;
}

Measured memory_bytes: 3664
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
//cout << std::fixed << std::setprecision(15) << y << endl;


ll gcd(ll a, ll b){
    return b != 0 ? gcd(b, a % b) : a;
}

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

int main(){
    ll A, B, C, D;
    cin >> A >> B >> C >> D;

    ll unDivA = 0;
    ll unDivB = 0;
    ll divByC, divByD, divByBoth;
    ll lcmCD = lcm(C, D);
    divByC = (A - 1) / C;
    divByD = (A - 1) / D;
    divByBoth = (A - 1) / lcmCD;
    unDivA = (A - 1) - (divByC + divByD - divByBoth);
    divByC = B / C;
    divByD = B / D;
    divByBoth = B / lcmCD;
    unDivB = B - (divByC + divByD - divByBoth);

    cout << unDivB - unDivA << endl;

    return 0;
}


Measured memory_bytes: 3588
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	A, B := getInt(), getInt()
	out(max(0, A-2*B))
}


Measured memory_bytes: 1772
#include<cstdio>
#include<cctype>
int main()
{
    char ch;
    while(1)
    {
        scanf("%c", &ch);
        if( isalpha(ch) )
        {
            if( islower(ch) ) printf("%c", toupper(ch));
            else printf("%c", tolower(ch));
        }
        else printf("%c", ch);
    if ( ch == '\n' )break;
    }
    return 0;
}

Measured memory_bytes: 944
function main(input) {
    const ALL = input.split('\n').map((n)=>parseInt(n, 10));

    var count = 0;

    for(var a=0;a<=ALL[0];a++){
        for(var b=0;b<=ALL[1];b++){
            for(var c=0;c<=ALL[2];c++){
                var sum = (a*500)+(b*100)+(c*50);
                if(sum===ALL[3])count++;
            }
        }
    }
    console.log(count);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
// AOJ 2723 Surface Area of Cubes
// 2018.2.7 bal4u
 
#include <stdio.h>
#include <string.h>

#define HSIZ 3011
typedef struct { int x, y, z; } HASH;
HASH hash[HSIZ+2], *hashend = hash+HSIZ;

int lookup(int x, int y, int z)
{
	long long h = ((long long)x << 32) + ((long long)y << 16) + z;
	HASH *p = hash + (int)(h % HSIZ);
	while (p->x) {
		if (p->x == x && p->y == y && p->z == z) return 1;
		if (++p == hashend) p = hash;
	}
	return 0;
}

void insert(int x, int y, int z)
{
	long long h = ((long long)x << 32) + ((long long)y << 16) + z;
	HASH *p = hash + (int)(h % HSIZ);
	while (p->x) {
		if (p->x == x && p->y == y && p->z == z) return;
		if (++p == hashend) p = hash;
	}
	p->x = x, p->y = y, p->z = z;
}

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

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	while (c < '0') c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int main()
{
	int a, b, c, n, x, y, z;
	int i, f, nx, ny, nz;
	long long ans;

	a = in(), b = in(), c = in(), n = in();
	ans = (long long)a*b + (long long)b*c + (long long)c*a;
	ans <<= 1;

	while (n--) {
		x = in(), y = in(), z = in();
	    f = 0;
		for (i = 0; i < 6; i++) {
			nx = x + dx[i], ny = y + dy[i], nz = z + dz[i];
			if (nx < 0 || nx >= a || ny < 0 || ny >= b ||
				nz < 0 || nz >= c || lookup(1+nx, ny, nz)) f--;
			else f++;
		}
		ans += f;
		insert(1+x, y, z);
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 2108
fun solve(N: Int) {
    println(N / 2 + N % 2)
}

fun main() {
//    val S = readLine()!!
    val N = readLine()!!.toInt()
//    val (N, M) = readLine()!!.split(" ").map { it.toInt() }
//    val A = readLine()!!.split(" ").map { it.toInt() }
    solve(N)
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

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

using namespace std;

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

const int all=(1<<16)-1;
int n,h[20],w[20];
int memo[1<<16];
char board[4][4];
char cur[10][10];

int rec(int mask){
	if(mask==all) return 0;
	int &ret=memo[mask];
	if(ret!=-1) return ret;

	ret=1010;
	
	rep(idx,n){
		rep(si,10)rep(sj,10){
			const int ti=si+h[idx],tj=sj+w[idx];
			if(ti<=3||7<=si) continue;
			if(tj<=3||7<=sj) continue;

			bool ok=true;
			char tar=-1;
            int nmask=mask;
            rep(a,h[idx])rep(b,w[idx]){
                const int ca=si+a,cb=sj+b;
                if(ca<3||7<=ca) continue;
                if(cb<3||7<=cb) continue;
                if(cur[ca][cb]=='*') continue;
 				if(tar==-1||tar==cur[ca][cb])
 					tar=cur[ca][cb];
 				else
 					ok=false; 
                nmask|=bit(4*(ca-3)+(cb-3));
            }

            if(ok&&nmask>mask){
            	if(memo[nmask]!=-1){
            		chmin(ret,rec(nmask)+1);
            	}else{
        			const int change=nmask^mask;
	            	rep(i,4)rep(j,4) if(change&bit(4*i+j)) cur[i+3][j+3]='*';
	            	chmin(ret,rec(nmask)+1);
	            	rep(i,4)rep(j,4) if(change&bit(4*i+j)) cur[i+3][j+3]=board[i][j];
            	}
            }
		}
		if(ret==1) break;
	}
	return ret;
}

int main(void){
	cin >> n;
	rep(i,n) cin >> h[i] >> w[i];

	rep(i,4) rep(j,4) cin >> board[i][j];
	rep(i,10)rep(j,10) cur[i][j]='*';
	rep(i,4)rep(j,4) cur[i+3][j+3]=board[i][j];
	clr(memo,-1);
	cout << rec(0) << endl;
	return 0;
}

Measured memory_bytes: 3380
<?php
  
while ($line = fgets(STDIN)) {
   $stdin[] = trim($line);
}
#$v2 = str_split($stdin[0]);
#$v2 = explode(" ", $stdin[0]);

#dream dreamer erase eraser

if($stdin[0] >= 3200){
  $ans = $stdin[1];
}else{
  $ans = 'red';
}

echo $ans . PHP_EOL;





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

ab = [tuple(map(int, input().split())) for _ in range(n)]
cd = [tuple(map(int, input().split())) for _ in range(n)]

ab.sort()
cd.sort()

# xが小さい順に組む
# cdの前から見ていく, 組めるもののうち、yが最大のものを組むと
# そのペアをcd[i], ab[j]とする。
# まず別のcd[k]を考える。
# x, y共にcdよりでかい場合、交換可能
# xのみでかい場合, yが足りなくて組めないことがある
# yのみでかい場合, x昇順に見てるので、cd[i][0]==cd[k][0], 交換可能
# 悪化しないのでおk
ans = 0
used = [False] * n
for i in range(n):
    max_idx = -1
    max_y = -1
    for j in range(n):
        if not used[j] and ab[j][0] < cd[i][0] and ab[j][1] < cd[i][1] and max_y < ab[j][1]:
            max_idx = j
            max_y = ab[j][1]
    if max_idx != -1:
        used[max_idx] = True
        ans += 1
print(ans)


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

#define rep(i,n) for(int i=0; i<n; i++)

int main(){
  long int n;
  cin >> n;
  long int sum=0;
  for (long int i=1;i<=n;i++){
    if(i%3!=0 && i%5!=0)sum+=i;
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <utility>

int main() {
  long long a, b;
  std::cin >> a >> b;
  if (a * b <= 0) {
    std::cout << "Zero" << std::endl;
  } else if (b < 0 and (b - a) % 2 == 0) {
    std::cout << "Negative" << std::endl;
  } else {
    std::cout << "Positive" << std::endl;
  }
  return 0;
}


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

vector<pair<long long,long long>> R;
vector<pair<long long,long long>> L;
vector<pair<long long,long long>> U;
vector<pair<long long,long long>> D;

bool R_emp,L_emp,U_emp,D_emp;

long long ans=999999999999999999LL;

bool comp_second(const pair<long long,long long>& a,const pair<long long,long long>& b){
	if(a.second!=b.second)return a.second<b.second;
	else return a.first<b.first;
}

int main(){
	int N;
	cin >> N;
	for(int i=0;i<N;i++){
		long long x,y;
		char d;
		cin >> x >> y >> d;
		x*=2;
		y*=2;
		pair<long long,long long> xy=make_pair(x,y);
		if(d=='R')R.push_back(xy);
		if(d=='L')L.push_back(xy);
		if(d=='U')U.push_back(xy);
		if(d=='D')D.push_back(xy);
	}
	
	bool R_emp=R.empty(),L_emp=L.empty(),U_emp=U.empty(),D_emp=D.empty();
	long long minx=999999999999999999LL,maxx=-999999999999999999LL,miny=999999999999999999LL,maxy=-999999999999999999LL;
	if(!R_emp){
		sort(R.begin(),R.end(),comp_second);
		miny=min(miny,R[0].second);
		maxy=max(maxy,R[R.size()-1].second);
	}
	if(!L_emp){
		sort(L.begin(),L.end(),comp_second);
		miny=min(miny,L[0].second);
		maxy=max(maxy,L[L.size()-1].second);
	}
	if(!U_emp){
		sort(U.begin(),U.end());
		minx=min(minx,U[0].first);
		maxx=max(maxx,U[U.size()-1].first);
	}
	if(!D_emp){
		sort(D.begin(),D.end());
		minx=min(minx,D[0].first);
		maxx=max(maxx,D[D.size()-1].first);
	}
	sort(R.begin(),R.end());
	sort(L.begin(),L.end());
	sort(U.begin(),U.end(),comp_second);
	sort(D.begin(),D.end(),comp_second);
	
	for(long long t=0;t<=200000000LL;t++){
		long long Xmax=maxx,Xmin=minx,Ymax=maxy,Ymin=miny;
		if(!R_emp){
			Xmax=max(Xmax,R[R.size()-1].first+t);
			Xmin=min(Xmin,R[0].first+t);
		}
		if(!L_emp){
			Xmax=max(Xmax,L[L.size()-1].first-t);
			Xmin=min(Xmin,L[0].first-t);
		}
		if(!U_emp){
			Ymax=max(Ymax,U[U.size()-1].second+t);
			Ymin=min(Ymin,U[0].second+t);
		}
		if(!D_emp){
			Ymax=max(Ymax,D[D.size()-1].second-t);
			Ymin=min(Ymin,D[0].second-t);
		}
		ans=min(ans,(Xmax-Xmin)*(Ymax-Ymin));
	}
	if(ans%4==0)cout << ans/4 << endl;
	if(ans%4==1)cout << ans/4 << ".25" << endl;
	if(ans%4==2)cout << ans/4 << ".5" << endl;
	if(ans%4==3)cout << ans/4 << ".75" << endl;
	return 0;
}

Measured memory_bytes: 2320
from math import sqrt, ceil

X = int(input())

temp = [True]*(10**5+4)
temp[0] = temp[1] = False
for i in range(2, ceil(sqrt(10**5+4))):
    if temp[i]:
        temp[i+i::i] = [False]*(len(temp[i+i::i]))
for j in range(X, 10**5+4):
    if temp[j] == True:
      print(j)
      exit()


Measured memory_bytes: 4588
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const string EMP = " ";
const ll INF = 1LL<<60;
const ll MOD = 1000000007;

int main(){
  int h,w,k; cin >> h >> w >> k;
  int x1,x2,y1,y2; cin >> x1 >> y1 >> x2 >> y2;
  x1--; x2--; y1--; y2--;
  vector<string> g(h);
  vector<vector<int>> dist(h,vector<int>(w,1<<30));
  dist[x1][y1] = 0;
  for(int i = 0; i < h; i++) cin >> g[i];

  int nx[4] = {-1,1,0,0}, ny[4] = {0,0,-1,1};
  queue<P> q;
  q.push(P(x1,y1));
  while(!q.empty()){
    P p = q.front(); q.pop();
    int xx = p.first, yy = p.second;
    for(int i = 0; i < 4; i++){
      int dx = xx, dy = yy;
      for(int j = 0; j < k; j++){
        dx += nx[i], dy += ny[i];
        if(0 > dx || dx >= h || 0 > dy || dy >= w) break;
        if(g[dx][dy] == '@' || dist[dx][dy] <= dist[xx][yy]) break;
        if(dist[dx][dy] > dist[xx][yy] + 1){
          dist[dx][dy] = dist[xx][yy] + 1;
          q.push(P(dx,dy));
        }
      }
    }
  }
  if(dist[x2][y2] == 1<<30) cout << -1 << endl;
  else cout << dist[x2][y2] << endl;
  return 0;
}


Measured memory_bytes: 11056
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<pair<string,int>>pairs(N);
  vector<pair<string,int>>pairs_(N);
  for (int i = 0; i < N; i++) {
    cin >> pairs[i].first >> pairs[i].second;
    pairs_[i].first = pairs[i].first;
    pairs[i].second = -1*pairs[i].second;
    pairs_[i].second = pairs[i].second;  
  }
  sort(pairs.begin(),pairs.end());
    
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
       if(pairs_[j] == pairs[i]){
          cout << j+1 << endl;
        }
      }
    } 
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		if(B%A == 0) {
			System.out.println(A + B);
		} else {
			System.out.println(B - A);
		}
	}
}


Measured memory_bytes: 22484
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;

 
int main() {

    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i,n)    cin >> a[i];

    rep(i,n) {
        if(i>k-1) {
            if(a[i]-a[i-k]>0) cout<<"Yes"<<endl;
            else    cout<<"No"<<endl;
        }
    }
    
    

 return 0;
}

Measured memory_bytes: 4832
from random import randrange, random
from bisect import bisect
from math import exp
from time import perf_counter as timer
def simulated_annealing(C, S, duration=1.8):
    
    D = len(S)
    K = len(C)

    helper = lambda i,j: (j-i-1)*(j-i)//2
    
    class State:
        def __init__(self,d2c,c2d):
            self.c2d = c2d
            self.d2c = d2c
            self.score = self._score()

        @classmethod
        def random(cls):
            d2c = [randrange(K) for _ in range(D)]
            c2d = [[-1] for _ in range(K)]
            for d,c in enumerate(d2c):
                c2d[c].append(d)
            for c in range(K):
                c2d[c].append(D)
            return State(d2c,c2d)

        def _score(self):
            s = 0
            for d,c in enumerate(self.d2c):
                s += S[d][c]

            for c,ds in enumerate(self.c2d):
                k = C[c]
                for a,b in zip(ds,ds[1:]):
                    s -= k*helper(a,b)
            return s

        def random_move(self):
            d = randrange(D)
            c = self.d2c[d]
            nc = randrange(K-1)
            if nc >= c:
                nc += 1

            delta = S[d][nc] - S[d][c]

            cd = self.c2d[c]
            i = bisect(cd,d)-1
            delta += C[c]*(helper(d,cd[i+1]) + helper(cd[i-1],d))
            delta -= C[c]*helper(cd[i-1],cd[i+1])

            cd = self.c2d[nc]
            i = bisect(cd,d)
            delta += C[nc]*helper(cd[i-1],cd[i])
            delta -= C[nc]*(helper(d,cd[i]) + helper(cd[i-1],d))

            return (d,nc),delta

        def make_move(self, move, delta):
            '''
            move = (d,nc)
            '''
            d,nc = move
            c = self.d2c[d]
            self.d2c[d] = nc

            i = bisect(self.c2d[c], d)-1
            self.c2d[c].pop(i)

            i = bisect(self.c2d[nc],d)
            self.c2d[nc].insert(i, d)
            self.score += delta

    ALPHA = 7000

    state = State.random()

    START = timer()
    deadline = START + duration
    now = START
    while now < deadline:
        temp = ALPHA*(deadline-now)/duration
        
        move, delta = state.random_move()
        if delta >= 0 or exp(delta/temp) > random():
            state.make_move(move, delta)
        now = timer()
    return (v+1 for v in state.d2c)

if __name__ == '__main__':
    D = int(input())
    C = tuple(map(int,input().split()))
    S = tuple(tuple(map(int,input().split())) for _ in range(D))
    print(*simulated_annealing(C,S), sep='\n')

Measured memory_bytes: 108856
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
    詰まった時に、別の分野の問題として考え直す（これdpでは？、グラフとしてみればいいのでは？）
    多くの問題はパターンマッチだが、パターンに落とし込むまでが難しく、そのための訓練としてわからない問題をあれこれ色々な角度から考察してみるのではないか
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */


const int MAX = 1000005;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++){
        fac[i] = fac[i-1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod/i) % mod;
        finv[i] = finv[i-1] * inv[i] % mod;
    }
}

long long COM(int n, int k){
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}


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

    COMinit();
    int n; cin >> n;
    vector<int> a(n+1, 0), cnt(n+1, 0);
    int twice;
    rep(i, n+1){
        cin >> a[i];
        ++cnt[a[i]];
        if(cnt[a[i]]==2) twice=a[i];
    }

    int left=-1, right;
    rep(i, n+1){
        if(a[i]==twice && left==-1) left=i;
        else if(a[i]==twice) right=i;
    }

    repr(k, 1, n+2){
        ll ans = COM(n+1, k) - COM(left+n-right, k-1);
        chmod(ans);
        cout << ans << endl;
    }


    return 0;
}


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

int main()
{
 	int n;
 	cin >> n;
 	map<string, int> m;
    while(n--)
    {
        string s;
        cin >> s;
        m[s]++;
    }
    cout << "AC x " << m["AC"] << "\n";
    cout << "WA x " << m["WA"] << "\n";
    cout << "TLE x " << m["TLE"] << "\n";
    cout << "RE x " << m["RE"] << "\n";
}


Measured memory_bytes: 3640
//https://atcoder.jp/contests/abc117/tasks/abc117_a
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int T, X;
    cin >> T >> X;
    cout <<  fixed << std::setprecision(10) << (T*60.0) / (X*60.0)  << endl;
    return 0;
}

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

int main()
{
    int k;
    string s;
    cin >> k >> s;
    if (s.size() <= k)
    {
        cout << s << endl;
        return 0;
    }
    for (int i = 0; i < k; i++)
    {
        cout << s.at(i);
    }
    cout << "..." << endl;
}


Measured memory_bytes: 3620
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
int main(){
  string s;cin>>s;
  int i;
  int count=0;
  int ans=0;
  for(i=0;i<s.length();i++){
    if(s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T'){
      count++;
    }
    else count=0;
    if(ans<count) ans=count;
  }

  cout<<ans<<endl;
}


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

using namespace std;

typedef long long ll;

const double pi = 3.14159265358979323846;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define CIN(v) cin >> v;
#define COUT(v) cout << v << "\n";

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string a = "abcdefghijklmnopqrstuvwxyz";
  char s;
  CIN(s);

  for (int i = 0; i < a.size(); i++) {
    if (s == a[i]) {
      COUT(a[i + 1]);
      return 0;
    }
  }

  return 0;
}


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

int main(){
  string S;
  cin >> S;
  int N = S.size();
  bool good = true;
  for(int i=0;i<N;i++){
    if(i%2==0&&S[i]=='L'||i%2==1&&S[i]=='R'){
      good = false;
    }
  }
  if(good){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import numpy as np

H,W = list(map(int, input().split()))

mat = np.zeros((H, W))
original_mat = []

removed_line = []
removed_column = []

for i in range(H):
    row = input()
    line = []
    for j, c in enumerate(row):
        if c == "#":
            mat[i, j] = 1

    # print(mat[i,:])
    if np.sum(mat[i,:]) == 0:
        removed_line.append(i)
    else:
        original_mat.append(row)

for i in range(W):
    # print(mat[:,i])
    if np.sum(mat[:,i]) == 0:
        removed_column.append(i)

# print(removed_line)
# print(removed_column)

for row in original_mat:
    for i, c in enumerate(row):
        if i not in removed_column:
            print(c, end="")
    print("\n", end="")


Measured memory_bytes: 13932
#include <cstdio>

int main(void)
{
    char x[1001];
    int sum;
    while(1)
    {
        scanf("%s", x);
        if(x[0]=='0') break;
        sum = 0;
        for(int i=0; x[i]!='\0'; i++)
            sum += x[i] - '0';
        printf("%d\n", sum);
    }

    return 0;
}


Measured memory_bytes: 2700
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k,q,a,lo1,lo2;
vector<ll>v,vv;
int main(void){
    ll f=1LL<<40;
    cin>>n>>k>>q;
    v.push_back(-f);
    vv.push_back(-f);
    for(int i=0;i<n;i++){
        cin>>a;
        v.push_back(a);
    }
    for(int i=0;i<k;i++){
        cin>>a;
        vv.push_back(a);
    }
    v.push_back(f);
    vv.push_back(f);
    while(q--){
        ll ans=1LL<<40;
        cin>>a;
        lo1=lower_bound(v.begin(),v.end(),a)-v.begin();
        lo2=lower_bound(vv.begin(),vv.end(),a)-vv.begin();
        for(ll x:{v[lo1-1],v[lo1]}){
            for(ll y:{vv[lo2-1],vv[lo2]}){
                ans=min(abs(a-x)+abs(x-y),ans);
                ans=min(abs(a-y)+abs(x-y),ans);
            }
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;



int main() {
    int N,Q;
    cin>>N>>Q;
    string S;
    cin>>S;
    vector<int> AC(N);
    int now=0;
    rep(i,N-1){
        if(S.at(i)=='A' && S.at(i+1)=='C'){
            now++;
        }
        AC.at(i+1)=now;
    }
    rep(query,Q){
        int l,r;
        cin>>l>>r;
        --l;--r;
        cout<<AC.at(r)-AC.at(l)<<endl;
    }
}

Measured memory_bytes: 3860
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int a;
  string v;
  a=0;
  cin>>v;
  if(v[0] == '1')
    a++;
  if(v[1] == '1')
    a++;
  if(v[2] == '1')
    a++;
  cout<<a<<endl;
  

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os, const map<T,U>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int,int>;
using vi = std::vector<int>;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    string s,t; cin >> s >> t;
    int m = s.size();
    int n = t.size();
    debug2(m,n);
    string ss = s + s;
    vvi nxt(2*m+1,vi(30,0));
    rep(i,30) nxt[2*m][i] = INF;
    rrep(i,2*m){
        nxt[i] = nxt[i+1];
        nxt[i][ss[i]-'a'] = i;
    }

    /* cout << "  "; */
    /* rep(j,26){ */
    /*     cout << (char)(j+'a') << " "; */
    /* } */
    /* cout << endl; */
    /* rep(i,2*m+1){ */
    /*     cout << i << " "; */
    /*     rep(j,26){ */
    /*         if(nxt[i][j]==INF) cout << "X" << " "; */
    /*         else cout << nxt[i][j] << " "; */
    /*     } */
    /*     cout << endl; */
    /* } */

    int now = 0;
    ll ans = 0;
    rep(i,n){
        int c = t[i] - 'a';
        if(nxt[now][c]==INF){
            cout << -1 << endl;
            return 0;
        }
        ans += nxt[now][c]+1-now;
        now = nxt[now][c]+1;
        now %= m;
    }
    cout << ans << endl;
}


Measured memory_bytes: 33360
package main

import (
	"fmt"
)

func main() {
	var s, t string
	fmt.Scan(&s)
	fmt.Scan(&t)
	var count int
	count = 0
	for i, _ := range s {
		if s[i] != t[i] {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 4492
#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define pa pair<int,int>
const int N=1e6+10; 
const int mod=998244353;
using namespace std;

int a[N];
int main()
{
	int n; cin>>n;
	for(int i=1;i<=n;++i) cin>>a[i];
	int ans=0;
	for(int i=2;i<=n;++i) ans=__gcd(ans,a[i]);
	vector<int> v;
	for(int i=1;i*i<=a[1];++i) if(a[1]%i==0)
	{
		v.pb(i);
		if(i*i!=a[1]) v.pb(a[1]/i);
	}
	sort(v.begin(),v.end());
	for(int i=v.size()-1;i>=0;--i)
	{
		int ff=0;
		for(int j=2;j<=n&&ff<=1;++j) if(a[j]%v[i]) {ff++; }
		if(ff<=1) {ans=max(ans,v[i]); break;}
	}
	printf("%d\n",ans);
return 0;
}
/*
*/

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
#define vv(a,b) vector< vector<int> > v(a,vector<int>(b,0));
using namespace std;
typedef long long ll;
const double PI=acos(-1);
typedef pair<int,int>P;
const int mod =1e9+7;

int main()
{
    int n;
    cin>>n;
    vector<int> c(n);
    vector<int> s(n);
    vector<int> f(n);
    rep(i,n-1)
    {
        cin>>c[i+1]>>s[i+1]>>f[i+1];
    }
    for(int i=1;i<=n-1;i++)
    {
        int now=0;

        now+=s[i];
        now+=c[i];
        if(i==n-1)
        {
            cout<<now<<endl;
            break;
        }
        for(int j=i+1;j<=n-1;j++)
        {
            if(now<=s[j])
            {
                now=s[j];
            }
            else
            {
                int modd=(now-s[j])%f[j];
                now+=modd==0?0:f[j]-modd;
            }
            now+=c[j];
            
        }
        cout<<now<<endl;
    }
    cout<<0<<endl;
}


Measured memory_bytes: 256