akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

const int INF = numeric_limits<int>::max();
const int MAXN = 3e5 + 1;
const int MOD = 1e9 + 7;
const double res = 1e-9;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
#if(DEBUG_LEVEL > 0)
    freopen("../input.txt", "r", stdin);
    freopen("../out.txt", "w", stdout);
#endif
    int a, b;
    cin >> a >> b;
    if(a < b) {
        cout << 0;
    }
    else {
        cout << 10;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int c[][] = new int[3][3];

		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				c[i][j] = sc.nextInt();
			}
		}

		int a[] = new int[3];
		int b[] = new int[3];

		boolean ans = false;

		for (int n = 0; n <= c[0][0]; n++) {
			a[0] = n;
			b[0] = c[0][0] - a[0];
			b[1] = c[0][1] - a[0];
			b[2] = c[0][2] - a[0];

			a[1] = c[1][0] - b[0];
			a[2] = c[2][0] - b[0];

			loop: for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if(c[i][j] == a[i] + b[j]) {
						ans = true;
					} else {
						ans = false;
						break loop;
					}
				}
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23508
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N, S=0;
  cin >> N;
  vector<int> d(N);
  REP(i,N) cin >> d[i];
  REP(i,N) {
    int j=i+1;
    while(j<=N-1) {
      S+=d[i]*d[j];
      j++;
    }
  }
  cout << S << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/3/2
Update on 2019/3/5
Solved on 2019/3/
@author: shinjisu
"""


# Educational Dynamic Programming
# import math
import numpy as np


def getInt(): return int(input())


# def getIntList(): return [int(x) for x in input().split()]
def getIntList(): return np.array(input().split(), dtype=np.longlong)


# def zeros(n): return [0]*n
def zeros(n): return np.zeros(n, dtype=np.longlong)


def getIntLines(n): return [int(input()) for i in range(n)]


def getIntMat(n):
    mat = []
    for i in range(n):
        mat.append(getIntList())
    return mat


def zeros2(n, m): return [zeros(m)]*n


ALPHABET = [chr(i+ord('a')) for i in range(26)]
DIGIT = [chr(i+ord('0')) for i in range(10)]
N1097 = 10**9 + 7
INF = 10**18


def dmp(x, cmt=''):
    global debug
    if debug:
        if cmt != '':
            print(cmt, ':  ', end='')
        print(x)
    return x


def prob_A():  # Frog 1
    N = getInt()
    H = getIntList()
    dmp((N, H), 'N, H')
    c = zeros(N)
    c[1] = abs(H[1]-H[0])
    for i in range(2, N):
        c[i] = min(c[i-1] + abs(H[i]-H[i-1]),
                   c[i-2] + abs(H[i]-H[i-2]))
    dmp(c, 'c')
    return c[N-1]


def prob_B_TLE():  # Frog 2 3/16 TLE
    N, K = getIntList()
    H = getIntList()
    dmp((N, K, H), 'N, K, H')
    c = np.zeros(N)
    c[0] = 0
    for i in range(1, N):
        #c[i] = INF
        for j in range(max(0, i-K), i):
            c[i] = min(c[i], c[j] + abs(H[i]-H[j]))
    dmp(c, 'c')
    return c[N-1]


def prob_B():  # Frog 2
    N, K = getIntList()
    H = np.array(input().split(), dtype='int')
    dmp((N, K, H), 'N, K, H')
    c = np.zeros(N, dtype=np.longlong)
    c[0] = 0
    for i in range(1, N):
        c[i] = np.min(c[max(0, i-K):i] + np.abs(H[max(0, i-K):i] - H[i]))
    dmp(c, 'c')
    return c[N-1]


def prob_C():  # Vacation
    N = getInt()
    a = zeros(N)
    b = zeros(N)
    c = zeros(N)
    for i in range(N):
        a[i], b[i], c[i] = getIntList()
    dmp(N, 'N')
    dmp(a, 'a')
    dmp(b, 'b')
    dmp(c, 'c')
    dpa = zeros(N)
    dpb = zeros(N)
    dpc = zeros(N)
    dpa[0] = a[0]
    dpb[0] = b[0]
    dpc[0] = c[0]
    for i in range(1, N):
        dpa[i] += max(dpb[i-1], dpc[i-1]) + a[i]
        dpb[i] += max(dpc[i-1], dpa[i-1]) + b[i]
        dpc[i] += max(dpa[i-1], dpb[i-1]) + c[i]
    dmp(dpa, 'dpa')
    dmp(dpb, 'dpb')
    dmp(dpc, 'dpc')
    return max(dpa[N-1], dpb[N-1], dpc[N-1])


def prob_D():  # Knapsack 1
    N, W = getIntList()
    w, v = zeros(N), zeros(N)
    dmp((N, W))
    for i in range(N):
        w[i], v[i] = getIntList()
    dmp(w, 'weight')
    dmp(v, 'value')
    dp = zeros(W+1)
    dmp(dp.size)
    for i in range(N):
        dmp(dp, 'dp')
        dmp(w[i],'w[i]')
        #prevIdx = max(0, i-w[i])
        #dmp(prevIdx,'prevIdx')
        dmp(w[i],'w[i]')
        dp[w[i]:] = np.maximum(dp[w[i]:], 
                                  dp[:W-w[i]+1] + v[i])
    dmp(dp, 'dp')
    return dp[W]


debug = False  # True False
ans = prob_D()
print(ans)
#for row in ans:
#    print(row)



Measured memory_bytes: 16884
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

void solve(const vector<int>& A, const vector<int>& B, vector<int>& mask, int bit) {
  int n = A.size() - 1, m = B.size();
  vector<int> f(m);
  f[0] = 0;
  int k = 0;
  for (int i = 1; i < m; ++i) {
    for (; k > 0 && B[k] != B[i]; k = f[k - 1]);
    if (B[k] == B[i]) k++;
    f[i] = k;
  }
  k = 0;
  for (int i = 0; i < n; ++i) {
    for (; k > 0 && B[k] != A[i]; k = f[k - 1]);
    if (B[k] == A[i]) k++;
    if (k == m) {
      mask[i - m + 1] |= bit;
      k = f[k - 1];
    }
  }
}

int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &b[i]);
  }
  vector<int> A(2 * n), B(n), mask(n);
  for (int k = 0; k < 30; ++k) {
    for (int i = 0; i < n; ++i) {
      A[i + n] = A[i] = (a[i] >> k) & 1;
    }
    for (int i = 0; i < n; ++i) B[i] = (b[i] >> k) & 1;
    solve(A, B, mask, 1 << k);
    for (int i = 0; i < n * 2; ++i) A[i] = 1 - A[i];
    solve(A, B, mask, 1 << k);
  }
  for (int i = 0; i < n; ++i) {
    if (mask[i] != (1 << 30) - 1) continue;
    printf("%d %d\n", i, a[i] ^ b[0]);
  }
  return 0;
}


Measured memory_bytes: 8944
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll h, w, a, b;
  in2(h, w);
  a = 0;
  vector<vector<char>> c(h + 2, vector<char> (w + 2, '#'));
  vector<vector<ll>> d(h + 2, vector<ll> (w + 2, 9999999999));
  rep(i, h){
    rep(j, w){
      in(c[i + 1][j + 1]);
      if(c[i + 1][j + 1] == '.')
        a++;
    }
  }
  d[1][1] = 1;
  rep(k, 5000){
    rep2(i, 1, h + 1){
      rep2(j, 1, w + 1){
        if(c[i][j] == '.'){
          if(c[i - 1][j] == '.')
            d[i][j] = min(d[i][j], d[i - 1][j] + 1);
          if(c[i + 1][j] == '.')
            d[i][j] = min(d[i][j], d[i + 1][j] + 1);
          if(c[i][j - 1] == '.')
            d[i][j] = min(d[i][j], d[i][j - 1] + 1);
          if(c[i][j + 1] == '.')
            d[i][j] = min(d[i][j], d[i][j + 1] + 1);
        }
      }
    }
  }
  b = max(-1ll, a - d[h][w]);
  out(b);
  memi;
}

Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <string>
#include <iostream>
#include <climits>
using namespace std;
using ll = long long;

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

const ll INF = LLONG_MAX*0.9;
typedef pair<ll,ll> pii;
ll N;
vector<pii> v;

int main(){
    ll mi = INF, ma = -INF;
    ll rMax = -INF, bMin = INF;
    cin >> N;
    v.resize(N);
    rep(i,N){
        cin >> v[i].first >> v[i].second;
        if(v[i].first > v[i].second) swap(v[i].first,v[i].second);
        mi = min(mi,v[i].first);
        ma = max(ma,v[i].second);
        rMax = max(rMax,v[i].first);
        bMin = min(bMin,v[i].second);

    }
    ll ans = (rMax - mi)* (ma-bMin);

    ll rMin = INF;
    sort(v.begin(),v.end());
    rep(i,N-1){
		rMax = max(rMax, v[i].second);
		rMin = min(rMin, v[i].second);
		ans = min(ans, (rMax - min(rMin, v[i + 1].first))*(ma - mi));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back(a)
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;

void solve() {
	int A, B; cin >> A >> B;
	print(max((ll)0, A - 2 * B));
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}


Measured memory_bytes: 256
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

n = ni()

word = []
words = []
for _ in range(n):
    words.append(lc())
    
ok = True
for i in range(n-1):
    if words[i][-1] != words[i+1][0]:
        ok = False
        
for i in range(n):
    for j in range(i+1,n):
        if words[i] == words[j]:
            ok = False

if ok:
    print("Yes")
else:
    print("No")

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

using namespace std;

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

void show_vec(vector<ll>);

int N;
vector<ll> A, B, C;

void solve(){
    ll sum = 0;

    for(auto &b: B){
        auto itr_a = lower_bound(A.begin(), A.end(), b);
        ll a = itr_a - A.begin();
       
        auto itr_c = upper_bound(C.begin(), C.end(), b);
        ll c = C.end() - itr_c;
       //cout << "a: " << a << ", c: " << c << endl;
        sum += a * c;
    }
    cout << sum << endl;
}


int main(){
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        ll a; cin >> a; A.push_back(a);
    }
    for (int i = 0; i < N; i++)
    {
        ll a; cin >> a; B.push_back(a);
    }
    for (int i = 0; i < N; i++)
    {
        ll a; cin >> a; C.push_back(a);
    }
    sort(A.begin(), A.end());
    //sort(B.begin(), B.end());
    sort(C.begin(), C.end());
    solve();


    return 0;

}
void show_vec(vector<ll> v){
    cout << "[";
    for (int i = 0; i < (int)v.size(); i++)
    {
        cout << v[i] << ",";
    }
    cout << "]" << endl;
}

Measured memory_bytes: 3316
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N;
int A[100010];
int B[100010];
int C[100010];

ll Bcnt[100010];
ll Acnt[100010];

int main () {
  cin >> N;
  for (auto i = 0; i < N; ++i) {
    cin >> A[i];    
  }
  for (auto i = 0; i < N; ++i) {
    cin >> B[i];    
  }
  for (auto i = 0; i < N; ++i) {
    cin >> C[i];    
  }
  sort(A, A+N);
  sort(B, B+N);
  sort(C, C+N);
  int Bind = 0;
  int Cind = 0;
  while (Bind < N && Cind < N) {
    if (B[Bind] >= C[Cind]) ++Cind;
    else {
      Bcnt[Bind++] = N - Cind;
    }
  }
  while (Bind < N) {
    Bcnt[Bind++] = 0;
  }
  Bcnt[N] = 0;
  for (auto i = N; i >= 1; --i) {
    Bcnt[i-1] += Bcnt[i];
  }
  int Aind = 0;
  Bind = 0;
  while (Aind < N && Bind < N) {
    if (A[Aind] >= B[Bind]) ++Bind;
    else {
      Acnt[Aind++] = Bcnt[Bind];
    }
  }
  while (Aind < N) {
    Acnt[Aind++] = 0;
  }
  ll sum = 0;
  for (auto i = 0; i < N; ++i) {
    sum += Acnt[i];
  }
  cout << sum << endl;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i += 2) {
        cout << s[i];
    }
    cout << "\n";
}

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

using namespace std;

const int N = 25;

int n, m;
char mat[N][N];
int dx[] = {1,-1, 0, 0};
int dy[] = {0, 0,-1, 1};

int dist[N][N];

int bfs(int x, int y) {
	memset(dist, -1, sizeof dist);
	int ans = 0;
	dist[x][y] = 0;
	queue<pair<int, int>> q;
	q.emplace(x, y);
	while(!q.empty()) {
		tie(x, y) = q.front(); q.pop();
		ans = max(ans, dist[x][y]);
		for(int i = 0; i < 4; i++) {
			int xx = x + dx[i];
			int yy = y + dy[i];
			if(xx < 0 or xx >= n) continue;
			if(yy < 0 or yy >= m) continue;
			if(mat[xx][yy] == '#') continue;
			if(dist[xx][yy] != -1) continue;
			dist[xx][yy] = dist[x][y] + 1;
			q.emplace(xx, yy);
		}
	}
	return ans;
}

int main() {
	scanf("%d %d", &n, &m);

	for(int i = 0; i < n; i++) scanf(" %s", mat[i]);

	int ans = 0;
	for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) if(mat[i][j] == '.')
		ans = max(ans, bfs(i, j));
	printf("%d\n", ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    V<int> a(n);
    V<int> cnta(300001, 0);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        cnta[a[i]]++;
    }
    
    V<int> aaa;
    for (int i = 1; i < 300001; i++) {
        if (cnta[i] == 0) continue;;
        aaa.emplace_back(cnta[i]);
    }
    sort(ALL(aaa));

    // f[i]: i 個の列を取り出す時に出せる最大長
    V<int> f(n + 2, 0);
    int rem = n;
    int over = 0;
    for (int i = n; i >= 1; i--) {
        while (!aaa.empty() && aaa.back() > i) {
            over++;
            rem -= aaa.back();
            aaa.pop_back();
        }
        f[i] = (rem + over * i) / i;
    }
    // DEBUG_VLL(f)

    for (int k = 1; k <= n; k++) {
        int low = 1, high = n + 1;
        while (low < high) {
            int mid = (low + high) >> 1;
            if (k <= f[mid]) low = mid + 1;
            else high = mid;
        }
        cout << low - 1 << '\n';
    }
    return 0;
}


Measured memory_bytes: 7644
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;


string moji;


int main(){

    cin >>moji;
    int isize = moji.size();

    if(moji[isize -1 ] == 's')
    {
        cout << moji + "es";
    }else
    {
        cout << moji + 's';
    }

    return  0;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define fi(i,a,b) for(int i=a; i<=b; i-=-1)
#define fid(i,a,b) for(int i=a; i>=b; i--)
#define ll long long
#define F first
#define S second
#define VanLoi "a"
#define maxn 100005
#define pii pair<int, int>
#define MOD 1000000007
#define B 107
#define gb(i,j) ((i >> j) & 1)
#define pb push_back
#define reset(x) memset(x, 0, sizeof(x))
#define Block 400
//#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

int n, k, a[maxn], l[maxn];

int get(int x) {
    if (x < a[1]) return 0;
    if (l[x] != -1) return l[x];
    int tg = 0;
    fi(i, 1, n) if (x >= a[i]) tg = max(tg, 1 - get(x - a[i]));
    return (l[x] = tg);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL); cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen(VanLoi".inp","r",stdin);
    freopen(VanLoi".out","w",stdout);
    #endif // ONLINE_JUDGE
    cin >> n >> k;
    fi(i, 1, n) cin >> a[i];
    fi(i, 1, k) l[i] = -1;
    if (get(k) == 1) cout << "First"; else cout << "Second";
}


Measured memory_bytes: 8704
using namespace std;
typedef long long ll;
#include <string>
#include <vector>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <map>

int main(){
	int N;
	cin >> N;
	vector<ll> ans;
	while (N!=0)
	{
		vector<ll> a;
		a.resize(N);
		for (int i = 0; i < N; i++) cin >> a[i];
		ll thismin = 1e10;
		for (int i = 0; i < N;i++) {
			for (int n = 0; n < N; n++) {
				if (n == i) continue;
				thismin = min(thismin, abs(a[i] - a[n]));
			}
		}
		ans.push_back(thismin);
		cin >> N;
	}
	for (int i = 0; i < ans.size();i++) {
		cout << ans[i] << endl;
	}
	return 0;
}

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

using namespace std;

int main() {

	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	int a, x;
	cin >> x >> a;
	if (x < a) {
		cout << "0" << '\n';
	}
	else {
		cout << "10" << '\n';
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define REPD(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) REPD(i, 0, n)
typedef long long ll;
#define fin(ans) cout << (ans) << '\n'

int main()
{
    int A,B;
    cin >> A >> B;
    if(A < 6){
        fin(0);
    }else if(A < 13){
        fin(B/2);
    }else{
        fin(B);
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int T, k, n, a, b, c, d;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
int main()
{
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	T = read();
	while(T -- > 0)
	{
		a = read(); b = read(); c = read(); d = read(); n = a + b;
		int l = 0, r = n + 1, mid, A, B;
		k = (max(a, b) - 1) / (min(a, b) + 1) + 1;
		while(l < r)
		{
			mid = (l + r) >> 1;
			A = a - mid / (k + 1) * k - mid % (k + 1); B = b - mid / (k + 1);
			if(B <= 1ll * A * k) l = mid + 1; else r = mid;
		}
		A = a - l / (k + 1) * k - l % (k + 1); B = b - l / (k + 1); r = l + B - A * k + 1;
		for(int i = c; i <= min(d, l); i ++) putchar(i % (k + 1) ? 'A' : 'B');
		for(int i = max(c, l + 1); i <= d; i ++) putchar((i - r) % (k + 1) ? 'B' : 'A');
		puts("");
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main(){
  int i,j,k,n,x,a,s,t;
  for(;;){
    a=0;
    scanf("%d %d",&n,&x);
    if(n==0 &&x==0) break;

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      for(k=1;k<=n;k++){
        if(i==j||j==k||i==k){
        }else{
          s=i+j+k;
          if(x==s){
              a+=1;
          }
        }
      }
    }
  }
  t=3*2*1;
  printf("%d\n",a/t);
  }  
  return 0;
}


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

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))    
#define OUT(P) cout << (P) << endl    
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl    
#define PRINT_ARRAY(P) for(int i=0; i<P.size(); i++) cout << P[i] << endl;    
#define PRINT_ARRAY_INLINE(P) do { for(int i=0; i<P.size(); i++) cout << P[i] << " "; cout << endl; } while(0)    
#define PRINT_ARRAY_WITH_LABEL(L, P) do { cout << L << ": "; PRINT_ARRAY_INLINE(P); cout << endl; } while(0)    
typedef long long ll;    
const long DIVIDE = 1e9+7;

int sum_digits(int num);    
template <class T>    
vector<T> copy_vector(vector<T> vec);    
int gcd(int a, int b);    
// ****** print functions ****** //
template <class T, class U>
void print_pairs(const vector<pair<T, U>> pairs);
template <class K, class V>
void print_map(const map<K, V> m);


int main() {    
    string s;
    cin >> s;

    bool same = false;
    char prev = s[0];
    for(int i=1; i<s.size(); i++) {
        if(prev == s[i]) {
            same = true;
        }
        prev = s[i];
    }
    string ans = (same)? "Bad" : "Good";

    cout << ans << endl;




    return 0;    
}    

/******************************/    
/***** DECRARED FUNCTIONS *****/    
/******************************/    

int sum_digits(int num) {    
    int rtn = 0;    
    while(num != 0) {    
        int tmp = num % 10;    
        rtn += tmp;    
        num /= 10;    
    }    
    return rtn;    
}    

// vectorのコピー    
template <class T>    
vector<T> copy_vector(vector<T> vec) {    
    vector<T> rtn;    
    rtn.reserve(vec.size());    
    copy(vec.begin(), vec.end(), back_inserter(rtn));    
    return rtn;    
}    

// ユークリウッドの互除法    
int gcd(int a, int b) {    
    if(b==0) return a;    
    else return gcd(b, a % b);    
}

template <class T, class U>
void print_pairs(const vector<pair<T, U>> &pairs) {
    for(int i=0; i<pairs.size(); i++) { 
        cout << "(" << pairs[i].first << ", " << pairs[i].second << ")" << " "; 
    } 
    cout << endl;
}

template <class K, class V>
void print_map(const map<K, V> &m) {
    for(auto it=m.cbegin(); it!=m.cend(); it++) {
        cout << it->first << ": " << it->second << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
void YesNo(bool j){cout << (j ? "Yes" : "No") << endl; return;}
void yesno(bool j){cout << (j ? "yes" : "no") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}


int main() {
  ll n,k;
  cin >> n >> k;
  vector<int> a(n);
  vector<int> c(n,0);
  rep(i,n) {
      int b;
      cin >> b;
      a[i]=b-1;
  }
  
  int d=0,e=0;
  bool ok=true;
  rep(i,k) {
      if(c[d]>0) {
          ok=false;
          
          break;
      }
      c[d]++;
      d=a[d];
      e++;
  }
  int g=0;
  int f=d;
  if(!ok) {
    
    
    d=0;
    rep(i,k) {
      if(f==d) break;
      
      d=a[d];
     g++;
      }
  }
  e-=g;

  if(!ok) {
      k-=g;
      k%=e;
      d=f;
      rep(i,k) {
      
      
      d=a[d];
     
      }
  }
  pt(d+1);
  return 0;
}


Measured memory_bytes: 4848
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

struct RollingHash {
    using T = long long;
    using hash_type = pair<T, T>;
    const T mod1 = 1000000007, mod2 = 1000000009;
    const int base1 = 1007, base2 = 2009;
    vector<T> hash1, hash2, pow1, pow2;

    RollingHash(const string &s){
        int n = s.size();
        hash1.assign(n+1,0);
        hash2.assign(n+1,0);
        pow1.assign(n+1,1);
        pow2.assign(n+1,1);
        for(int i=0; i<n; i++){
            hash1[i+1] = (hash1[i]*base1+s[i])%mod1;
            hash2[i+1] = (hash2[i]*base2+s[i])%mod2;
            pow1[i+1]=pow1[i]*base1%mod1;
            pow2[i+1]=pow2[i]*base2%mod2;
        }
    }

    hash_type get(int l,int r){
        T res1 = ((hash1[r] - hash1[l]*pow1[r-l]) % mod1 + mod1) % mod1;
        T res2 = ((hash2[r] - hash2[l]*pow2[r-l]) % mod2 + mod2) % mod2;
        return make_pair(res1, res2);
    }

    hash_type concat(hash_type h1, hash_type h2, int h2len) {
        T res1 = (h1.first*pow1[h2len] + h2.first) % mod1;
        T res2 = (h1.second*pow2[h2len] + h2.second) % mod2;
        return make_pair(res1, res2);
    }
};

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

    RollingHash rh(s);

    int ok = 0, ng = s.size()+1;
    while (abs(ok - ng) > 1) {
        LL mid = (ok + ng) / 2;
        bool f = 0;
        map<RollingHash::hash_type, int> mp;
        for(int i=0; i+mid<=s.size(); i++){
            auto tmp = rh.get(i, i+mid);
            if(mp.count(tmp)){
                if(i-mp[tmp] >= mid){
                    f = 1;
                    break;
                }
            }
            else mp[tmp] = i;
        }
        if(f) ok = mid;
        else ng = mid;
    }

    cout << ok << endl;
}

Measured memory_bytes: 768
// Problem : B - Mysterious Light
// Contest : AtCoder - AtCoder Grand Contest 001
// URL : https://atcoder.jp/contests/agc001/tasks/agc001_b
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
const ll MOD = 1e9 + 7;
#define fir first
#define sec second
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(c,a,b) for(ll c=a;c<b;c++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define min_heap priority_queue<pll,vector<pll>,greater<pll> >
ll dx4[]={-1,1,0,0};
ll dy4[]={0,0,-1,1};
ll dx8[]={-1,-1,-1,0,1,1,1,0};
ll dy8[]={-1,0,1,1,1,0,-1,-1};
bool isvalid(ll x,ll y,ll n,ll m)
{
    return (x>=0 and y>=0 and x<n and y<m);
}
ll isprime[1000];
vector<ll> prime;
void sievetoprime(ll n)
{
    mem(isprime,true);
    for(ll p=2;p*p<=n;p++)
    {
        if(isprime[p]==true)
        {
            for(ll i=p*p;i<=n;i+=p)
                isprime[i]=false;
        }
    }
}
ll lcm(ll a,ll b)
{
    return (a/__gcd(a,b))*b;
}
ll f(ll s,ll t)
{
	//cout<<s<<" "<<t<<"\n";
	//if(s==0 or t==0)
		//return 0;
	if(s==t)
		return s;
	if(s<t)
	{
		//return (t/s)*2*s+f(s,t%s);
		if(t%s==0)
			return (t/s)*2*s - s;
		else
			return (t/s)*2*s+f(s,t%s);
	}
	if(s>t)
		return f(t,s);
}
void solve()
{
    ll n,x;
    cin>>n>>x;
    cout<<n+f(x,n-x);
}
int main()
{
    ll inpoup = 0;
    if(inpoup==1)
    {
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif
    }
    IOS
    ll t;
    t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

class Node:
    def __init__(self):
        self.parent = -1
        self.typ = "leaf"

def dfs(G, v, d=0):
    G[v].depth = d
    for child in G[v].childlen:
        dfs(G, child, d+1)

def main():
    N = int(input())
    G = [Node() for _ in range(N)]
    for _ in range(N):
        idx, k, *childlen = map(int, input().split())
        G[idx].childlen = childlen
        if k:
            G[idx].typ = "internal node"
        for child in childlen:
            G[child].parent = idx
    root = [i for i, x in enumerate(G) if x.parent == -1][0]
    G[root].typ = 'root'
    dfs(G, root)
    for i, x in enumerate(G):
        print('node {}: parent = {}, depth = {}, {}, [{}]'.format(i, x.parent, x.depth, x.typ, ', '.join(list(map(str, x.childlen)))))

if __name__ == '__main__': main()


Measured memory_bytes: 43496
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

LL dp[1000005][2][2]; //! [index][include 0][include 9]

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

    int n;
    cin >> n;
    dp[0][0][0] = 1;
    rep(i, n) {
        rep(i0, 2) rep(i9, 2) {
            LL c = dp[i][i0][i9];
            if (c == 0) continue;
            if (i0) {
                if (i9) {
                    dp[i+1][1][1] = (dp[i+1][1][1] + (c * 10)) % MOD;
                 } else {
                    dp[i+1][1][0] = (dp[i+1][1][0] + (c * 9)) % MOD;
                    dp[i+1][1][1] = (dp[i+1][1][1] + (c * 1)) % MOD;
                 }
            } else {
                if (i9) {
                    dp[i+1][0][1] = (dp[i+1][0][1] + (c * 9)) % MOD;
                    dp[i+1][1][1] = (dp[i+1][1][1] + (c * 1)) % MOD;
                 } else {
                    dp[i+1][0][0] = (dp[i+1][0][0] + (c * 8)) % MOD;
                    dp[i+1][0][1] = (dp[i+1][0][1] + (c * 1)) % MOD;
                    dp[i+1][1][0] = (dp[i+1][1][0] + (c * 1)) % MOD;
                 }
            }
        }
    }

    cout << dp[n][1][1] << endl;

    return 0;
}


Measured memory_bytes: 34772
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

char ch(char n) { 
  if(n=='2') return 'k';
  if(n=='3') return 's';
  if(n=='4') return 't';
  if(n=='5') return 'n';
  if(n=='6') return 'h';
  if(n=='7') return 'm';
  if(n=='8') return 'y';
  if(n=='9') return 'r';
}

char ch2(char c) {
  if(c=='T') return 'a';
  if(c=='L') return 'i';
  if(c=='U') return 'u';
  if(c=='R') return 'e';
  return 'o';
}
  
int main() {
  string s;
  cin >> s;
  string t="";
  rep(i,(int)s.size()/2) {
    if(s[i*2]>='1' && s[i*2]<='9') {
      if(s[i*2]>='2') t+=ch(s[i*2]);
      t+=ch2(s[i*2+1]);
    } else {
      if(s[i*2+1]=='T') t+="wa";
      else if(s[i*2+1]=='U') t+="nn";
      else t+="wo";
    }
  }
  pr(t);
  return 0;
}


Measured memory_bytes: 1192
#pragma GCC optimize (2)
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
#include <map>
#include <deque>
#define INF 0x3f3f3f3f
#define NO 105
#define MO 10005
#define P 1000000007
#define mp(x, y) make_pair(x, y)
#define fi first
#define se second
#define lln putchar('\n')
typedef long long ll;
typedef double db;
using namespace std;
typedef pair<int, int> pii;
inline ll read()
{
	char ch = ' ', last;
	ll ans = 0;
	while (ch < '0' || ch > '9')
		last = ch, ch = getchar();
	while (ch >= '0' && ch <= '9')
		ans = ans * 10 + int(ch - '0'), ch = getchar();
	if (last == '-')
		return -ans;
	return ans;
}
void write(ll x)
{
	if (x >= 10)
		write(x / 10);
	putchar(x % 10 + '0');
}
//head

//variable

void init()
{
	int a = read(), b = read();
    cout << max(a + b, max(a - b, a * b)) << endl;
}
//functions

int main()
{
	init();
	return 0;
}
//main

Measured memory_bytes: 256
n,m = map(int,input().split())
cnt = 0
a = list(map(int,input().split()))
num = sum(a) / (4*m)
for i in range(n):
    if a[i] < num:
        pass
    else:
        cnt += 1
if cnt >= m:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
    public static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');
        var N = int.Parse(input[0]);
        var R = int.Parse(input[1]);
        Console.WriteLine(N >= 10 ? R : (R + 100 * (10 - N)));
    }
}


Measured memory_bytes: 11092
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;


int main(){
	int n,k,memo = 0;
	cin >> n >> k;
	bool d[10] = {false};
	
	rep(i,0,n){
		cin >> memo;
		d[memo] = true;
	}
	
	for(int i = n;;i++){
		memo = i;
		while(1){
			
			if(memo == 0){
				cout << i << endl;
				return 0;
			}
			
			if(d[memo%10]){
				break;
			}
			
			
			
			
			
			memo /= 10;
			
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll            long long
#define nl            "\n"
#define PB            push_back
#define fi            first
#define se            second
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
int main()
{
    _SAD()
    ll n,a,b,c,d,e,ans=0,cnt=0;
    cin>>n>>a>>b>>c>>d>>e;
    ll x=min( { a,b,c,d,e } );
    cout<<(n+(x-1))/x+4<<nl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(input()) for _ in range(N)]

N_dict = {}
count = 0

for a in A:
    if a not in N_dict:
        count += 1
        N_dict[a] = 1
    elif N_dict[a] % 2 == 0:
        count += 1
        N_dict[a] += 1
    else:
        count -= 1
        N_dict[a] += 1

print(count)

Measured memory_bytes: 16272
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int ans=0;
  for(int i = 0; i < N; i++){
    int tmp;
    cin >> tmp;
    if(tmp%2==0){
      if((tmp%3!=0)&&(tmp%5!=0)) ans++;
    }
  }
  if(ans>0) cout << "DENIED" << endl;
  else cout << "APPROVED" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<set>

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}


signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	const int NUM = 26;
	int N, ans = 0;
	vector<vector<int>> a,b;
	string S, T;
	
	cin>>N;
	cin>>S;
	
	a.resize(N, vector<int>(N, false));
	b.resize(N, vector<int>(N, 0));
	T = S;
	
	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			if(S[i] == S[j]) a[i][j] = true;
		}
	}
	
	for(int i = 1; i < N; i++){
		
		for(int j = 1; j < N; j++){
			// if(j == i) continue;
			if(a[i-1][j-1] && a[i][j]){
				int x = b[i-1][j-1]+1;
				
				if(i+x < j || i-x > j){
					b[i][j] = max(b[i][j], x);
					ans = max(ans, b[i][j]+1);
				}
			}
		}
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 391296
X, K, D = map(int, input().split())

num = abs(X)//D
if num >= K:
    X = abs(X) - K*D

else:
    if num%2 == K%2:
        X = abs(X) - D*num
    else:
        X = abs(X) - D*(num+1)
        
print(abs(X))

Measured memory_bytes: 9124
N, T = [int(s) for s in input().split(' ')]
cost = 9999
for i in range(0, N):
    c, t = [int(s) for s in input().split(' ')]
    if t > T:
        continue
    cost = min(c, cost)
    
print(cost if cost < 9999 else 'TLE')


Measured memory_bytes: 2940
from bisect import bisect_left
from itertools import product
N, K = map(int, input().split())
D = [int(i) for i in input().split()]
ary = []
for n in range(10):
    if n not in D:
        ary.append(str(n))

l = []
for it in product(ary, repeat=len(str(N))):
    n = int(''.join(it))
    l.append(n)
    if n > 10000:
        break
l.sort()
i = bisect_left(l, N)
if i < len(l):
    print(l[i])
else:
    print(int((ary[0] if ary[0] != '0' else ary[1]) + ary[0]*(len(str(N)))))


Measured memory_bytes: 38896
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main(){
    string s;
    cin >> s;
    int ok = 15;
    for(int i = 0; i < s.size(); i++)if(s[i] == 'x')ok--;
    if(ok >= 8)cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		int a = fs.nextInt(), b = fs.nextInt(), c = fs.nextInt();
		int cnt = 0;
		if(a==b)cnt++;
		if(b==c)cnt++;
		if(c==a)cnt++;
		
		if(cnt==1)System.out.println("Yes");
		else System.out.println("No");
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

Measured memory_bytes: 21076
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;

int main(){
  vector<vector<char>> c(3, vector<char>(3));
  rep(i, 3){
    rep(j, 3){
      cin >> c[i][j];
    }
  }
  cout << c[0][0] << c[1][1] << c[2][2] << endl;

}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#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 (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

int main() {
	int n;
	while (cin >> n && n != 0) {
		string s;
		cin >> s;
		int card[10] = {}, ba = 0, yama = 100;
		for (int i = 0; i < s.size(); ++i) {
			if (s[i] == 'S') {
				ba += card[i % n] + 1;
				card[i % n] = 0;
			}
			else if (s[i] == 'L') {
				card[i % n] += ba + 1;
				ba = 0;
			}
			else if (s[i] == 'M') {
				card[i % n]++;
			}
			yama--;
			if (yama == 0)
				break;
		}
		sort(card, card + n);
		for (int i = 0; i < n; ++i)
			cout << card[i] << " ";
		cout << ba << endl;
	}

	return 0;
}

Measured memory_bytes: 3228
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    A, B = [int(x) for x in input().split()]

    for i in range(100000):
        if i * 8 // 100 == A and i // 10 == B:
            print(i)
            return
    else:
        print(-1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eps 1e-15

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef map<int,int> mii;
typedef pair<int,int> pii;
typedef tuple<int,int,int> ti3;

void Main()
{
	int L, R; cin >> L >> R;
	int last = min(R, L + 2019 + 10);
	int ans = 3000;
	REP(i, L, last + 1)
	{
		REP(j, i+1, last + 1)
		{
			int temp = ((i % 2019) * (j % 2019)) % 2019;
			ans = min(ans, temp);
		}
	}
	cout << ans << endl;
}

int main()
{
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	Main();
}


Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        do_(inp);
        inp.close();
    }
    public static void do_(Scanner inp) {
        int n = inp.nextInt();
        int k = inp.nextInt();
        k -= 1;
        String s = inp.next();
        String s1 = s.substring(0, k);
        String s2 = Character.toString(s.charAt(k));
        String s3 = s.substring(k + 1, n);
        System.out.println(s1 + s2.toLowerCase() + s3);
    }
}


Measured memory_bytes: 21716
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.HashMap;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ERemOfSumIsNum solver = new ERemOfSumIsNum();
        solver.solve(1, in, out);
        out.close();
    }

    static class ERemOfSumIsNum {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

        /*
        連続する部分列の和 - 要素数 = Kの倍数
        部分列からそれぞれ1を引いておくことで、
        連続する部分列の和 = Kの倍数
        とすればよいことがわかる。
        あとはzero-sum-rangesみたいな要領でよさそう。

        k個以上集めてはいけないことが分かった。
        どうすればいいんだ…？
        まずk個入れて、一個入れたら一個抜く？
        それはありな感じがする。
         */

            int n = in.nextInt();
            int k = in.nextInt();
            int[] acc = new int[n + 1];
            long res = 0;

            for (int i = 1; i <= n; i++) {
                acc[i] = (acc[i - 1] + (in.nextInt() - 1)) % k;
            }

            HashMap<Integer, Integer> hm = new HashMap<>();

            // まず左からk-1個の中でどうにかできるようにしている
            for (int i = 0; i < Math.min(n + 1, k); i++) {
                hm.merge(acc[i], 1, Integer::sum);
            }

            for (Integer i :
                    hm.keySet()) {
                res += (long) hm.get(i) * (long) (hm.get(i) - 1) / 2;
            }

            for (int i = k; i <= n; i++) {
                // まず一つ抜く
                hm.merge(acc[i - k], -1, Integer::sum);
                // 足して一つ入れる
                if (hm.containsKey(acc[i])) {
                    res += hm.get(acc[i]);
                }
                hm.merge(acc[i], 1, Integer::sum);
            }

            out.println(res);

        }

    }
}



Measured memory_bytes: 91072
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <stack>
#include <algorithm>
using namespace std;
int main (){
	int a, b;
	cin >> a >> b;
	if (b%a==0){
		cout << a+b;
	}
	else {
		cout << b-a;
	}
}

Measured memory_bytes: 256