akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>
#include <ctype.h>
#include <cstring>
#include <cstdio>
#include <sstream>
#include <functional>

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long
//#define scanf scanf_s

int n, a[105];
ll int dp[105][25];

ll int sagasitehappy(int i, int j)
{
	if (j > 20 || j < 0) return 0;
	if (dp[i][j] >= 0) return dp[i][j];
	if (i == n - 1)
	{
		if (j == a[n-1]) return 1;
		else return 0;
	}
	else
	{
		dp[i][j] = sagasitehappy(i + 1, j + a[i]) + sagasitehappy(i + 1, j - a[i]);
		return dp[i][j];
	}
}

int main()
{
	cin >> n;
	REP(i, n) cin >> a[i];
	REP(i, 105)REP(j, 25)dp[i][j] = -1;
	cout<<sagasitehappy(1, a[0]) << endl;
	return 0;
}

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

using namespace std;

int cnt,W,N,v[1000],w[1000],dp[1001][1001],ca;

int main(){
  while(1){
    scanf("%d",&W);
    if(W==0) break;
    cnt++;
    scanf("%d",&N);
    
    for(int i = 0;i <N;i++){
      int a,b;
      scanf("%d,%d",&b,&a);
      v[i] = b;
      w[i] = a;
    }


    for(int i=0;i<N;i++){
      for(int j=0;j<=W;j++){
        if(w[i]>j){
          dp[i+1][j]=dp[i][j];
        }else{
          dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i]);
        }
      }
    }
    int ans_v=dp[N][W],ans_w=W;
    for(int i=W;i>=0;i--){
      if(dp[N][i]<ans_v) break;
      else{
        ans_w=i;
      }
    }

    printf("Case %d:\n%d\n%d\n",cnt,ans_v,ans_w);

    for(int i=0;i<1000;i++){
      w[i]=v[i]=0;
    }
    memset(dp,0,sizeof(dp));
  }
  return 0;
}

Measured memory_bytes: 7120
n,a,b = map(int,input().split())
if(a>b):
  print(0)
else:
  if(n == 1):
    if(a!=b):
      print(0)
    else:
      print(1)
  else:
    print(b*(n-1)+a-(a*(n-1)+b)+1)
  


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

typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (n); i++)

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

    int N; cin >>N;
    vector<ll> A(N), B(N);
    rep(i, N) cin >> A[i] >> B[i];

    ll ans = 0;
    ll r;    
    for (int i = N-1; i >= 0; i--) {
        if ((r = (A[i]+ans) % B[i]) != 0) {
            ans += B[i] - r;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ms(x,y) memset(x, y, sizeof(x))
#define lowbit(x) ((x)&(-x))
#define sqr(x) ((x)*(x))
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;


void run_case() {
    string s;
    int q, t;
    bool st = 0;
    cin >> s >> q;
    vector<char> store[2];
    while(q--) {
        cin >> t;
        if(t == 1) {
            st = !st;
        } else {
            int f;
            char c;
            cin >> f >> c;
            f--;
            store[f^st].push_back(c);
        }
    }
    string ans;
    for(auto i = store[0].rbegin(); i != store[0].rend(); ++i)
        ans += *i;
    ans += s;
    for(char c: store[1])
        ans += c;
    if(st) reverse(ans.begin(), ans.end());
    cout << ans;
}


int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    cout.flags(ios::fixed);cout.precision(9);
    //int t; cin >> t;
    //while(t--)
    run_case();
    cout.flush();
    return 0;
}

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

int main() {
    int h,w;
    cin >> h >> w;
    vector<vector<int>> a(h,vector<int>(w));
    for (int y=0;y<h;y++) {
        for (int x=0;x<w;x++) cin >>a[y][x];
    }
    vector<vector<pair<int,int>>> ans;
    vector<pair<int,int>> t;
    bool flag=false;
    for (int y=0;y<h;y++) {
        if (y%2==0) {
            for (int x=0;x<w;x++) {
                if (a[y][x]%2==1) {
                    if (!flag) flag=true;
                    else {
                        t.push_back(make_pair(y,x));
                        ans.push_back(t);
                        t.clear();
                        flag=false;
                    }
                }
                if (flag) t.push_back(make_pair(y,x));
            }
        } else {
            for (int x=w-1;x>=0;x--) {
                if (a[y][x]%2==1) {
                    if (!flag) flag=true;
                    else {
                        t.push_back(make_pair(y,x));
                        ans.push_back(t);
                        t.clear();
                        flag=false;
                    }
                }
                if (flag) t.push_back(make_pair(y,x));
            }
        }
    }
    int n=0;
    for (int i=0;i<ans.size();i++) {
        for (int j=0;j<ans[i].size()-1;j++) {
            n++;
        }
    }
    cout << n << endl;
    for (int i=0;i<ans.size();i++) {
        for (int j=0;j<ans[i].size()-1;j++) {
            cout << ans[i][j].first+1 << ' ' << ans[i][j].second+1 << ' ' << ans[i][j+1].first+1 << ' ' << ans[i][j+1].second+1 << endl;
        }
    }
}

Measured memory_bytes: 9904
#include <bits/stdc++.h>
 
#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(int i=n;i<=N;++i)
#define rap(i,n,N) for(int i=n;i>=N;--i)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define ff fi.fi
#define fs fi.se
#define sf se.fi
#define ss se.se
#define lc (id<<1)
#define rc ((id<<1)|1)
#define db(x) cout << ">>>>>> " << #x << " -> " << x << endl
#define all(x) x.begin(),x.end()
#define pii pair<int,int> 
#define pll pair<ll,ll>
#define plll pair<ll,pll>
#define pllll pair<pll,pll>
#define piii pair<int,pii>
#define piiii pair<pii,pii>
#define psi pair<string,int>
#define endl '\n'
const int MAX = 2e5+5;
const ll MAX2 = 11;
const ll MOD = 998244353;
const ll MOD2 = 1000000006;
const ll INF = 2e18;
const int dr[]={1,0,-1,0,1,1,-1,-1,0};
const int dc[]={0,1,0,-1,1,-1,1,-1,0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 316;

int n,k,x[MAX],pf[MAX];
ll ans;
map<int,int> cnt;

int main(){
//	cout<<fixed<<setprecision(2);
//    freopen("input.txt", "r", stdin);
//	freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>n>>k;
    cnt[0]++;
    rep(i,1,n){
    	cin>>x[i];
    	x[i]--;
    	pf[i] = (pf[i-1]+x[i])%k;
    	if(i>=k)cnt[pf[i-k]]--;
    	ans+= cnt[pf[i]];
    	cnt[pf[i]]++;
	}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 11264
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;


#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)
ll power(ll y) {
	ll x = 26;
	ll ans = 1;
	while(y) {
		if(y & 1) {
			ans = ans * x;
		}
		x = x * x;
		y /= 2;
	}
	return ans;
}
int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, i, j;
    cin >> n;
    ll num = 1;
    ll cur = 0;
    while(true) {
    	cur += power(num);
    	if(cur >= n) {
    		break;
    	}
    	num++;
    }
    for(i = 1; i < num; i++) {
    	n = n - power(i);
    }
    string ans;
    for(i = 0; i < num; i++) {
    	ll left = num - i - 1;
    	ll cur = 0;
    	for(j = 0; j < 26; j++) {
    		cur = cur + power(left);
    		if(cur >= n) {
    			break;
    		}
    	}
		ans.pb(j + 'a');
		n = n - j * power(left);
    }
    cout << ans <<"\n";
}


Measured memory_bytes: 3576
from collections import deque
n = int(input())
a = list(map(int, input().split()))
q = int(input())
cnt = 0
while q:
    q -= 1
    l, m, r = map(int, input().split())
    tmp = deque(a[l:r])
    tmp.rotate(r - m)
    a[l:r] = tmp
print(*a)


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

namespace Atc_0027
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();

            int A = int.Parse(str.Split(' ')[0]);

            int B = int.Parse(str.Split(' ')[1]);

            if (10 <= A || 10 <= B)
            {
                Console.WriteLine(-1);
            }
            else
            {
                Console.WriteLine(A * B);
            }
        }
    }
}


Measured memory_bytes: 27448
#include <iostream>
using namespace std;
int n, c, ans;
int main() {
	int i, j;
	cin >> n;
	for(i=1; i<=n; i+=2) {
		c = 0;
		for(j=1; j<=i; j+=2) {
			if(i%j==0) c++;
		}
		if(c==8) ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d", $N);
$a = array_map('intval', explode(' ', trim(fgets(STDIN))));
$b = array_pad(array(), $N, null);

for ($i = $N; $i > 0; $i--) {
    $tmp = 0;
    for ($j = $i * 2; $j <= $N; $j += $i) {
        $tmp += $b[$j - 1];
    }
    $b[$i - 1] = ($tmp - $a[$i - 1] + 10) % 2;
}
$ans = [];
for ($i = 0; $i < $N; $i++) {
	if ($b[$i] === 1) $ans[] = $i + 1; 
}
printf("%d\n", count($ans));
echo implode(' ', $ans);


Measured memory_bytes: 33264
#include <bits/stdc++.h>
#define va first
#define vb second
#define lb lower_bound
#define ub upper_bound
#define pp push_back
#define ep emplace_back
#define all(v) (v).begin(),(v).end()
#define szz(v) ((int)(v).size())
#define psm partial_sum
#define acm accumulate
#define fio ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
using ll = long long; using lf = long double;
using pii = pair<int,int>; using ppi = pair<int,pii>;
using pss = pair<short,short>; using pll = pair<ll,ll>;
const lf PI = 3.14159265358979323846264338L;
template <typename T>
inline T umax(T& u, T v){return u = max(u, v);}
template <typename T>
inline T umin(T& u, T v){return u = min(u, v);}

int n, a, b, c, d;
char S[200005];
int main(){
    fio;
    cin >> n >> a >> b >> c >> d;
    cin >> S + 1;
    for(int i = 1; i <= n; i++){
        if(S[i] == '#' && S[i-1] == '#'){
            if(a < i-1 && i < c || b < i-1 && i < d){
                cout << "No\n";
                return 0;
            }
        }
    }
    if(c == d){
        cout << "No\n";
        return 0;
    }
    if(c < d){
        cout << "Yes\n";
        return 0;
    }
    for(int i = b; i <= d; i++){
        if(S[i-1] != '#' && S[i] != '#' && S[i+1] != '#'){
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define pb push_back
#define tam 310000
#define se second
#define fi first
#define forr(i,p,n) for(ll i=p;i<n;i++)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
typedef pair<ll,ll> ii;
int val[tam];
int main()
{
        int n;
        cin>>n;
        forr(i,0,n)
        {
            cin>>val[i];
        }
        ll minn=1e9;
        forr(i,-100,101)
        {
            ll tot=0;
            forr(j,0,n)
            tot+=(val[j]-i)*(val[j]-i);
            minn=min(minn,tot);
        }
        cout<<minn<<endl;

}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        CP sc = new CP();
        int n = sc.nextInt(), m = sc.nextInt();
        ArrayList<ArrayList<Integer>> adj = new ArrayList<>();
        for (int i = 0; i < n; i++)
            adj.add(new ArrayList<>());
        for (int i = 0; i < m; i++) {
            int u = sc.nextInt() - 1;
            int v = sc.nextInt() - 1;
            adj.get(u).add(v);
            adj.get(v).add(u);
        }
        boolean[] visited = new boolean[n];
        int max = Integer.MIN_VALUE;
        for (int i = 0; i < n; i++) {
            if (!visited[i]) {
                c = 0;
                DFS(adj, visited, i);
                if (max < c)
                    max = c;
            }
        }
        System.out.println(max + 1);
    }

    static int c;

    static void DFS(ArrayList<ArrayList<Integer>> adj, boolean[] visited, int s) {
        visited[s] = true;
        for (int u : adj.get(s))
            if (!visited[u]) {
                c++;
                DFS(adj, visited, u);
            }
    }

    /*****************************************************************************/
    static class CP {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;

        public CP() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }

        int nextInt() {
            return Integer.parseInt(NNNN());
        }

        long nextLong() {
            return Long.parseLong(NNNN());
        }

        double nextDouble() {
            return Double.parseDouble(NNNN());
        }

        String NNNN() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        String nextLine() {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        }
    }
    /*****************************************************************************/
}

Measured memory_bytes: 113840
from itertools import product
N,M = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(M)]
P = list(map(int,input().split()))
cnt = 0
for x in product((0,1),repeat=N):
    flag = 1
    for i in range(M):
        k = A[i][0]
        B = A[i][1:]
        B = [b-1 for b in B]
        c = 0
        for b in B:
            if x[b]==1:
                c += 1
        if c%2==P[i]:continue
        else:
            flag=0
            break
    if flag==1:
        cnt += 1
print(cnt)

Measured memory_bytes: 42204
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int a[5];
	for(int i=0;i<5;i++){
		cin>>a[i];
	}
	int h=0,b[5];
	for(int j=0;j<5;j++){
		if(a[j]%10!=0){
		b[j]=10-a[j]%10;			
		}
		if(a[j]%10==0){
			b[j]=0;
		}
		h+=a[j];
	}
	sort(b,b+5);
	h=h+b[0]+b[1]+b[2]+b[3];
	cout<<h;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>
 
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>
 
#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstring;
typedef vector<double> vdouble;
 
template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

vint DP(const string &s, int a) {
  const int n = s.length();
  vint dp(n, 0);
  dp[a] = 1;
  REP(i,n) {
    if (i+1 < n && s[i+1] == '.') { dp[i+1] += dp[i]; ls(dp[i+1], 2); }
    if (i+2 < n && s[i+2] == '.') { dp[i+2] += dp[i]; ls(dp[i+2], 2); }
  }
  return dp;
}

int main() {
  int n, a, b, c, d;
  string s;
  while (cin >> n >> a >> b >> c >> d >> s) {
    a--; b--; c--; d--;
    vint dpa = DP(s, a), dpb = DP(s, b);
    if (c < d) {
      cout << (dpa[c] && dpb[d] ? "Yes" : "No") << endl;
    } else {
      if (dpb[d] == 2) {
        cout << (dpa[c] ? "Yes" : "No") << endl;
      } else if (dpb[d] == 1) {
        vint x, y;
        s[b] = '#'; x = DP(s, a); s[b] = '.';
        s[d] = '#'; y = DP(s, a); s[d] = '.';
        cout << (x[c] || y[c] ? "Yes" : "No") << endl;
      } else {
        cout << "No" << endl;
      }      
    }
  }
}


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

if n < 4: # 最小以下
  print("No")

elif n % 4 == 0 or n % 7 == 0:  # 片方でわる
  print("Yes")
else:
  four_max = n // 4

  m = 1
  ans = False
  while m < four_max + 1:
    if (n - (4*m)) % 7 == 0:
      ans = True
      break
    m = m+1

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

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

int main() {
    long long int N,K,A[200000];
cin >> N >> K;
for (int i = 1; i <= N; i++) cin >> A[i];
 for (int i = K + 1; i <= N; i++) {
 if (A[i - K] < A[i]) cout << "Yes" << endl;
 else cout << "No" << endl;
 }
 return 0;
}


Measured memory_bytes: 5212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef priority_queue<string, vector<string>, less<string> > QUE_string;
typedef priority_queue<double, vector<double>, less<double> > QUE_double;
typedef priority_queue<char, vector<char>, less<char> > QUE_char;
typedef priority_queue<int, vector<int>, less<int> > QUE_int;
const int MAX = pow(10, 5)+1;//+1しないとREになる(out of rangeになるんかな?? )

// nPnの順列に対して処理を実行する//
//  https://kamino.hatenablog.com/entry/cpp-permutation-combination
void foreach_permutation(int n, std::function<void(int *)> f) {
  int indexes[n];
  for (int i = 0; i < n; i++) indexes[i] = i;
  do {
    f(indexes);
  } while (std::next_permutation(indexes, indexes + n));
}


int main(){
  int N;
  cin >> N;
  vector<int> P(N), Q(N);
  int p, q;
  for(int i=0; i<N; i++){
    cin >> p;
    p--;
    P.at(i) = p;
  }
  for(int i=0; i<N; i++){
    cin >> q;
    q--;
    Q.at(i) = q;
  }
  /*for(int i=0; i<N ; i++){
    cout << P.at(i) << " " << Q.at(i) << endl;
  }*/
  
  int count=0, p_num=0, q_num=0;
  foreach_permutation(N, [&](int *indexes) {
    count++;
    for(int i=0;i<N;i++){
      if(P.at(i) != indexes[i]){
        //cout << " だめ" << endl;
        break;
      }
      if(i==N-1){ 
        p_num = count;        
        break;
      }
    }
  });
  count = 0;
    foreach_permutation(N, [&](int *indexes) {
      count++;
      //std::cout << indexes[0] << ',' << indexes[1] << ',' << indexes[2] << std::endl;
 
    for(int i=0;i<N;i++){
      if(Q.at(i) != indexes[i]) break;
      if(i==N-1){ 
        q_num = count;        
        break;
      }
    }
  });
  
  //cout << "p_num: "<< p_num<< endl;
  //cout << "q_num: "<<q_num << endl;
  cout << abs(q_num-p_num) << endl;
  
}




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

int main()
{ 
   ios_base::sync_with_stdio(false);
   cin.tie(NULL); 

   ll i,j,t,n,a,b,c,ans=0;
   
   cin>>n;
   for(i=1;i<n;i++)
   {
     for(j=1;i*j<n;j++)
     {
       ans++;
     }
   }
   
   cout<<ans<<endl;
}   

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vl2;
const bool multiple_queries = false;
#define rep(i, n) for(ll i = 0; i < (n) ; ++i)
#define For(i, a, b) for(ll i = (a); i < (b) ; ++i)
#define revrep(i, n) for(ll i = (n) - 1; i >= 0 ; --i)
#define revFor(i, b, a) for(ll i = (b) - 1; i >= (a) ; --i)
#define all(v) v.begin(), v.end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(i) __builtin_popcountl((i))
#define substring(s, start, end) s.substr((start), (end) - (start) + 1)

void print(){cout;}
void println(){cout << endl;}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << " ";
    print(forward<Tail>(tail)...);
}

template <class Head, class... Tail>
void println(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << " ";
    println(forward<Tail>(tail)...);
}

void solve(){
    ll n;
    cin >> n;
    vl v1(n), v2(n);
    rep(i, n){
        ll x, y; cin >> x >> y;
        v1[i] = x + y, v2[i] = x - y;
    }

    sort(all(v1)), sort(all(v2));
    println(max(v1[n - 1] - v1[0], v2[n - 1] - v2[0]));
    
}

void test(ll num = 0, bool verbose = false){
    rep(i, max(1LL, num)){
        ll t = clock();
        if (verbose) cout << "\n#####" << " " << i + 1 << " " << "#####" << " " << "\n## Answer ##\n";
        solve();
        if (verbose) {cout << "\nElapsed Time:" << " " << 1000.0 * (clock() - t) / CLOCKS_PER_SEC << " " << "[ms]" << endl;}
    }
}

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    #ifdef _LOCAL
        test(6, true);
    #else
        ll t = 0;
        if (multiple_queries) cin >> t;
        test(t, false);
    #endif
    return 0;
}

Measured memory_bytes: 6424
using System;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = long.Parse(Console.ReadLine());
            for (int i = (int)Math.Sqrt(N); i > 0; i--)
            {
                if (N % i == 0)
                {
                    long result = i + (N / i) - 2;
                    Console.WriteLine(result);
                    break;
                }
            }
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;

int main()
{
  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;
  if(s == u) a -= 1;
  else b -= 1;
  
  cout << a << " " << b << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<P> vec;
    for(int i = 0; i < n; i++)
    {
        int x, y;
        cin >> x >> y;
        vec.push_back(P(x, y));
    }
    sort(vec.begin(), vec.end());
    for(int i = 0; i < n; i++)
    {
        cout << vec[i].first << " " << vec[i].second << endl;
    }
    return 0;
}




Measured memory_bytes: 3904
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define fill(x, y) memset(x, y, sizeof(x))
 
using namespace std;
 
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; }
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const double EPS = 1.0e-12;
const double PI = acos(-1.0);

int main() {
    int n,m;
    cin >> n >> m;
    ll sum = 0;
    for(int i = 0; i < m; i++){
        int a;
        cin >> a;
        sum += a;
    }
    cout << max(-1ll,n-sum) << endl;
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
long long gcd(long long x,long long y);
long long lcm(long long x,long long y);
int main(){
    int n;
    cin>>n;
    vector<long long> t(n);
    for(int i=0;i<n;i++){
        cin>>t[i];
    }
    long long ans=t[0];
    for(int i=1;i<n;i++){
        ans=lcm(ans,t[i]);
    }
    cout<<ans<<endl;
    return 0;
}
long long gcd(long long x,long long y){
    if(y==0)return x;
    else return gcd(y,x%y);
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}

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

ll dp[64][2][2][2];

int get(ll X, int i) {
  return X >> i & 1;
}

int main2() {
  ll L, R; cin >> L >> R;

  CLR(dp, 0);
  dp[62][0][0][0] = 1;
  for (int i = 61; i >= 0; i--) {
    REP(j, 2) {
      REP(k, 2) {
        REP(l, 2) {
          ll cur = dp[i+1][j][k][l] % MOD;
          { // 0, 0
            if ((j || get(R, i) >= 0) && (k || get(L, i) <= 0)) {
              int nj = j || get(R, i) > 0;
              int nk = k || get(L, i) < 0;
              dp[i][nj][nk][l] += cur;
            }
          }
          { // 1, 0
            if (l && (j || get(R, i) >= 1) && (k || get(L, i) <= 0)) {
              int nj = j || get(R, i) > 1;
              int nk = k || get(L, i) < 0;
              dp[i][nj][nk][l] += cur;
            }

          }
          { // 1, 1
            if ((j || get(R, i) >= 1) && (k || get(L, i) <= 1)) {
              int nj = j || get(R, i) > 1;
              int nk = k || get(L, i) < 1;
              dp[i][nj][nk][1] += cur;
            }
          }
        }
      }
    }
  }
  ll ans = 0;
  REP(j, 2) REP(k, 2) ans += dp[0][j][k][1];
  ans %= MOD;
  cout << ans << endl;
  return 0;
}

int main() {


#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 256
def sumof(begin, end):
    l = [i for i in range(begin, end + 1)]
    return sum(l)

N, L = [int(x) for x in input().split(' ')]
min_aji = L
max_aji = L + N - 1


if 0 <= min_aji:
    aji = sumof(min_aji + 1, max_aji)
elif 0 < max_aji:
    aji = sumof(min_aji, max_aji)
else:
    aji = sumof(min_aji, max_aji - 1)

print(aji)

Measured memory_bytes: 3064
import math 
while True:
    a, op, b = input().split()
    if (op == '+'):
        print(int(a) + int(b))
    elif (op == '-'):
        print(int(a) - int(b))
    elif (op == '*'):
        print(int(a) * int(b))
    elif (op == '/' and int(b) != 0):
        print(math.trunc((int(a) / int(b))))
    elif (op == '?' ):
        break


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

#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()
#define MP make_pair

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=2e5+10, maxm=5e3+10, lg=31, mod=1e9+7, inf=1e18;

ll n,L,a[maxn],ps[maxn],ans;

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	
	cin>>L>>n;
	for(int i=1;i<=n;i++) cin>>a[i], ps[i]=ps[i-1]+a[i];
	a[n+1]=L;
	for(int i=1,j;i<=n;i++){ j=n-i;
		ans=max({ans,j*L+2*(ps[i+j/2]-ps[i-1])-a[i+(j+1)/2]-2*(ps[n]-ps[i+(j+1)/2]),i*L+2*ps[(i-1)/2]+a[(i+1)/2]-2*(ps[i]-ps[i-(i+1)/2])});
	}
	cout<<ans;
	
	return 0;
}





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

char a[5] = {'.', ',', '!', '?', ' '};

int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		string str;
		cin >> str;
		int t = 0, s = -1;
		for(int j = 0; j < str.size(); j++){
			if(str[j] == '0'){
				if(t == 0) continue;
				if(t == 1){
					s %= 5;
					cout << a[s];
				} else if(t <= 6){
					char o = 'a';
					s %= 3;
					o += s + 3*(t-2);
					cout << o;
				} else if(t == 7){
					char o = 'a';
					s %= 4;
					o += s+3*(t-2);
					cout << o;
				} else if(t == 8){
					char o = 'a';
					s %= 3;
					o += s+19;
					cout << o;
				} else{
					char o = 'a';
					s %= 4;
					o += s+22;
					cout << o;
				}
				t = 0;
				s = -1;
			} else{
				t = str[j]-'0';
				s++;
			}
		}
		cout << endl;
	}
}

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

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

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

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

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

// Description: ????????????
// Verifyed: various problem 
const R INF = 1E40L;
const R PI = acos(-1.0L);
using P=complex<R>;
const P O=0.0L;
using L=struct{P s,t;};
using VP=vector<P>;
using C=struct{P p;R c;};

inline R dot(P o,P a,P b){return real(conj(a-o)*(b-o));}
inline R det(P o,P a,P b){return imag(conj(a-o)*(b-o));}
inline int sdot(P o,P a,P b){return sgn(dot(o,a,b));}
inline int sdet(P o,P a,P b){return sgn(det(o,a,b));}

//projection verify AOJ CGL_1_A
P proj(L l,P p){ R u=real((p-l.s)/(l.t-l.s)); return (1-u)*l.s+u*l.t;}

// vertical parallel
// verified: AOJ CGL_2_A
bool vertical(L a,L b) {return sdot(O,a.t-a.s,b.t-b.s)==0;}
bool parallel(L a,L b) {return sdet(O,a.t-a.s,b.t-b.s)==0;}
bool eql(L a,L b){ return parallel(a,b) and sdet(a.s,a.t,b.s)==0;}

// crossing determination
// verified: AOJ CGL_2_B 
bool iss(L a,L b){
	int s1=sdet(a.s,a.t,b.s)*sdet(a.s,a.t,b.t);
	int s2=sdet(b.s,b.t,a.s)*sdet(b.s,b.t,a.t);
	return max(s1,s2)<=0;
}

// crossing point 
// verified: AOJ CGL_2_C
P cross(L a,L b){
	R u=det(a.s,b.s,b.t)/det(O,a.t-a.s,b.t-b.s);
	return u*a.s+(1-u)*a.t;
}
	
// distance 
// verified: AOJ CGL_2_D
R dsp(L l,P p){
	P h=proj(l,p);
	if(sdot(l.s,l.t,p)<=0) h=l.s;
	if(sdot(l.t,l.s,p)<=0) h=l.t;
	return abs(p-h);
}

R dss(L a,L b){return iss(a,b)?0:min({dsp(a,b.s),dsp(a,b.t),dsp(b,a.s),dsp(b,a.t)});}

istream& operator >> (istream& is,P& p){ R x,y;is >> x >> y; p=P(x,y); return is;}
ostream& operator << (ostream& os,P& p){ os << real(p) << " " << imag(p); return os;}

int main(void){
	int n;
	cin >> n;
	cout.precision(20);
	rep(i,n){
		P a,b,c,d;
		cin >> a >> b >> c >> d;
		L s1={a,b},s2={c,d};
		if(parallel(s1,s2))
			cout << 2 << endl;
		else if(vertical(s1,s2))
			cout << 1 << endl;
		else
			cout << 0 << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair


int hasDisliked(int N, set<char> &disliked){
  string check = to_string(N);
  for(auto i : check){
    if (disliked.count(i))
      return 1;
  }
  
  return 0;
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int N, K;
  char curr;
  set<char> disliked;
  cin >> N >> K;
  while(K--){
	cin >> curr;
    disliked.insert(curr);
  }
  
  while(hasDisliked(N, disliked)){
    ++N;
  }
  
  cout << N << "\n";
  
  return 0;

}


Measured memory_bytes: 256
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    A=list(pin())
    A.sort()
    ans=0
    x,y,z=A
    if (y-x)%2:
        y+=1
        z+=1
        ans+=1
    ans+=(y-x)//2
    x=y
    ans+=z-x
    print(ans)
    
            
#%%submit!
resolve()


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

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

    long A, B;
    cin >> A >> B;

    if (A >= 13)
    {
        cout << B << '\n';
    }
    else if (A <= 5)
    {
        cout << 0 << '\n';
    }
    else
    {
        cout << B / 2 << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
def soin(N):
    res = []
    i = 2
    while i < round(N**(1/2)) + 3:
        if N%i == 0:
            res.append(i)
            N = N//i
            i = 2
        else:
            i += 1
    res.append(N)
    return res

N, P = (int(i) for i in input().split())
res = soin(P)

def countList(L, ma = None):#maは要素の個数の最大値
    if ma == None:
        ma = len(L)
    L.sort() #すでにしているなら不要
    temp = None
    cc = 1
    reslis = []
    for se in L:
        if temp == se:
            cc += 1
        else:
            if temp == None:
                pass
            else:
                if cc >= N:
                    aaa = temp ** (cc // N) 
                    reslis.append(aaa)
                cc = 1
            temp = se
    if cc >= N:
        aaa = temp ** (cc // N) 
        reslis.append(aaa)
    return reslis

aaa = countList(res)
re = 1
for i in aaa:
    re *= i

print(re)

Measured memory_bytes: 3188
<?php
        while (true) {
            $cnt = trim(fgets(STDIN));
            if ($cnt == 0) {
                break;
            }
            $sumA = 0;
            $sumB = 0;
            for ($i = 0; $i < $cnt; $i++) {
                $score = trim(fgets(STDIN));
                $scoreA = substr($score, 0, 1);
                $scoreB = substr($score, -1);
                if ($scoreA > $scoreB) {
                    $sumA += $scoreA + $scoreB;
                } elseif ($scoreA < $scoreB) {
                    $sumB += $scoreA + $scoreB;
                } elseif ($scoreA == $scoreB) {
                    $sumA += $scoreA;
                    $sumB += $scoreB;
                }
            }
            echo $sumA . " " . $sumB . "\n";
        }
        ?>


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

bool p[110];

int main(){
	int n, k;
	scanf("%d%d", &n, &k);
	for(int i = 0; i < k; i++) {
		int d, a;
		scanf("%d", &d);
		for(int j = 0; j < d; j++) {
			scanf("%d", &a);
			p[a-1] = true;
		}
	}
	int ans = 0;
	for(int i = 0; i < n; i++)
		if(!p[i]) ans++;
	printf("%d\n", ans);
}


Measured memory_bytes: 3828
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<assert.h>
#include<cstring>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
#define de_x(x) cout<< #x <<"->debug_val: "<<x<<endl;
#define de_ve(x) for(auto it: x) cout<<it<<" ";
#define rep(i,a,n) for (int i=a;i<n;i++)
#define _rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef vector<int> VI;
typedef pair<int,int> PII;
typedef double db;
//std::mt19937 mrand(random_device{}());
//int rnd(int x) { return mrand() % x ; }
const ll mod=1e7;
ll ksm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int _,n,m;
/***********************/
void run(){
}
int main(){
//    for(scanf("%d",&_);_;_--) run();
    int k,s;
    cin>>n>>k>>s;
    for(int i=0;i<n;++i)
    cout<<(i?" ":"")<<(i<k?s:(s<1e9?s+1:s-1));
    return 0;
}

Measured memory_bytes: 1280
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

N,K = II()
H = III()

H.sort(reverse=True)
if K>=N:
    print(0)
else:
    print(sum(H[K:]))

Measured memory_bytes: 81872
#include <iostream>
#include <string>

using namespace std;

int main(){
	long long int a,b,c;
	long long int tmp=0;
	cin>>a>>b>>c;

	for(long long int i=1;i<10000;i++){
		if((i*a)%b==c){
			tmp=1;
			cout<<"YES"<<endl;
			break;
		}		
	}

	if(tmp==0){
		cout<<"NO"<<endl;
	}

	return 0;
}

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


void solve(long long A, long long B, long long N){
    long long x = min(N, B-1);
    cout << ((A*x)/B) - 5*(x/B) << endl;
    return;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long N;
    scanf("%lld",&N);
    solve(A, B, N);
    return 0;
}


Measured memory_bytes: 3764
N, M = [int(x) for x in input().split()]

dp = [1] * (N + 1)

for i in range(M):
	dp[int(input())] = 0

if N == 1:
	print(1)
else:
	for i in range(N - 1):
		dp[i + 2] = (dp[i] + dp[i + 1]) * dp[i + 2]
	print(dp[N] % 1000000007)

Measured memory_bytes: 462708
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
 
using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;
using ld = long double;
 
// ------------------------------------------------------------------------------------------------

const ll N_MAX = 1000 + 5, MOD = 1e9 + 7;

ll n, ans;
vll lp, primes;

void sieve(ll n) {
    lp.assign(n + 1, 0);
    for (ll i = 2; i <= n; i++) {
        if (lp[i] == 0) {
            lp[i] = i;
            primes.push_back(i);
        }
        for (ll p : primes) {
            if (p > lp[i] || i * p > n) {
                break;
            }
            lp[i * p] = p;
        }
    }
}

ll legendre(ll n, ll p) {
    if (n == 0) {
        return 0;
    }
    n /= p;
    return (n + legendre(n, p)) % MOD;
}

int main() {
    fast_io; cout_precision;
    cin >> n;
    sieve(N_MAX);
    ans = 1;
    for (ll p : primes) {
        (ans *= (legendre(n, p) + 1) % MOD) %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <set>
#include <unordered_set>
#include <stack>
#include <algorithm>
#include <queue>
#include <ctime>
#include <iomanip>
#include <tuple>
#include <functional>
#include <map> 
#include <numeric> 
#include <math.h>

using namespace std;


#define ll long long
#define pi pair<int, int>
#define vi vector<int>
#define vp vector<pi>
#define msa(A, a, n) memset(A, a, n*sizeof(A))
#define msv(A, a) fill(A.begin(), A.end(), a);
#define msc(A, n) memset(A, '\0', n)
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define rep(i, a, b) for(int i = a; i < b; i++)
#define per(i, a, b) for(int i = a; i >= b; i--)
#define pern(i, b) per(i, b - 1, 0)
#define repn(i, b) rep(i, 0, b)
#define repe(i, a, b) for(int i = a; i <= b; i++)
#define repen(i, b) repe(i, 1, b)
#define fast ios_base::sync_with_stdio();cin.tie(0);
#define endl "\n"
//#define MYDEBUG 

void my_return(int code)
{
#ifdef MYDEBUG
	std::cout << "\n\nTime = " << fixed << std::setprecision(3) << double(clock()) / CLOCKS_PER_SEC << endl;
#endif
	exit(code);
}

int main()
{
	fast
#ifdef MYDEBUG
		freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	string s, t;
	cin >> s >> t;

	int c = 0, cp = 0, diff_len = s.size() - t.size();
	repn(i, diff_len + 1) {
		string sub = s.substr(i, t.size());
		cp = c, c = 0;
		repn(j, t.size())
			if (t[j] == sub[j]) c++;
		c = max(c, cp);
	}

	cout << t.size() - c << endl;

	my_return(0);
}


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

int main(){
	int n,T;
	cin >> n >> T;
	int ans = 10000;

	for(int i=0; i<n; i++){
		int c,t;
		cin >> c >> t;
		if(t<=T) ans = min(ans,c);
	}

	if(ans!=10000) cout << ans << endl;
	else cout << "TLE" << endl;

	return 0;
}

Measured memory_bytes: 3612
import java.util.*;
import java.*;
class Main {
   public static void main(String[] args)
   {
      Scanner scan = new Scanner(System.in);



      long N = Long.parseLong(scan.next());
      long K = Long.parseLong(scan.next());



      long count = 0;

      for(long i = K + 1; i <= N; i++){
          long p = N / i;
          long r = N % i;
          count += (i - K) * p + Math.max(r - K + 1, 0);
          }

      if(K == 0){
         count = N * N;
         }
      System.out.println(count);
   }
}


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

typedef long long int ll;
typedef vector<long long>lve;
typedef vector<pair<ll,ll> > lvp;
typedef vector<vector<int> > ivve;

#define sp         ' '
#define endl       '\n'
#define F          first
#define S          second
#define pb         push_back
#define mp         make_pair 
#define GCD(x,y)   __gcd(x,y)
#define lb         lower_bound
#define up         upper_bound
#define setp       setprecision
#define bs         binary_search
#define all(x)     x.begin(),x.end()
#define LCM(x,y)   ((x*y)/__gcd(x,y))
#define spc(x)     cout<<fixed<<setp(x)

const   long long  inf = 1e18;
const   long long  cs =  200005;
const   long long  mod = 1000000007;
const   double     PI =  2 * acos(0.0);
void solve()
{
    ll t,n,m,a,b,c,d,e,i,j,k,x,y,z,cnt=0,cnt1=0;
    bool flag = false;
    
    cin>>a>>b;
    cout<<6-a-b<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    cout.tie(NULL);

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

    // int32_t tc;
    // cin>>tc;
    // while(tc--)
    solve();

    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <functional>
using namespace std;

template <typename Monoid>
class SegmentTree 
{
    using F = function<Monoid(Monoid, Monoid)>;
private:
    vector<Monoid> node;
    int N = 1;
    const F func;
    const Monoid init_value;

public:
    SegmentTree() = default;
    SegmentTree(const int& sz, const F func, const Monoid &init_value) : func(func), init_value(init_value)
    {
        while (N < sz)
            N *= 2;
        node.assign(2 * N - 1, init_value);
    }
    void update(int k, const Monoid& x)
    {
        k += N - 1;
        node[k] = x;
        while (k > 0)
        {
            k = (k - 1) / 2;
            node[k] = func(node[2 * k + 1], node[2 * k + 2]);
        }
    }
    Monoid query(int s, int t, int k, int l, int r)
    {
        if (r <= s or t <= l)
            return init_value;
        if (s <= l and r <= t)
            return node[k];
        int mid = (l + r) / 2;
        Monoid a = query(s, t, 2 * k + 1, l, mid);
        Monoid b = query(s, t, 2 * k + 2, mid, r);
        return func(a, b);
    }
    Monoid query(int s, int t) { return query(s, t, 0, 0, N); }
};


int main()
{
    int64_t n, q; cin >> n >> q;
    SegmentTree<int64_t> seg(n, [](int64_t a, int64_t b) { return min(a, b); }, 2147483647);
    while(q--)
    {
        int64_t com, x, y; cin >> com >> x >> y;
        if(com == 0) seg.update(x, y);
        else cout << seg.query(x, y + 1) << endl;
    }
}


Measured memory_bytes: 4964
#include "stdio.h"

int main(int argc, char const *argv[]) {
  char B;
  scanf("%c", &B);
  if (B=='A') {printf("T");}
  if (B=='T') {printf("A");}
  if (B=='C') {printf("G");}
  if (B=='G') {printf("C");}
  return 0;
}


Measured memory_bytes: 128
def main():
    N, K = map(int, input().split())
    XY = [tuple(map(int, input().split())) for _ in range(N)]
    XY.sort()
    XY = tuple(XY)

    def count(x_min, x_max, y_min, y_max, i, j):
        OK = 0
        # NG = 0
        for m, n in XY[i:j + 1]:
            if y_min <= n <= y_max:
                OK += 1
        if OK >= K:
            return True
        return False

    ans = 10 ** 20
    for i, val_i in enumerate(XY[:N - 1]):
        a = val_i[0]
        for j in range(i + K - 1, N):
            b = XY[j][0]
            e = b - a
            # print (e, i, j)
            for k, c in XY:
                # c = k[1]
                for l, d in XY:
                    # d = l[1]
                    if c < d:
                        if  e * (d - c) < ans and count(a, b, c, d, i, j):
                            # print ('A')
                            ans = e * (d - c)
                            # ans = min(ans, e * (d - c))
    print (ans)
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(i,e) for(ll i=0;i<e;i++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT64_MAX;
V kaijou(100000+1);
V gyakugen(100000+1);
ll i,j;
long long ruijou(long long x, long long y){
    if(y==0) return 1;
    else if(y%2==0) return ruijou(x*x%mod,y/2);
    else return x*ruijou(x,y-1)%mod;
}
ll comb(ll x,ll y){
   if(y==0)return 1;
   return (kaijou[x]*gyakugen[y]%mod)*gyakugen[x-y]%mod;
}


int main(){
   ll N,K;
   cin>>N>>K;
   V A(N);
   rep(i,N)cin>>A.at(i);
   ll small=0,big=0;
   sort(A.begin(),A.end());
   
   kaijou[0]=1;
   for(ll k=1;k<N+1;k++){
      kaijou[k]=kaijou[k-1]*k%mod;
   }
   gyakugen[0]=1;
   for(ll k=1;k<N+1;k++){
      gyakugen[k]=gyakugen[k-1]*ruijou(k,mod-2)%mod;
   }

   rep(i,N){
      if(N-i<K)break;
      else{
         small=(small+(A.at(i)*comb(N-i-1,K-1)))%mod;
      }
   }
   rep(i,N){
      if(N-i<K)break;
      else{
         big=(big+(A.at(N-1-i)*comb(N-i-1,K-1)%mod))%mod;
      }
   }
   ll ans=(big-small);
   if(ans>=0)cout<<ans%mod<<endl;
   else cout<<(mod-(-1*ans%mod))%mod<<endl;
   
   

   


}


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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  CIN(N);
  vector< ll > a(N);
  REP(i, N) {
    cin >> a[i];
  }

  ll ans = 0ll;
  REP(i, N) {
    ans += a[i] - 1;
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256