akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int main()
{
  int  a, b, d, X, Y;
//  double  c;
//  long long  a, b, c, d, X, Y;
  int D, G;
  //char s[101][101]={};
  char sv[101]={};
  char ss[101]={};
//  char s_temp[101]={};
  char t[12]={};
//  char s[10000000000000000001]={};
  char s[2][100001]={};
  int len=0;
//  int N, M;
//  int A[1000000001]={};
  long long  A[101]={};
//  long int A[1001]={};
  long long  B[101]={};
  long long  C[101]={};
  int i,j,k;
  int flag=0;
  int tmp=0;
  int min=1000;
  int cnt=0;
  double ans=1000;
  int max=0;

  int  Cen_X=0;
  int  Cen_Y=0;
  long long  H=0;
  
  //  int ans=0;
  int str_len=0;
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  int ans_o[1001]={};
  double N[1001]={};
  int ans_e[100001]={};
//  scanf("%lld %lld", &a, &b);
  scanf("%d", &a);
  
//  for(i=0;i<cnt;i++){
//    a=a+(t[cnt-i-1]-'0') * ()(pow(10, i));
//  printf("%d\n",min);
//  }
      
  if(a==22)   printf("Christmas Eve Eve Eve\n");
  else if (a==23)   printf("Christmas Eve Eve\n");
  else if (a==24)   printf("Christmas Eve\n");
  else if (a==25)   printf("Christmas\n");

//  printf("%lld\n", a);
  
return 0;
}


Measured memory_bytes: 128
/* ---------- STL Libraries ---------- */

// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>


/* ---------- Namespace ---------- */

using namespace std;


/* ---------- Type Abbreviation ---------- */

template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

using ll = long long;
using PL = P<ll, ll>;
using PS = P<string, ll>;

using VI = V<int>;
using VVI = V<VI>;
using VL = V<ll>;
using VVL = V<VL>;
using VS = V<string>;
using VB = V<bool>;
using VVB = V<VB>;
using VPL = V<PL>;
using VPS = V<PS>;

#define fst first
#define snd second


/* ---------- conversion ---------- */

#define INT(c) static_cast<int>(c)
#define CHAR(n) static_cast<char>(n)
#define LL(n) static_cast<ll>(n)
#define DOUBLE(n) static_cast<double>(n)


/* ---------- container ---------- */

#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define GSORT(c) sort(ALL(c), greater<decltype((c).front())>())
#define SZ(x) (LL((x).size()))


/* ---------- repetition ---------- */

#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)

#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// Usual REP runs from 0 to n-1 (R: n to 0)
// Natural REP runs from 1 to n (R: n to 1)


/* ---------- Constants ---------- */

// const ll MOD = 1e9 + 7;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = 3.14159265358979;
// const ll dx[4] = {0, -1, 1, 0};
// const ll dy[4] = {-1, 0, 0, 1};
// const ll dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const ll dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};


/* ---------- Short Functions ---------- */

template <typename T>
T square(T a) {
    return a * a;
}


/* ---------- Debug ---------- */
#define GET_VAR_NAME(variable) #variable

#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;
#define testP(p) cout << GET_VAR_NAME(p) << " = (" << (p).fst << ", " << (p).snd << ")" << endl;


/* ^^^^^^^^^^^^^^^ Settting Part ^^^^^^^^^^^^^^^ */

/* ---------- Variances ---------- */


/* ---------- Functions ---------- */


/* ---------- Main Function ---------- */

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

    int N;
    cin >> N;

    VL a(3 * N);
    REP(i, 3 * N) {
        cin >> a[i];
    }

    GSORT(a);
    ll ans = 0;
    NREP(i, N) {
        ans += a[i * 2 - 1];
    }

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

Measured memory_bytes: 2560
import collections
n = int(input())
s = list()
for i in range(n):
    s.append(input())
m = int(input())
t = list()
for i in range(m):
    t.append(input())
st = set(s)
tt = set(t)
sc = collections.Counter(s)
tc = collections.Counter(t)
highest = -float("inf")
for i in st:
    x = sc[i] - tc[i]
    if x > highest:
        highest = x
if highest < 0:
    print(0)
else:

    print(highest)


Measured memory_bytes: 3316
a=input()
c=0
if a[0]=="A":
    for x in a[2:-1]:
        if (x == "C"):
            c += 1
    if c == 1:
        a= a.replace("C","")
        a= a.replace("A","")
        if a.islower():
            print("AC")
        else :
            print("WA")
    else :
        print("WA")
else :
    print ("WA")


Measured memory_bytes: 3060
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, K,W, H, Q, X, Y;
  ll ans;
  string S, T;
  cin >> D >> N;
  if (D==0) {
    if (N!=100) cout << N << endl;
    else cout << N+1 << endl;
  }
  else {
    if (N!= 100) cout << pow(100, D)*N << endl;
    else cout << (ll)(pow(100, D)*(N+1)) << endl;
  }
  

}


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

int main(){
  long a, b, c;
  cin >> a >> b >> c;
  if(a%2==0 || b%2==0 || c%2==0)cout << 0;
  else {
    cout << min({a, b, c})*(a+b+c-min({a, b, c})-max({a, b, c}));
  }
  return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
#define fi first
#define se second

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=acos(-1);
const ll MOD=1e9+7;
const ll INF=(1LL<<60);

int main() {
    int n;
    cin>>n;
    ll h[n+1];
    rep(i,n)cin>>h[i+1];
    map<ll,int> d;
    rep(i,n){
        if (h[i+1]>i+1)continue;
        else if (d.count(i+1-h[i+1]))d[i+1-h[i+1]]+=1;
        else d[i+1-h[i+1]]=1;
    }
    ll ans=0;
    for (int i=1;i<n+1;i++){
        ll num=i+h[i];
        if (d.count(num))ans+=d[num];
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 13080
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
  
   int n;
  double ans;
  scanf("%d",&n);
  
  if(n%2==0)
  {
    ans=(float)(n/2)/n;
    printf("%0.10lf",ans);
  }
  
  else
  {
    ans=(float)(n/2+1)/n;
     printf("%0.10lf",ans);
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
typedef long long ll;


int main(){
  int N;
  cin >> N;
  vector<ll> a(N);
  rep(i,N) cin >> a[i];
  int r = 0;
  ll res = 0;
  ll x = 0;
  ll sum = 0;
  for(int l = 0; l < N; l++) {
    while((x ^ a[r]) == (sum + a[r]) && r < N){
      x ^= a[r];
      sum += a[r];
      r++;
    }
    res += r - l;
    if(r == l)r++;
    x ^= a[l];
    sum -= a[l];
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 1792
package main

import (
	"fmt"
)

func main() {
    
	var (
		n int
		y int
		z int
	)
	z = 100

	fmt.Scan(&n)
	x := make([]int, n)
	for i := 0; i < n; i++ {
	    
		fmt.Scan(&x[i])
	    y = 0
    	for  {
    		if x[i]%2 == 1{break}
    		x[i] = x[i] / 2
    		y = y + 1}
    		
    			if y < z {
    				z = y
    			}
    		
    	}
	
	fmt.Println(z)
}


Measured memory_bytes: 1776
n, m = map(int, input().split())

city = []
for i in range(m):
    p, y = map(int, input().split())
    city.append([i + 1, p, y])
city = sorted(city, key=lambda x: [x[1], x[2]])

res = []
p, pp = 0, 0
cnt = 0
for i in range(m):
    idx, p, _ = city[i]
    if i == 0:
        cnt = 1
        pp = p
    elif pp == p:
        cnt += 1
    else:
        pp = p
        cnt = 1

    ID = str(p).rjust(6, '0') + str(cnt).rjust(6, '0')
    res.append([idx, ID])

res = sorted(res, key=lambda x: x[0])
for i in res:
    print(i[1])


Measured memory_bytes: 41748
#include <bits/stdc++.h>
#define range(i, l, r) for(int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint N;
    cin >> N;
    vec<lint> v_list(N);
    range(i, 0, N) cin >> v_list.at(i);
    sort(v_list.begin(), v_list.end());
    double value = (double)(v_list.at(0) + v_list.at(1)) / 2.;
    range(i, 2, N) {
        lint v = v_list.at(i);
        value = (value + v) / 2.;
    }
    cout << value << "\n";
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

#define chmax(a, b) (a) = max(a, b)
#define chmin(a, b) (a) = min(a, b)

int main() {
  int R, G, B, N;
  cin >> R >> G >> B >> N;

  int result = 0;
  irep(i, N) irep(j, N - i) {
    int M = N - R * i - G * j;
    if (M >= 0 && M % B == 0) {
      result++;
    }
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3552
def main():
    import sys
    import numpy as np
    ikimasu = sys.stdin.buffer.readline
    ini = lambda: int(ins())
    ina = lambda: list(map(int, ikimasu().split()))
    ins = lambda: ikimasu().strip()
    
    n,m,q = ina()
    tmp = [[0]*(n+1) for _ in range(n+1)]
    for _ in range(m):
        l,r = ina()
        tmp[l][r]+=1


    tmp = np.cumsum(tmp,axis=1).cumsum(axis = 0)

    for _ in range(q):
        p,q = ina()
        rick = tmp[q][q]+tmp[p-1][p-1]-tmp[p-1][q]-tmp[q][p-1]
        print(rick)
        


    
        


        


    




















if __name__ == "__main__":
    main()


Measured memory_bytes: 32824
//Name: Taxis
//Level: 3
//Category: グラフ,Graph,最短経路
//Note:

/*
 * 各頂点から、距離R_i以内の頂点を幅優先探索で求めて、辺を張り直す。
 * このグラフの上で最短経路を求める。
 *
 * オーダーは O(N^2 log N)。
 */
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

struct Tag {
    int c, r;
};

struct Edge {
    int to, c;
};

bool solve() {
    int N, K;
    if(!(cin >> N >> K)) return false;

    vector<vector<int>> org_g(N);
    vector<Tag> taxis(N);
    for(int i = 0; i < N; ++i) {
        cin >> taxis[i].c >> taxis[i].r;
    }
    for(int i = 0; i < K; ++i) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        org_g[a].push_back(b);
        org_g[b].push_back(a);
    }

    vector<vector<Edge>> g(N);
    for(int from = 0; from < N; ++from) {
        vector<int> q[2];
        vector<bool> visited(N, false);
        visited[from] = true;
        q[0].push_back(from);
        for(int i = 0; i < taxis[from].r; ++i) {
            q[1].clear();
            for(int v : q[0]) {
                for(int to : org_g[v]) {
                    if(!visited[to]) {
                        visited[to] = true;
                        q[1].push_back(to);
                        g[from].push_back(Edge{to, taxis[from].c});
                    }
                }
            }
            q[0].swap(q[1]);
        }
    }

    vector<int> memo(N, -1);
    priority_queue<pair<int,int>> q;
    q.push(make_pair(0, 0));
    memo[0] = 0;
    int ans = -1;
    while(!q.empty()) {
        const int cost = -q.top().first;
        const int v = q.top().second;
        q.pop();
        if(memo[v] < cost) continue;
        if(v == N-1) {
            ans = cost;
            break;
        }
        for(const Edge &e : g[v]) {
            const int nc = cost + e.c;
            if(memo[e.to] == -1 || memo[e.to] > nc) {
                memo[e.to] = nc;
                q.push(make_pair(-nc, e.to));
            }
        }
    }
    cout << ans << endl;
    return false;
}

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

    while(solve()) ;
    return 0;
}

Measured memory_bytes: 125896
while True:
    (a, op, b) = [int(i) if i.isdigit() else i for i in input().split()]

    if op == '?':
        break

    if op == '+':
        print(a + b)

    if op == '-':
        print(a - b)

    if op == '*':
        i = a * b
        print(a * b)

    if op == '/':
        print(a // b)

Measured memory_bytes: 6724
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>
#include <unordered_map>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
void SWAP(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void SWAP(int& a, int& b) { a ^= b; b ^= a; a ^= b; }


const int MOD{ 1000000007 };
vector<int64_t> factMemo{ 1,1 }, factInvMemo{ 1, 1 }, invMemo{ 0, 1 };
int curMax{ 1 };


void initTable(int n) {

	factMemo.resize(n + 1);
	factInvMemo.resize(n + 1);
	invMemo.resize(n + 1);

	for (; curMax < n;)
	{
		curMax++;
		factMemo[curMax] = factMemo[curMax - 1] * curMax % MOD;
		invMemo[curMax] = MOD - invMemo[MOD % curMax] * (MOD / curMax) % MOD;
		factInvMemo[curMax] = factInvMemo[curMax - 1] * invMemo[curMax] % MOD;
	}
}


// calculate mod of combination
int64_t comb(int n, int k) {
	if (n < k || n < 0 || k < 0)
		return 0;

	if (curMax < n)
		initTable(n);

	return factMemo[n] * (factInvMemo[k] * factInvMemo[n - k] % MOD) % MOD;
}


int64_t comb(int64_t n, int64_t k)
{
	return comb((int)n, (int)k);
}


class D {
	int n;
	unordered_map<int ,int> um;
	int left, right;

public:
	D()
	{
		cin >> n;
		REP(i, n + 1)
		{
			int tmp;
			cin >> tmp;

			auto it = um.find(tmp);
			if (it != um.end())
			{
				left = it->second;
				right = i;
				break;
			}
			else
			{
				um.insert(MP(tmp, i));
			}
		}
	}

	void solve()
	{

		REP1C(i, n + 1)
		{
			if (i == 1)
				cout << n << endl;

			else {
				ll ans = comb(n + 1, i) - comb(left + n - right, i - 1);

				if (ans < 0)
					ans += MOD;

				cout << ans << endl;
			}
		}

	}
};

int main()
{
	D solution;
	solution.solve();

	return 0;
}




Measured memory_bytes: 7716
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
#include <numeric>
using namespace std;


typedef long long       ll;
typedef struct edge_ { ll to; ll cost; } edge;
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef vector<edge>    ve;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<vi>		vvi;
typedef vector<ve>      vve;
typedef vector<vc>		vvc;

#define repr(itr, bgn, end) for (ll itr = (ll)bgn; itr < (ll)end; ++itr)
#define rep(itr, end) repr(itr, 0, end)
#define reprrev(itr, bgn, end) for (ll itr = (ll)end - 1; itr >= (ll)bgn; --i)
#define reprev(itr, end) reprrev(itr, 0, end)
#define all(container) container.begin(), container.end()
#define sortall(container) sort(all(container))
#define yn(cond) cond ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(cond) cond ? (cout << "YES" << endl) : (cout << "NO" << endl)

// 定数
#define LLONG_MAX numeric_limits<ll>::max()
#define INT_MAX numeric_limits<int>::max()
constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1 << 15;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;

// よく使うもの
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
	for (T& x : vec) os << x << " ";
	return os;
}

// pair出力
template<typename S, typename T>
ostream& operator << (ostream& os, pair<S, T>& p) {
	os << p.first << " " << p.second;
	return os;
}



int main()
{
	int N, M;
	cin >> N >> M;
	vi P(M), Y(M);
	vvi num(N + 1);

	for (int i = 0; i < M; i++) {
		cin >> P[i] >> Y[i];
		num[P[i]].push_back(Y[i]);

	}
	
	for (int i = 0; i < num.size(); i++)
		sortall(num[i]);

	for (int i = 0; i < M; i++) {
		printf("%06d", int(P[i]));
		printf("%06d\n", int(lower_bound(num[P[i]].begin(), num[P[i]].end(), Y[i]) - num[P[i]].begin()) + 1);
	}

	return 0;
}

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

using namespace std;

int main() {
#ifdef wxh010910
  freopen("input.txt", "r", stdin);
#endif
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    --a[i];
  }
  vector<int> ans;
  for (int i = 0; i < n; ++i) {
    int p = -1;
    for (int j = 0; j < n - i; ++j) {
      if (a[j] == j) {
        p = j;
      }
    }
    if (p == -1) {
      cout << -1 << "\n";
      return 0;
    }
    ans.push_back(p);
    a.erase(a.begin() + p);
  }
  reverse(ans.begin(), ans.end());
  for (int i = 0; i < n; ++i) {
    cout << ans[i] + 1 << "\n";
  }
  return 0;
}


Measured memory_bytes: 256
// Nurbakyt Madibek
// Look at my code! IT'S AWESOME

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cassert>
#include <unordered_map>
#include <bitset>
#include <unordered_set>

using namespace std;

#define pb push_back
#define pp pop_back
#define f first
#define s second
#define mp make_pair
#define sz(a) (int)((a).size())
#ifdef _WIN32
#  define I64 "%I64d"
#else
#  define I64 "%lld"
#endif
#define fname "."

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pi;
typedef pair < int, ull > pu;
typedef pair < ll, ll > pl;

const int inf = (int)1e9;
const ll infl = (ll)1e18 + 123;
const double eps = 1e-9;

const int MAX_N = (int)5e5 + 123;
const int mod = 998244353;

void add(int &a, const int &b) {
    a += b;
    if (a >= mod)
        a -= mod;
}

int binpow(int a, int b) {
    int res = 1;
    while(b) {
        if (b & 1)
            res = 1ll * res * a % mod;
        b >>= 1;
        a = 1ll * a * a % mod;
    }
    return res;
}

int p[MAX_N], q[MAX_N];

int CnK(int n, int k) {
    if (n < k)
        return 0;
    int res = p[n] * 1ll * q[k] % mod;
    res = 1ll * res * q[n - k] % mod;
    return res;
}

int f(int x, int y, int t) {
    // number of paths from (0, 0) to (x, y) going only up or right, and no y'-x' >= t
    if (t <= 0)
        return 0;
    int res = CnK(x + y, x);
    if (t <= y)
        res -= CnK(x + y, y - t);
    if (res < 0)
        res += mod;
    return res;
}

int calc(int r, int b, int n) {
    if (r == b) {
        return f(r, b - 1, b - n + 1);
    } else {
        return f(r, b, r - n + 1);
    }
}

int main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    p[0] = q[0] = 1;
    for (int i = 1; i <= (int)5e5; i++) {
        p[i] = 1ll * p[i - 1] * i % mod;
        q[i] = binpow(p[i], mod - 2);
    }
    
    int n, k;
    
    cin >> n >> k;
    int ans = 0;
    for (int b = 0; b <= k; b++) {
        int r = k - b;
        if (r < b)
            break;
        add(ans, calc(r, b, n));
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
using ll = long long;

const int maxn = 1e4+10;
const int INF = 1e9+10;

int dp[maxn];
int a[maxn],b[maxn];

void solve(){
	int h,n;
	cin >> h >> n;
	for(int i=0;i<n;++i){
		cin >> a[i] >> b[i];
	}
	for(int i=1;i<=h;++i){
		for(int j=0;j<n;++j){
			if(i-a[j] <= 0){
				dp[i] = min(dp[i],b[j]);
			}
			else{
				dp[i]= min(dp[i],dp[i-a[j]]+b[j]);
			}
		}
	}
	cout << dp[h] << '\n';
}

void init(){
	for(int i=1;i<maxn;++i){
		dp[i]=INF;
	}
}

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

Measured memory_bytes: 3684
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
unsigned XorShift(void){static unsigned x = 123456789;static unsigned y = 362436069;static unsigned z = 521288629;static unsigned w = 88675123;unsigned t;t = x ^ (x << 11);x = y; y = z; z = w;return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int a,b,c;

main(){
	char t;
	cin>>t;
	if(t=='A')dump('T');
	if(t=='T')dump('A');
	if(t=='C')dump('G');
	if(t=='G')dump('C');
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


int main() {
  string S,T;
  cin >> S >> T;
  
  if(T == S+"a"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"b"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"c"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"d"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"e"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"f"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"g"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"h"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"i"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"j"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"k"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"l"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"m"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"n"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"o"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"p"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"q"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"r"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"s"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"t"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"u"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"v"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"w"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"x"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"y"){
    cout << "Yes" <<endl;
  }
  
  else if(T == S+"z"){
    cout << "Yes" <<endl;
  }
  
  else{
    cout << "No" <<endl;
  }
    
}

Measured memory_bytes: 3596
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define int long long
#define double long long
using namespace std;
signed main() {
	int N;
	cin >> N;

	if (N % 111 == 0) {
		cout << N << endl;
	}
	else {
		cout << (N / 111 + 1)*111 << endl;
	}
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <stdlib.h>
long long cmp(const void *a,const void *b){                                                                               return *(long long*)a - *(long long*)b;
}
int main(void){
  long long n,m,i,j,ans=0,a[100005][2];;                                                                                  scanf("%lld%lld",&n,&m);
  for(i=0;i<n;i++) scanf("%lld %lld",&a[i][0],&a[i][1]);
  qsort(a,n,sizeof(a[0]),cmp);                                                                                            i = 0;
  while(1){
    if(m>a[i][1]){
      m-=a[i][1];
      ans += a[i][0]*a[i][1];
    }
    else{
      ans+=m*a[i][0];
      break;
    }
    i++;
  }
  printf("%lld",ans);
  return 0;
}           

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

int main() {
  int a[] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
  int A, B;
  cin >> A >> B;
  
  if (a[A] == a[B]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
n,c = map(int,input().split())
l = [[0]*(10**5+1) for _ in range(c+1)]
for _ in range(n):
    s,t,c = map(int,input().split())
    for i in range(s,t+1):
        l[c-1][i] = 1
ans = [0]*(10**5+1)
for i in range(len(l)):
    for j in range(len(l[i])):
        ans[j] += l[i][j]
print(max(ans))

Measured memory_bytes: 71128
#include <stdio.h>

// ルンルン数をスタックにpush
void lunlunPush(unsigned long long num, unsigned long long* stack)
{
    static int i = 0;
    // 桁が変わるごとにスタックをリセット
    if (num == 0) {
        i = 0;
        return;
    }
    stack[i] = num;
    i++;
    return;
}


// N桁の数のルンルン数をスタックに入れながら数え上げる
int lunlunCount(int N, int start, int end, unsigned long long num, unsigned long long *stack)
{
    if (N == 0) {
        lunlunPush(num, stack);
        // printf("%d ", num);
        return 1;
    }
    int S = 0;
    int E = 0;
    int total = 0;
    int i;
    for (i = start; i <= end; i++) {
        S = (i - 1) < 0 ? 0 : (i - 1);
        E = (i + 1) > 9 ? 9 : (i + 1);
        total += lunlunCount((N - 1), S, E, (num * 10) + i, stack);
    }
    return total;
}

int main(void)
{
    int K;
    int N, X;
    // 10^5番目のルンルン数は10桁、10桁のルンルン数は130900個
    unsigned long long lunlunStack[130900];

    // input
    scanf("%d", &K);

    // K番目のルンルン数 -> N桁の数のK'番目のルンルン数
    N = 1;
    X = 0;
    while (1) {
        X = lunlunCount(N, 1, 9, 0, lunlunStack);
        if (X >= K) {
            break;
        } else {
            // スタックの添字をリセット
            lunlunPush(0, lunlunStack);
            // printf("\n");
            K -= X;
            N++;
        }
    }
    // printf("%d桁のルンルン数は%d個\n", N, X);
    // printf("答えは%d桁のルンルン数の%d番目の数\n", N, K);

    // output
    // 添字は0から始まるのでスタックのK-1番目
    printf("%lld\n", lunlunStack[K-1]);

    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <vector>

using namespace std;

void b_triple_dots(void) {
	int k;
	string s;
	cin >> k >> s;

	if (s.size() <= k) {
		cout << s << endl;
		return;
	}

	cout << s.substr(0, k) << "..." << endl;
}

int main()
{
    b_triple_dots();

    return 0;
}

Measured memory_bytes: 3632
N,K=gets.chomp.split(" ").map(&:to_i)
h = []
(1..N).each do |i|
  h.push(gets.chomp.to_i)
end
h_sort = h.sort
min = Float::INFINITY
(0..(N-K)).each do |i|
  arr = h_sort[i..(i+K-1)]
  v = arr.last - arr.first
  min = v if v < min
end
print("#{min}\n")

Measured memory_bytes: 4216
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

int main(){
    ll N,K;
    cin>>N>>K;
    vector<ll> x(N),y(N);
    vector<char> c(N);
    ll tmp1,tmp2;
    char tmp3;
    REP(i,N){
        cin>>tmp1>>tmp2>>tmp3;
        x[i]=tmp1-2*K*(tmp1/(2*K));
        y[i]=tmp2-2*K*(tmp2/(2*K));
        c[i]=tmp3;
        
    }

    ll cnt=0;
    vector<vector<ll>> b(K+1,vector<ll>(K+1,0));
    vector<vector<ll>> w(K+1,vector<ll>(K+1,0));

    vector<vector<ll>> dp_b(K+1,vector<ll>(K+1,0));
    vector<vector<ll>> dp_w(K+1,vector<ll>(K+1,0));
    REP(i,N){
        tmp1=x[i];
        tmp2=y[i];
        tmp3=c[i];
        if(tmp3=='W'){
            if(pow(-1,tmp1/K+tmp2/K)==1){
                w[tmp1%K][tmp2%K]++;
            }else{
                b[tmp1%K][tmp2%K]++;
            }
        }else{
            if(pow(-1,tmp1/K+tmp2/K)==1){
                b[tmp1%K][tmp2%K]++;
            }else{
                w[tmp1%K][tmp2%K]++;
            }
        }
    }

    
    REP(i,K){
        REP(j,K){
            dp_b[i+1][j+1]=dp_b[i][j+1]+dp_b[i+1][j]-dp_b[i][j]+b[i][j];
            dp_w[i+1][j+1]=dp_w[i][j+1]+dp_w[i+1][j]-dp_w[i][j]+w[i][j];
        }
    }

    ll ans=0;
    REP(i,K){
        REP(j,K){
            tmp1=dp_b[K][K]-dp_b[i][K]-dp_b[K][j]+2*dp_b[i][j];
            tmp1+=dp_w[i][K]-dp_w[i][j];
            tmp1+=dp_w[K][j]-dp_w[i][j];
            ans=max(tmp1,ans);
            ans=max(N-tmp1,ans);
        }
    }
    cout<<ans<<endl;
}

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

using Pi = pair < int , int >;

int N, Q;
int S[200005], T[200005], X[200005];
vector < Pi > push[200005], pop[200005];
int D[200005];

int main()
{

	cin >> N >> Q;
	for ( int i = 0; i < N; i++ ) {
		cin >> S[i] >> T[i] >> X[i];
		S[i] -= X[i], T[i] -= X[i];
	}
	
	for ( int i = 0; i < Q; i++ ) {
		cin >> D[i];
	}
	
	for ( int i = 0; i < N; i++ ) {
		int ps = lower_bound(D, D + Q, S[i]) - D;
		int pt = lower_bound(D, D + Q, T[i]) - D;
		push[ps].push_back(Pi(X[i], i));
		pop[pt].push_back(Pi(X[i], i));
	}
	
	set < Pi > st;
	for ( int i = 0; i < Q; i++ ) {
		for ( auto &x : push[i] ) st.insert(x);
		for ( auto &x : pop[i] ) st.erase(x);
		if ( !st.empty() ) {
			cout << (st.begin())->first << endl;
		} else {
			cout << -1 << endl;
		}
	}

	return ( 0 );
}


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

int main(){
  string s;
  cin >> s;
  int L=s.size();
  int c=0;
  for(int i=0; i<L; i++){
    if(c==0){
      if(s.at(i)=='C'){
        c=1;
      }
    }
    else{
      if(s.at(i)=='F'){
        c=2;
        cout << "Yes" << endl;
        break;
      }
    }
  }
  if(c!=2){
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
//#define mod 998244353
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll INF=1e18;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    V<map<int,int>> a(n);
    V<string> s(n);
    cinf(n,s);
    map<int,int> mp;
    rep(i,n){
        int m=s[i].size();
        rep(j,m){
            a[i][s[i][j]-'a']++;
        }
    }
    rep(i,26) mp[i]=1000000;
    rep(i,26){
        rep(j,n) chmin(mp[i],a[j][i]);
    }
    string t;
    rep(i,26){
        int x=mp[i];
        while(x--){
            t+=i+'a';
        }
    }
    cout<<t;
}

Measured memory_bytes: 384
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    s = input()
    slen = len(s)
    cnt = [0] * 4
    mod = 1000*1000*1000+7
    cnt[0] = 1
    for i in range(slen):
        if s[i] == 'A':
            cnt[1] += cnt[0]
        elif s[i] == 'B':
            cnt[2] += cnt[1]
        elif s[i] == 'C':
            cnt[3] += cnt[2]
        else:
            cnt[0], cnt[1], cnt[2], cnt[3] =  3*cnt[0], 3*cnt[1] + cnt[0] , 3*cnt[2] + cnt[1], 3*cnt[3] + cnt[2]


        cnt[0]%= mod
        cnt[1]%= mod
        cnt[2]%= mod
        cnt[3]%= mod
    
    print(cnt[3])

solve()


Measured memory_bytes: 3188
#include "bits/stdc++.h"
using namespace std;
// #define int long long
#define pb push_back
#define fi first
#define se second
#define FF first
#define SS second
#define INF 2e18;
#define mp make_pair
#define ll long long
#define pii pair<int,int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define endl '\n'
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define sz(s) (int)s.size()
#define all(x) x.begin(), x.end()
typedef long double f80;

vector<int> v1, v2, v3, v4, v5;
const int mod = 1e9 + 7;

int get(int val) {
    int idx = upper_bound(all(v1), val) - v1.begin() - 1;
    if(idx == -1) return 0;
    if(idx == sz(v1) - 1) return v3.back();
    return (v3[idx] + (ll)(val - v1[idx]) * v2[idx + 1]) % mod;
}

signed main()
{
    //freopen("inp.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int n, k;
    cin >> n >> k;
    for(int l = 1; l <= n; l++) {
        int val = n / l;
        int r = n / val;
        v1.pb(r);
        v2.pb(1);
        v3.pb(r);
        l = r;
    }
    for(int kk = 2; kk <= k; kk++) {
        v4.clear();
        v5.clear();
        for(int l = 1; l <= n; l++) {
            int val = n / l;
            int r = n / val;
            int s = get(val);
            // cout << val << endl;
            v4.pb(s);
            v5.pb(((ll)s * (r - l + 1)) % mod);
            l = r;
        }
        int ss = 0;
        for(int &x : v5) {
            ss = (ss + x) % mod;
            x = ss;
        }
        v2 = v4;
        v3 = v5;
    }
    cout << v3.back();
    return 0;
}

Measured memory_bytes: 1696
import java.util.Scanner;

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

		// 整数の入力
		int n = sc.nextInt();

		if(n >= 30){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}

		sc.close();
	}
}

Measured memory_bytes: 35660
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		sc.close();
		System.out.println(n % 2 == 0 ? (n - 2) / 2 : (n - 1) / 2);
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
}


Measured memory_bytes: 23252
/*
 Author: LargeDumpling
 Email: LargeDumpling@qq.com
 Edit History:
	2017-09-16	File created.
*/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int MAXF=3050;
int A,B,C,D,E,F,fz=-1,fm;
bool su[MAXF],akvo[MAXF];
void update(int nz,int nm)
{
	if(fz<=0||fz*(nz+nm)<nz*(fz+fm))
	{
		fz=nz;
		fm=nm;
	}
	return;
}
int main()
{
	memset(su,0,sizeof(su));
	memset(akvo,0,sizeof(akvo));
	scanf("%d%d%d%d%d%d",&A,&B,&C,&D,&E,&F);
	su[0]=akvo[0]=1;
	for(int i=0;i<=F;i+=100)
	{
		if(100*A<=i) akvo[i]|=akvo[i-100*A];
		if(100*B<=i) akvo[i]|=akvo[i-100*B];
		//if(akvo[i])
			//fprintf(stderr,"%d ",i);
	}
	for(int i=0;i<=F;i++)
	{
		if(C<=i) su[i]|=su[i-C];
		if(D<=i) su[i]|=su[i-D];
		//if(su[i])
			//fprintf(stderr,"%d ",i);
	}
	for(int i=0,j;i<=F;i++)
		if(su[i])
			for(j=0;i+j*100<=F;j++)
				if(i<=E*j&&akvo[j*100])
					update(i,j);
	printf("%d %d",fz+fm*100,fz);
	fclose(stdin);
	fclose(stdout);
	return 0;
}


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

int N, M, Q;
vector<int> A, B, C, D;
int ans;

void dfs(vector<int> X) {
    if (sz(X) == N+1) {
        int temp = 0;
        rep(i, Q) {
            if (X[B[i]] - X[A[i]] == C[i]) temp += D[i];
        }
        ans = max(ans, temp);
        return;
    }
    X.push_back(X.back());
    while (X.back() <= M) {
        dfs(X);
        X.back()++;
    }
}

int main() {
    cin >> N >> M >> Q;
    A = B = C = D = vector<int> (Q);
    rep(i, Q) {
        cin >> A[i] >> B[i] >> C[i] >> D[i];
    }
    dfs(vector<int> (1, 1));
    cout << ans << '\n';
    return 0;
}

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

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

int main(){
    int n,k,ans=1,z=0;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        if(ans<k){
            ans=2*ans;
        }
        else{
            ans+=k;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int i=1, x;
	for(;;) {
		scanf("%d", &x);
		if (x == 0) {
			break;
		}
		else{
			printf("Case %d: %d\n", i, x);
			i++;

		}
		
	}

	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  int n,t,x,y;
  cin>>n>>t;
  int ans=-1;
  rep(i,0,n){
    cin>>x>>y;
    if(y<=t){
      if(ans==-1) ans=x;
      else ans=min(ans,x);
    }
  }
  if(ans==-1) cout<<"TLE\n";
  else cout<<ans<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3556
N, M, X = map(int, input().split())

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

ans = []

c = 0

for i in range(N):
  if i == X:
    ans.append(c)
    c = 0
    continue
  if i in A:
    c += 1
  if i == N-1:
    ans.append(c)
print(min(ans))

Measured memory_bytes: 3060
import sys


def solve(inp):
    N = int(inp.readline())
    D = sorted([int(inp.readline()) for i in range(N)])

    r = 0
    prev = 0
    for d in D:
        if d != prev:
            r += 1
            prev = d

    return str(r)


def main():
    result = solve(sys.stdin)
    if result:
        print(result)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;

public class Main {
    static int N = 100;
    static int INFTY = 1 << 21;
    static int n;
    static int[][] M = new int[N][N];
    static int[] d = new int[N];

    public static void bfs(int s) {
        Queue<Integer> q = new ArrayDeque<>();
        q.add(s);
        for(int i = 0; i < n; i++) d[i] = INFTY;
        d[s] = 0;
        int u;
        while(!q.isEmpty()) {
            u = q.poll();
            for(int v = 0; v < n; v++) {
                if(M[u][v] == 0) continue;
                if(d[v] != INFTY) continue;
                d[v] = d[u] + 1;
                q.add(v);
            }
        }
        for(int i = 0; i < n; i++) {
            System.out.println(i + 1 + " " + ((d[i] == INFTY) ? (-1) : d[i]));
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int u, k, v;
        n = sc.nextInt();
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) M[i][j] = 0;
        }
        for(int i = 0; i < n; i++) {
            u = sc.nextInt();
            k = sc.nextInt();
            u--;
            for(int j = 0; j < k; j++) {
                v = sc.nextInt();
                v--;
                M[u][v] = 1;
            }
        }
        bfs(0);
    }
}



Measured memory_bytes: 28760