akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define r(i,n) for(long long i = 0; i<n; i++)
typedef long long ll;
using namespace std;

int main() {
  int a,b,m,A[100001]={0},B[100001]={0},ans=100000000,mina=1000000,minb=1000000;
  cin >> a >> b >> m;
 r(i,a){
   cin >> A[i];
   mina=min(mina,A[i]);
 }
  r(i,b){
    cin>>B[i];
    minb=min(minb,B[i]);
  }
  ans=mina+minb;
  r(i,m){
    int x,y,z;
    cin >> x >> y >> z;
    ans=min(ans,A[x-1]+B[y-1]-z);
  }
  cout<<ans<<endl;
}

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

#define int long long 

void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}

void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long 

#define pii pair<int,int >
#define vec vector<int >

#define pb push_back
#define mp make_pair
#define fr first
#define sc second

#define data asd09123jdf02i3h

#define FOR(i,l,r) for(int i=l,i##_r=r;i<=i##_r;i++)

const int maxn = 1e6+10;
const int inf = 1e9;
const lf eps = 1e-8;
const int mod = 1e9+7;

int n,a[maxn],t[100];
char s[maxn];

void add(int x) {
    for(int i=60;~i;i--) {
        if(!((x>>i)&1)) continue;
        if(!t[i]) {t[i]=x;break;}
        x^=t[i];
    }
}

int query(int x) {
    for(int i=60;~i;i--) if((x>>i)&1) x^=t[i];
    return x==0;
}

void solve() {
    read(n);
    for(int i=1;i<=n;i++) read(a[i]);
    scanf("%s",s+1);
    for(int i=0;i<=60;i++) t[i]=0;
    for(int i=n;i;i--) {
        if(s[i]=='0') add(a[i]);
        else if(!query(a[i])) return puts("1"),void();
    }
    puts("0");
}

signed main() {
    int t;read(t);while(t--) solve();
    return 0;
}


Measured memory_bytes: 3692
from math import pi
from math import atan2

a, b, x = map(float, input().split())
ans = 0
x /= a
if (x > a*b / 2): 
    ans = atan2((a*b-x)*2, a*a) * 180 / pi
else:
    ans = atan2(b*b, x*2) * 180 / pi
print (ans)

Measured memory_bytes: 9356
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int n,k;
    cin>>n>>k;
    if((n-1)*(n-2)/2<k){
        cout<<-1<<endl;
        return 0;
    }
    
    int cnt =(n-1)*(n-2)/2-k;
    cout<<(n-1)+cnt<<endl;
    REP(i,2,n+1) cout<<1<<" "<<i<<endl;
    if(cnt==0) return 0;
    for(int i=2;i<n;i++){
        for(int j=i+1;j<=n;j++){
            cout<<i<<" "<<j<<endl;
            cnt --;
            if(cnt==0) return 0;                
        }
    }
}/*
./problem.exe
*/

Measured memory_bytes: 3608
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
l=sorted(l)
drink=0
money=0
index=0
while(drink<m):
    if l[index][1]+drink<m:
        drink+=l[index][1]
        money+=l[index][0]*l[index][1]
        index+=1
    else:
        money+=l[index][0]*(m-drink)
        drink=m
        print(money)
        break

Measured memory_bytes: 28188
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define MAX 100000
#define INF 2140000000
#define MOD 1000000007

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

	set<char> ss;

	for (int i = 0; i < (int) s.size(); ++i) {
		ss.insert(s[i]);
	}

	if ((int) ss.size() == 2) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	p := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&p[i])
	}

	ans := 0
	for i := 1; i < n-1; i++ {
		if p[i-1] < p[i] && p[i] < p[i+1] {
			ans++
		} else if p[i+1] < p[i] && p[i] < p[i-1] {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
import heapq

N, K = map(int, input().split())
V = list(map(int, input().split()))
V += V

ans = [V[0]]
for i in range(min(N, K)+1):
  for j in range(i+1):
    #print(i-j, j)
    # i-j個左から、i個右から取る
    lst = V[:i-j] + V[2*N-j:]
    #print(lst)
    heapq.heapify(lst)
    for _ in range(K-i):
      if len(lst) == 0:
        break
      elif min(lst) >= 0:
        ans.append(sum(lst))
        break
      else:
        heapq.heappop(lst)
        ans.append(sum(lst))
        #print(ans)
print(max(ans))

Measured memory_bytes: 4848
let rec count_factor_2 x =
  if x mod 2 = 0 then 1 + count_factor_2 (x/2)
  else 0

let () =
  Scanf.scanf "%d\n" @@ fun n ->
  Array.init n (fun _ -> Scanf.scanf "%d " count_factor_2)
  |> Array.fold_left min max_int
  |> Printf.printf "%d\n"

Measured memory_bytes: 512
import heapq

n = int(input())
a = list(map(int, input().split()))

sum1 = 0
sum2 = 0
left = []
used = set()
unused = []

for i in range(n):
    sum1 += a[i]
    heapq.heappush(left, (a[i], i))


for v, i in sorted((a[i], i) for i in range(n, n * 3)):
    if len(used) < n:
        sum2 += v
        used.add((v, i))
    else:
        heapq.heappush(unused, (v, i))

ans = sum1 - sum2
for i in range(n, 2 * n):
    # v1: これから挿入しようとしている値
    # v2: 現状の最小値
    v1 = a[i]
    v2, j = left[0]
    if v2 < v1:
        sum1 = sum1 + v1 - v2
        heapq.heappop(left)
        heapq.heappush(left, (v1, i))

    # v1: これから削除する可能性がある値
    # v2: 候補のうちで最小の値
    while True:
        v2, j = unused[0]
        if i <= j:
            break
        heapq.heappop(unused)
        
    if (v1, i) in used:
        sum2 = sum2 - v1 + v2
        used.remove((v1, i))
        used.add((v2, j))
        heapq.heappop(unused)

    ans = max(ans, sum1 - sum2)

print(ans)
    
    

Measured memory_bytes: 65700
import sys

sys.setrecursionlimit(10 ** 6)
from bisect import *
from collections import *
from heapq import *

int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline()[:-1]
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def MF(): return map(float, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LF(): return list(map(float, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
dij = [(0, 1), (1, 0), (0, -1), (-1, 0)]

def main():
    inf=10**9+5
    n,wn=MI()
    dp=[inf]*10005
    dp[0]=0
    for _ in range(n):
        v,w=MI()
        for i in range(10004,-1,-1):
            if i-v<0:break
            dp[i]=min(dp[i],dp[i-v]+w)
    for i in range(10004,-1,-1):
        if dp[i]<=wn:
            print(i)
            break

main()



Measured memory_bytes: 6272
n, k = map(int, input().split())
*A, = map(int, input().split())
a, b = 0, 10**9
while b - a > 1:
    x = (a + b) // 2
    cut = 0
    for i in range(n):
        cut += -(-A[i] // x) - 1
    if cut <= k:
        b = x
    else:
        a = x
print(b)


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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 ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n,k; cin>>n>>k;
  vll h(n);
  rep(i,n) cin>>h[i];
  vsort(h);
  
  ll ans=0;
  rep(i,n-k) ans+=h[i];
  cout<<ans<<endl;
  
}

Measured memory_bytes: 4768
import datetime
d1 = input().split("/")

y = int(d1[0])
m = int(d1[1])
d = int(d1[2])

dd = datetime.date(y,m,d)
d2 = datetime.date(2019,4,30)

if dd <= d2:
  print("Heisei")
else:
  print("TBD")

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

int main() {
  char N;
  cin>>N;
  if (N =='a' || N=='b' ||N=='c'||N=='d'||N=='e'||N=='f'||N=='g'||N=='h'||N=='i'||N=='j'||N=='k'||N=='l'||N=='m'||N=='n'||N=='o'||N=='p'||N=='q'||N=='r'||N=='s'||N=='t'||N=='u'||N=='v'||N=='w'||N=='x'||N=='y'||N=='z'){
    cout<<'a'<<endl;
  }
  else{
    cout<<'A'<<endl;
  }

}

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

#define max(a, b) ((a > b) ? a : b)
#define min(a, b) ((a < b) ? a : b)

#define forn(n) for(int i = 0; i < n; i++)
#define fork(k, n) for(int i = k; i < n; i++)

#define pb(n) push_back(n);

typedef long long ll;
typedef double dbl;

const int MX = 1e6;
const int MOD = 1e9 + 7;
const string ALPHA = "abcdefghijklmnopqrstuvwxyz";
const double PI = 3.1415926535;


int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
	double n;
  cin>>n;
  cout<<(int)(ceil(n/2))<<endl;
}


Measured memory_bytes: 3744
#include <vector>
#include <iostream>
#include <string>
#include <map>
#include <fstream>
#include <sstream>
#include <set>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;


vector<string> P;
vector<int> alpha(26);
int main(){
  int N,K;
  cin>>N>>K;
  rep(i,N){
    string s;cin>>s;
    alpha[s[0]-'A']++;
  }
  int ans;

  for(ans=0;ans<=N/K;ans++){
    sort(all(alpha));
    reverse(all(alpha));

    int par=K;
    for(int i=0;i<26;i++){
      if(par>0 && alpha[i]>0){
        alpha[i]--;
        par--;
      }
    }
    if(par!=0)break;
  }
  cout<<ans<<endl;




}


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

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

using namespace std;


signed main(){
  int N;
  int tmp;
  cin>>N;
  int A[N];
  vector<int> v;
  for(int i=0;i<N;i++){
    cin>>tmp;
    v.push_back(tmp);
  }
  while(1){
    tmp = v[0];
    sort(v.begin(), v.end());
    rep(i, v.size()){
      if(i==0) continue;
      v[i] = v[i]%v[0];
    }
    sort(v.begin(), v.end());
    for(int i=v.size()-1;i>=0;i--){
      if(v[i]==0){
        v.erase(v.begin() + i); 
      }
    }
    if (tmp==v[0]) break;
  }
  cout << v[0] << endl;
  return 0;
}


Measured memory_bytes: 1400
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<cmath>
#include<cstdio>
#include<cassert>

using namespace std;

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aut(r,v) __typeof(v) r = (v)
#define each(it,o) for(aut(it,(o).begin()); it!=(o).end(); ++it)
#define reach(it,o) for(aut(it,(o).rbegin()); it!=(o).rend(); ++it)
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& p)
{return o<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>string join(const vector<T>&v, string del=", ")
{stringstream s;rep(i,v.size())s<<del<<v[i];return s.str().substr(del.size());}
template<typename T>ostream& operator<<(ostream& o, const vector<T>&v)
{if(v.size())o<<"["<<join(v)<<"]";return o;}
template<typename T>ostream& operator<<(ostream& o, const vector<vector<T> >&vv)
{int l=vv.size();if(l){o<<endl;rep(i,l){o<<(i==0?"[ ":",\n  ")<<vv[i]<<(i==l-1?" ]":"");}}return o;}
template<typename T>ostream& operator<<(ostream& o, const set<T>& st)
{vector<T> v(st.begin(),st.end());o<<"{ "<<join(v)<<" }";return o;}
template<typename T1, typename T2>ostream& operator<<(ostream& o, const map<T1, T2>& m)
{each(p,m){o<<(p==m.begin()?"{ ":",\n  ")<<*p<<(p==--m.end()?" }":"");}return o;}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double INF = 0x3f3f3f3f;
const double INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
const double mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int N;
int H[100010];
int dp[100010];

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    cin >> N;
    rep(i,N) cin >> H[i];
    dp[0] = 0;
    dp[1] = abs(H[0]-H[1]);
    REP(i,2,N){
        dp[i] = min(dp[i-1]+abs(H[i]-H[i-1]), dp[i-2]+abs(H[i]-H[i-2]));
    }
    cout << dp[N-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
const int N = 1e5;  // limit for array size
ll n;  // array size

int main(){
	
	int n,k;cin>>n>>k;
	ll a[n];
	int id=-1;
	
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i]>=0&&id==-1){
			id=i;
		}
	}
	
	ll pos[n]={};
	ll neg[n]={};
	
	for(int i=0;i<n;i++){
		pos[i]=neg[i]=-1;
	}
	
	if(id==-1){
		ll sum=0;
		for(int i=n-1,j=0;i>=0&&j<k;i--,j++){
			sum=abs(a[i]);
		}
		cout<<sum<<endl;return 0;
	}
	
	if(id==0){
		ll sum=0;
		for(int i=0;i<k;i++){
			sum=a[i];
		}
		cout<<sum<<endl;return 0;
	}
	
	for(int i=id,j=0;i<n;i++,j++){
		pos[j]=0;
		pos[j]+=a[i];
	}
	
	for(int i=id-1,j=0;i>=0;i--,j++){
		neg[j]=0;
	    neg[j]+=abs(a[i]);
	}
	/*cout<<id<<endl;
	for(int i=0;i<n;i++){
		cout<<pos[i]<<" "<<neg[i]<<endl;
	}*/
	
	ll ans=1e18;
	
	for(int i=0;i<k;i++){
		if(pos[i]!=-1&&neg[k-i-2]!=-1){
			ans=min(ans,2*pos[i]+neg[k-i-2]);
		    ans=min(ans,pos[i]+2*neg[k-i-2]);
		}
	}
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<map>
#include<bitset>
#include<vector>

using namespace std;

typedef pair<int,int> P;
typedef pair<int,P> PP;

vector<PP> packets;
bitset<50000> infected;

int main(void) {
    while(1) {
        int n,m;
        cin >> n >> m;
        if(!n) break;

        packets.clear();
        infected.reset();
        infected.set(0);

        for(int i=0; i<m; i++) {
            int t,s,d;
            cin >> t >> s >> d;
            s--;d--;
            packets.push_back(PP(t,P(s,d)));
        }

        sort(begin(packets), end(packets));

        for(auto &pk : packets)
            if(infected[pk.second.first])
                infected.set(pk.second.second);

        cout << infected.count() << endl;
    }
    return 0;
}

Measured memory_bytes: 3400
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define prime 1000000007
#define INF 2147483647
int dx8[8]={-1,0,1,1,1,0,-1,-1};
int dy8[8]={1,1,1,0,-1,-1,-1,0};
int dx4[4]={-1,0,1,0};
int dy4[4]={0,-1,0,1};
signed main(void){
    int n;cin>>n;
    vector<int>V(n);rep(i,n)cin>>V[i];
    vector<bool>J(100010,false);
    for(int tmp=0;tmp<(1<<n);tmp++){
        bitset<20>s(tmp);
        int sum=0;
        rep(i,n){
            if(s.test(i))sum+=V[i];
        }
        J[sum]=true;
    }
    int q;cin>>q;
    rep(i,q){
        int x;cin>>x;
        if(J[x])cout<<"yes"<<endl;
        else cout<<"no"<<endl;
    }
}
        



Measured memory_bytes: 3124
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long gcd(long x,long y)
        {
            if (y < x) gcd(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var n = Read();
            var digit = 0;

            var tmp = n;
            while (tmp > 0)
            {
                tmp /= 10;
                digit++;
            }
            var count = new long[digit + 1];
            for (int i = digit; i >= 1; i--)
            {
                count[i] = n / (long)Math.Pow(10, i - 1);
                n -= count[i] * (long)Math.Pow(10, i - 1);
            }
            
            Console.WriteLine(count.Sum() == (digit - 1) * 9 + count[digit] ? count.Sum() : (digit - 1) * 9 + count[digit] - 1);





            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 11220
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    string s,t; cin>>s>>t;
    int sn=s.size(),tn=t.size();
    int ans=inf;
    rep(i,sn-tn+1){
        int cnt=0;
        rep(j,tn){
            if(t[j]!=s[j+i]) cnt++;
        }
        ans=min(ans,cnt);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define pvar(x) clog<<"["<<#x<<":"<<x<<"]\n"
using namespace std;
using ll = long long int;
void solve(){
	ll n,d,count = 0;
	cin>>n>>d;
	ll x,y;
	for(int i=0;i<n;i++){
		cin>>x>>y;
		double t = sqrt(x*x + y*y);
		clog<<t<<endl;
		if(t <= d)++count;
	}
	cout<<count;
}
int main(){
	ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
 t = 1;
  while(t--){
		solve();
	}
}
 


Measured memory_bytes: 3736
from collections import deque, defaultdict as ddic
from itertools import combinations, permutations, product
from heapq import heappush, heappop, heapify
import sys
stdout = sys.stdout
rr = lambda: input().strip()
rri = lambda: int(rr())
rrm = lambda: list(map(int, rr().split()))

from itertools import groupby
def solve(S):
    def f(c):
        return c in 'ACGT'
    ans = 0
    for k, grp in groupby(S, f):
        w = len(list(grp))
        if k:
            ans = max(ans, w)
    return ans

T = 1 #rri()
for tc in range(1, T+1):
    S = rr()
    ans = solve(S)
    print(ans)
    #print("Case #{}: {}".format(tc, ans))


Measured memory_bytes: 3316
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    N, D = map(int, readline().split())
    XY = map(int, read().split())
    count = 0
    for X, Y in zip(XY,XY):
        if D >= (X**2+Y**2)**(1/2):
            count += 1
    print(count)
    return

if __name__ == '__main__':
    main()


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

public class Main {

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

    void solve() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int K = sc.nextInt();
        for (int i = A; i <= B; i++) {

            if (i < A + K || B - K < i) {
                System.out.println(i);
            }
        }
    }

}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
using ll = long long;
using P = pair<ll,ll>;
#define pb push_back
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; }

/*
 string -> int : stoi(S);
 int -> string : to_string(N);
 Sのn文字以降をm文字取り出す : S.substr(n,m)
cout << fixed << setprecision(2) << 3.14 << endl; //3.1

 int: -2,147,483,648 ～ 2,147,483,647 (2×10^9)
 ll: -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 (9×10^18)

*/

int main() {

  ll n, m, count=0, ans=0;
  ll a,b,c,d;
  string s;
 
  cin >> a>>b>>c>>d;

  rep(i,100000){
    c-=b;
    if(c<=0){
      cout << "Yes" << endl;
      break;
    }
    a-=d;
    if(a<=0){
      cout << "No" << endl;
      break;
    }
  }

}

Measured memory_bytes: 3568
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		if(a<b && b<c && a<c) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		scan.close();
	}

}



Measured memory_bytes: 26200
/*
    @uthor: Amit Kumar
    user: CodeChef: dr_virus_ ; Codeforces,Hackerearth,Hakerrank: dr_virus;
*/
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
//#define ln mp::cpp_int;
#define ll long long
#define ld double
#define endl "\n"

const ll mod = 1e9+7;
const ll inf = 1e18;


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
 /* #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif */

    ll t=1;
   // cin>>t;
    while(t--){
        ld x,p=100.0;
        ld r=1.01;
        cin>>x;
        for(auto i=1;i<10000000;i++){
            double t = floor((p*r));
            p = t;
            if(t>=x) {cout<<i<<endl;
            break;}
        }
        
        //your code goes here
    }
    //cerr<<"Time Elapsed: "<<clock()/(double)CLOCKS_PER_SEC<<endl;
    return 0;
}

Measured memory_bytes: 3740
#include<stdio.h>
 
int n,A[50];
 
int solve(int i,int m){
  if( m == 0 )return 1;
  if( i >= n )return 0;
  int res = solve(i + 1,m) || solve(i + 1, m - A[i]);
  return res;
}
 
int main(){
  int q,M,i;
 
  scanf("%d",&n);
  for(i = 0; i < n; i++) scanf("%d",&A[i]);
  scanf("%d", &q);
  for(i = 0; i < q; i++){
    scanf("%d",&M);
    if( solve(0,M))printf("yes\n");
    else printf("no\n");
  }
 
  return 0;
}


Measured memory_bytes: 2108
MOD = 10**9+7
l = input()
n = len(l)
dp = [[0 for _ in range(2)] for _ in range(n+1)]
dp[0][0] = 1
for i in range(1, n+1):
	if l[i-1] == "1":
		dp[i][0] = dp[i-1][0] * 2
		dp[i][0] %= MOD
		dp[i][1] = dp[i-1][0] + dp[i-1][1] * 3
		dp[i][1] %= MOD
	else:
		dp[i][0] = dp[i-1][0]
		dp[i][0] %= MOD
		dp[i][1] = dp[i-1][1] * 3
		dp[i][1] %= MOD
print((dp[n][0]+dp[n][1]) % MOD)

Measured memory_bytes: 21236
l=[]
for i in range(3):
    x,y=map(int,input().split())
    l.append(x)
    l.append(y)
d=[]
d.append(l.count(1))
d.append(l.count(2))
d.append(l.count(3))
d.append(l.count(4))
if(max(d)==3):
    print("NO")
else:
    print('YES')

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


int main(){
    string s;
    cin>>s;
    int i=0;
        if(s[2]==s[3] and s[4]==s[5]){
            cout<<"Yes"<<endl;
            i=1;
        }
    if(i!=1){
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define OUT(x) std::cout << (x) << std::endl
typedef long long ll;

int main() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int cnt1 = 0, cnt2 = 0, ans = 0;
    int left = -1, right = -1;
    bool flag = false;
    for (int i = 1; i < n; i++) {
        if (s[i] == s[i - 1])
            ans++;
        if (s[i] != s[0]) {
            if (flag) {
                right++;
            } else {
                flag = true;
                left = i;
                right = i;
            }
        } else {
            if (flag) {
                cnt2++;
                flag = false;
            }
        }
    }
    if (right == n - 1) {
        cnt1++;
    }
    ans += min(cnt2, k) * 2;
    k -= cnt2;
    if (k > 0)
        ans += min(cnt1, k);
    OUT(ans);
}

Measured memory_bytes: 512
#include<iostream>
#include<stack>
using namespace std;
string s;
stack<string>S;
main()
{
	cin>>s;
	S.push(s.substr(0,1));
	for(int i=1;i<s.size();i++)
	{
		if(S.top()!=s.substr(i,1))
		{
			S.push(s.substr(i,1));
		}
		else
		{
			if(i+1<s.size())
			{
				S.push(s.substr(i,2));
			}
			i++;
		}
	}
	cout<<S.size()<<endl;
}


Measured memory_bytes: 11012
N = int(input())

def dfs(s):
  # 再帰の基底部
  if len(s) > 0 and int(s) > N:
    return 0
  
  # s自体が七五三数なら+1
  ret = 1 if all(s.count(c) > 0 for c in '753') else 0
  
  return ret + sum((dfs(s+c) for c in '753'))

print(dfs(''))

Measured memory_bytes: 9124
import numpy as np

N, K = map(int, input().split())
_3K = 3 * K
_2K = 2 * K
G = np.zeros((_2K, _3K), dtype='int64') # 後から 2K * K に圧縮する
for _ in range(N):
    x, y, c = input().split()
    x, y = int(x), int(y)
    # 2K * 2K の黒の希望に置き換え
    if c == 'B':
        x = x % _2K
        y = y % _2K
    else:
        x = (x + K) % _2K
        y = y % _2K
    # さらに、 2K * K の黒の希望に圧縮する
    if (y >= K) and (x >= K):
        x -= K
        y -= K
    if (y >= K) and (x < K):
        x += K
        y -= K
    # 塗り方は右下がどのマスに来るかの 2K * K 通り
    # → 最終的に 2K * K のグリッドで表すことができる
    # 各希望を満たす塗り方は K * K 通り
    # → 2K * K のグリッド内の希望を満たす K * K マスに 1 を加算すれば、
    #   全希望の加算後には各マス＝各塗り方がいくつの希望を満たすかがわかる
    # K * K マスに 1 を加算するには o(K^2) かかってしまう
    # → いもす法を使う
    # 塗り方を 3K * 2K の範囲で考えて累積和をとった後、 2K * K の範囲に圧縮する
    G[y, x] += 1
    G[y+K, x+K] += 1
    G[y+K, x] -= 1
    G[y, x+K] -= 1

# 3K * 2K の範囲の累積和をとる
G = G.cumsum(axis=1).cumsum(axis=0)
# 2K * K の範囲に圧縮
G = G[:K, :_2K] + G[K:_2K, K:_3K] + np.concatenate((G[:K, _2K:_3K], G[K:_2K, :K]), axis=1)
ans = G.max()
print(ans)

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

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

  int q=x/100;
  int r=x%100;

  int ans=0;
  rep(i,x/100){
    if(q==0)break;
    
    if(r/5>=1)r-=5;
    else if(r/4>=1)r-=4;
    else if(r/3>=1)r-=3;
    else if(r/2>=1)r-=2;
    else if(r>=1)r-=1;

    q--;
		   
    if(r==0){
      ans=1;
      break;
    }
  }
  cout << ans << endl; 
}

Measured memory_bytes: 3644
import static java.lang.System.out;
import java.util.Scanner;
 
public class Main {
      public static void main(String...args) {
                String str = new Scanner(System.in).nextLine();
                String[] list = str.split(" ");
                String x = list[0];
                String y = list[1];
 
                int a = Integer.parseInt(x);
                int b = Integer.parseInt(y);
 
                int sum = a * b;
                int cm = (a + b) * 2;
 
                out.println(sum + " " + cm);
 
      }
 
 
}

Measured memory_bytes: 25868
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

#define INF 10000000

int main()
{
    int n,m,x;
    int a[13][13];
    int c[13];
    
    cin >> n >> m >> x;
    for (int i = 0;i < n;i++){
        cin >> c[i];
        for (int j = 0;j < m;j++){
            cin >> a[i][j];
        }
    }
    
    int boxm[13];
    int many;
    int ans = INF;
    for (int k = 0;k < (1 << 12);k++){
        for (int j = 0;j < m;j++){
            boxm[j] = 0;
        }
        many = 0;
        for (int i = 0;i < n;i++){
            if (k & (1<<i)){
                for (int j = 0;j < m;j++){
                    boxm[j] += a[i][j];
                }
                many += c[i];
            }
        }
        int check = 1;
        for (int j = 0;j < m;j++){
            if (boxm[j] < x){
                check = 0;
            }
        }
        if (check == 1){
            ans = min(ans,many);
        }
    }
    
    if (ans == INF){
        ans = -1;
    }
    cout << ans << endl;
}


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

namespace ABC_C
{
    class C062
    {        

        static long CalcMin(int h, int w)
        {
            long min = long.MaxValue;

            for (int i = 1; i < w; i++)
            {
                long S1 = (long)i * h;
                int cut = h / 2;
                long S2 = (long)(w - i) * cut;
                long S3 = (long)(w - i) * (h - cut);
                long Smax = Math.Max(S1, S3);
                long Smin = Math.Min(S1, S2);
                if (min > Smax - Smin)
                {
                    min = Smax - Smin;
                }
            }
            return min;
        }

        static void Main(string[] args)
        {
            string[] s1 = Console.ReadLine().Split(' ');
            int h = int.Parse(s1[0]);
            int w = int.Parse(s1[1]);

            if (h % 3 == 0 || w % 3 == 0)
            {
                Console.WriteLine(0);
            }
            else
            {
                long m1 = CalcMin(w, h);
                long m2 = CalcMin(h, w);

                long m3 = Math.Min(h, w); //平行切り


                long min =Math.Min( Math.Min(m1, m2),m3);

                Console.WriteLine(min);
            }
        }
    }
}


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

int bubbleSort(int a[],int n){
  int flag=1,sum=0;
  while(flag){
    flag=0;
    for(int j=n-1;j>=1;j--){
      if(a[j]<a[j-1]){
	int tmp=a[j];
	a[j]=a[j-1];
	a[j-1]=tmp;
	flag=1; sum++;
      }
    }
  }
  return sum;
}

int main(){
  int n,a[100];

  cin>>n;
  for(int i=0;i<n;i++)
    cin>>a[i];

  int sum=bubbleSort(a,n);
  
  for(int i=0;i<n-1;i++)
    cout<<a[i]<<" ";
  cout<<a[n-1]<<endl;;
  cout<<sum<<endl;
}


Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int a,b;
    cin>>a>>b;
    int ans;
    if(a>=13){
        ans=b;
    }else if(a>=6){
        ans=b/2;
    }else{
        ans=0;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;


int main() {
    
    ll n,k;
    cin >> n >> k;
    vector <ll> h;
    for (ll i=0;i<n;i++){
        ll tmp;
        cin >> tmp;
        h.push_back(tmp);
    }
    sort(h.begin(), h.end());
    ll idx = max(ll(0), n-k);
    ll ans = 0;
    for (ll i=0;i<idx;i++){
       ans += h[i]; 
    }
    cout << ans << endl;
}

Measured memory_bytes: 2420
n = int(input())
A = list(map(int,input().split()))

ans = float("inf")

for ii in [1, -1]:
    i = ii
    s = 0
    ans0 = 0
    for j in range(n):
        s += A[j]
        if s * i <= 0:
            ans0 += abs(s - i)
            s = i
        i = -i

    ans = min(ans, ans0)

print(ans)

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

int max(int a,int b){
  return a>b ? a : b;
}

int main(){
  int n,a[100],i,j,sum=0;
  
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  
  for(i=0;i<n;i++)
    for(j=i+1;j<n;j++)
      sum += a[i]*a[j];
  
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 4005
using namespace std;
typedef long long LL;
const int P=998244353;
int red[N],blue[N],F[N][N],n,ans;char s[N];
int main(){
	scanf("%s",s+1);n=strlen(s+1);
	for (int i=1;i<=2*n;i++){
		int &t1=red[i],&t2=blue[i];
		for (int j=min(i,n);j;j--){
			if (s[j]=='0') t1+=2;
			if (s[j]=='1') t1++,t2++;
			if (s[j]=='2') t2+=2;
			t1=min(t1,i-j+1);
			t2=min(t2,i-j+1);
		}
	}
	F[0][0]=1;
	for (int i=1;i<=2*n;i++)
		for (int j=max(0,i-blue[i]);j<=red[i];j++){
			F[i][j]=F[i-1][j];
			if (j>0){
				if ((F[i][j]+=F[i-1][j-1])>=P)
					F[i][j]-=P;
			}
			if (i==2*n){
				if ((ans+=F[i][j])>=P)
					ans-=P;
			}
		}
	printf("%d\n",ans);
}

Measured memory_bytes: 60544
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n)       for(int i=(int)m; i<(int)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define prt(var)         cout << var << endl
#define prtd(n, var)     cout << fixed << setprecision(n) << var << endl
#define prt2(var1, var2) cout << var1 << " " << var2 << endl
#define prseq(var, n)    rep(i,n){cout << var[i] << " ";} cout << endl
#define prseql(var, n)   rep(i,n){cout << var[i] << " " << endl;}

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

int main(void) {
  int n;
  cin >> n;

  ll ans=0;
  rep(i,n-1){
    ans += i+1;
  }

  prt(ans);

}


Measured memory_bytes: 384
package main

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

// ベクトルと行列の積
func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	nm := strings.Split(sc.Text(), " ")
	n, _ := strconv.Atoi(nm[0])
	m, _ := strconv.Atoi(nm[1])
	A := make([][]int, n)
	b := make([]int, m)
	for i := 0; i < n; i++ {
		sc.Scan()
		ary := strings.Split(sc.Text(), " ")
		val := make([]int, m)
		for j := 0; j < m; j++ {
			num, _ := strconv.Atoi(ary[j])
			val[j] = num
		}
		A[i] = val
	}
	for i := 0; i < m; i++ {
		sc.Scan()
		num, _ := strconv.Atoi(sc.Text())
		b[i] = num
	}

	s := ""
	for _, ary := range A {
		sum := 0
		for j, v := range ary {
			sum += v * b[j]
		}
		s += fmt.Sprintf("%v\n", sum)
	}
	fmt.Print(s)
}



Measured memory_bytes: 1548
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <ctype.h>

#define lli long long int

int main(void)
{
	lli n;
	scanf("%lld",&n);
	
	lli *h;
	h = (lli *)malloc(sizeof(lli)*(n));
	lli i = 0;
	while (i < n)
	{
		scanf("%lld",&h[i]);
		i++;
	}
	i = 0;
	lli max = 0;
	lli tmp_step = 0;
	while (i < n-1)
	{
		if(h[i] < h[i+1])
		{
			if(max < tmp_step)
			{
				max = tmp_step;
			}
			tmp_step = 0;
		}
		else
		{
			tmp_step++;
			if(max < tmp_step)
			{
				max = tmp_step;
			}
		}
		//printf("max:%lld, tmp:%lld\n",max,tmp_step);
		i++;
	}
	printf("%lld\n",max);
	return(0);
}


Measured memory_bytes: 896
def solve(Mi,i):
	if Mi == 0: return True
	if i < n and min(A[i:]) <= Mi <= sum(A[i:]):
		r1 = solve(Mi-A[i],i+1)
		r2 = solve(Mi,i+1)
		if r1: return r1
		if r2: return r2
n = input()
A = map(int,raw_input().split())
q = input()
M = map(int,raw_input().split())
for Mi in M:
	print "yes" if solve(Mi,0) else "no"

Measured memory_bytes: 4232
#include<bits/stdc++.h>
using namespace std;
#include<cstdio>
#define el "\n"
#define sp " "
typedef long long ll;



main()
{
	ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll x,y,a,b,c;
cin>>x>>y>>a>>b>>c;
vector<ll> r(a),g(b),co(c),f;
for(ll i=0;i<a;i++)
cin>>r[i];
for(ll i=0;i<b;i++)
cin>>g[i];
for(ll i=0;i<c;i++)
cin>>co[i];
sort(r.begin(),r.end(),greater<ll> () );
sort(g.begin(),g.end(),greater<ll> () );
sort(co.begin(),co.end(),greater<ll> () );
for(ll i=0;i<x;i++)
f.push_back(r[i]);
for(ll i=0;i<y;i++)
f.push_back(g[i]);
for(ll i=0;i<c;i++)
f.push_back(co[i]);
sort(f.begin(),f.end(),greater<ll> () );
ll ans=0;
for(ll i=0;i<x+y;i++)
ans+=f[i];
cout<<ans;

}

Measured memory_bytes: 8944
function Main(s){
  var n = +s;
  var ans = [0];
  var a6 = [1];
  var a9 = [1];
  for(var i = 1; i <= n; i++){
    a6[i] = a6[i-1] * 6;
    if(a6[i] > n)break;
  }
  for(i = 1; i <= n; i++){
    a9[i] = a9[i-1] * 9;
    if(a9[i] > n)break;
  }
  for(i = 1; i <= n; i++){
    ans[i] = ans[i-1] + 1;
    for(var j = 1; j < a6.length;j++){
      if(i < a6[j])break;
      ans[i] = Math.min(ans[i], ans[i-a6[j]] + 1);
    }
    for(j = 1; j < a9.length;j++){
      if(i < a9[j])break;
      ans[i] = Math.min(ans[i], ans[i-a9[j]] + 1);
    }
  }
  console.log(ans[n]);
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 9420
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var obj={};
for(var i=0;i<Arr.length;i++){
   var arr=Arr[i].split(" ");
   var a=arr[0];
   var b=arr[1];
   if(a in obj){obj[a]+=(" "+b);}
   else{obj[a]=b;}
}
var keys=[];
for(var k in obj){
   keys.push(k);
   obj[k]=obj[k].split(" ").map(Number).sort(function(a,b){return a-b;}).join(" ");
}
keys.sort();
for(var i=0;i<keys.length;i++){
   console.log(keys[i]+"\n"+obj[keys[i]]);
}

Measured memory_bytes: 8568
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main()
{
  int n,T,min = 1000,count = 0;
  cin >> n >> T;
  
  vector<long long int> c(n);
  vector<long long int> t(n);
  for(int i = 0; i < n; i++)
  {
    cin >> c[i] >> t[i];
  }
  
  for(int i = 0; i < n; i++)
  {
    if(t[i] <= T)
    {
      if(c[i] < min)
      {
        min = c[i];
      }
    }
    else
    {
      count++;
    }
  }
  if(count == n)
  {
    cout << "TLE";
  }
  else
  {
    cout << min;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int t,v[100005],sol,n,x;
int main()
{
    cin>>n;
    for(int i=1;i<=n;++i)
    {
        cin>>x;
        ++v[x];
    }
    for(int i=1;i<100000;++i)
    {
        t=v[i-1]+v[i]+v[i+1];
        if(t>sol) sol=t;
    }
    cout<<sol;
    return 0;
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;

  int start = 0, end = N;
  for (int i = 0; i < N; i++)
    if (S[i] == '.')
      start++;
    else
      break;
  for (int i = N - 1; i >= 0; i--)
    if (S[i] == '#')
      end--;
    else
      break;

  vector<int> stone(end - start, '#');

  int change = 0;
  for (int i = start; i < end; i++)
    if (S[i] != '#')
      change++;
  int ans = change;
  for (int i = start; i < end; i++) {
    if (S[i] == '.')
      change--;
    else
      change++;
    ans = min(change, ans);
  }

  cout << ans << endl;
}


Measured memory_bytes: 1412
#include<map>
#include<string>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<set>
#include<vector>
#include<cmath>
#include<queue>
using namespace std;
int gcd(int x, int y)
{
	if (y != 0)return gcd(y, x%y);
	else return x;
}


int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	int a1, a2, a3;
	scanf("%d %d %d", &a1, &a2, &a3);
	int n = 0;
	n = abs(a2 - a1) + abs(a3 - a2);
	int k;
	k = abs(a3 - a1) + abs(a2 - a3);
	if (n > k)n = k;
	k = abs(a1 - a2) + abs(a3 - a1);
	if (n > k)n = k;
	k = abs(a3 - a2) + abs(a3 - a1);
	if (n > k)n = k;
	k = abs(a2 - a3) + abs(a1 - a2);
	if (n > k)n = k;
	k = abs(a1 - a3) + abs(a2 - a1);
	if (n > k)n = k;
	printf("%d", n);
	
		
	
}

Measured memory_bytes: 256
N = int(input())
List = list(map(int, input().split()))
res = 0
List.sort()
K = List[N-1]+1
Flag = [1]*K
for i in range(N):
  if Flag[List[i]] ==1:
    res +=1
    for j in range(List[i],K,List[i]):
      Flag[j] = 0
    if i != N-1 and List[i] == List[i+1]:
      res += -1
print(res)

Measured memory_bytes: 33124
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int N;
  cin >> N;
  REP(i, 1, 10) {
    if(N % i == 0 && N / i < 10) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn=500010, inf=1e9;
int n, x;
int v[23][maxn], zy[23][maxn], pre[23];
ll ans;

template<typename T>
inline void read(T &k)
{
	int f=1; k=0; char c=getchar();
	while(c<'0' || c>'9') c=='-'&&(f=-1), c=getchar();
	while(c<='9' && c>='0') k=k*10+c-'0', c=getchar();
	k*=f;	
}
 
int main()
{
	read(n);
	for(int i=1;i<=n;i++)
	{
		read(x);
		for(int j=0;j<21;j++)
		if(x&(1<<j)) v[j][i]=1;
	}
	for(int i=1;i<=n;i++)
	{
		int tmp=0;
		for(int j=0;j<21;j++)
		if(v[j][i]) tmp=max(tmp, zy[j][i]=pre[j]), pre[j]=i;
		else tmp=max(tmp, zy[j][pre[j]]);
		ans+=i-tmp;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 78976
#include"bits/stdc++.h"
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
const int inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<P,int>PP;
int gcd(int a, int b) {
	if (!b)return a; return gcd(b, a%b);
}
signed main() {
	int a, b; cin >> a >> b;
	cout << a*b / gcd(a, b) << endl;
}

Measured memory_bytes: 256
/*
██╗  ██╗ █████╗ ██████╗ ███████╗███████╗███╗   ███╗        ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝██╔══██╗██╔══██╗██╔════╝██╔════╝████╗ ████║        ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝ ███████║██████╔╝█████╗  █████╗  ██╔████╔██║        █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗ ██╔══██║██╔══██╗██╔══╝  ██╔══╝  ██║╚██╔╝██║        ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██║  ██║██║  ██║███████╗███████╗██║ ╚═╝ ██║███████╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
Believe in yourself ,( try and try and then try ), You can do it
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define clr(arr, x) memset(arr, x, sizeof arr)
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define OO 0x3f3f3f3f3f3f3f3fLL
const int oo = 0x3f3f3f3f, Mod = 1e9 + 7;
using namespace std;
typedef long long ll;
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
void K_K(){
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
int n;
vector<int>arr;
ll dp[3005][3005][2];
ll sol(int i, int j, int turn){
	if (i > j)
		return 0;
	ll &ret = dp[i][j][turn];
	if (~ret)
		return ret;
	if (!turn){
		ll ch1 = sol(i + 1, j, !turn) + arr[i];
		ll ch2 = sol(i, j - 1, !turn) + arr[j];
		return ret = max(ch1, ch2);
	}
	else{
		ll ch1 = sol(i + 1, j, !turn) - arr[i];
		ll ch2 = sol(i, j - 1, !turn) - arr[j];
		return ret = min(ch1, ch2);
	}
}
int main(){
	K_K();
	cin >> n;
	arr.resize(n);
	clr(dp, -1);
	for (auto &it : arr)
		cin >> it;
	cout << sol(0, n - 1, 0);
}

Measured memory_bytes: 144884
#include <bits/stdc++.h>
#define CHECK cout << "ok" << endl
#define finish(x) return cout << x << endl, 0
typedef long long ll;
typedef long double ldb;
const int md = 1e9 + 7;
const ll inf = 1e18;
const int OO = 1;
const int OOO = 1;
using namespace std;

int h, w, n;
int sr, sc;
string s, t;

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	cin >> h >> w >> n >> sr >> sc >> s >> t;
	int pos;
	pos = sr;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'U') pos--;
		if (pos < 1) finish("NO");
		if (t[i] == 'D' && pos < h) pos++;
	}
	pos = sr;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'D') pos++;
		if (pos > h) finish("NO");
		if (t[i] == 'U' && pos > 1) pos--;
	}
	pos = sc;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'L') pos--;
		if (pos < 1) finish("NO");
		if (t[i] == 'R' && pos < w) pos++;
	}
	pos = sc;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'R') pos++;
		if (pos > w) finish("NO");
		if (t[i] == 'L' && pos > 1) pos--;
	}
	finish("YES");
}

Measured memory_bytes: 920
#include <cstdio>
main(){int n;while(scanf("%d", &n), n){int t, m = 0, p, a, b;for(;n;n--){scanf("%d%d%d",&p,&a,&b);if(a+b>m)t=p,m=a+b;}printf("%d %d\n",t,m);}}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define mods 1000000007
#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef long long int lint;
typedef unsigned long long int ulint;
 
lint n,k,dizi[120],dp[100020];
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    lint i,j,l,il;
    cin>>n>>k;
    for(i=0;i<n;i++){
        cin>>dizi[i];
        }
    sort(dizi,dizi+n);
    dp[0]=-1;
    for(i=1;i<=k;i++){
        for(j=0;dizi[j]<=i && j<n;j++){
            if(dp[i-dizi[j]]==-1){
                dp[i]=1;
                break;
                }
            }
        if(dp[i]!=1) dp[i]=-1;
        }
   // for(i=0;i<=k;i++) cout<<dp[i]<<" ";
    //cout<<endl;
    if(dp[k]==1) cout<<"First";
    else cout<<"Second";
    return 0;
}

Measured memory_bytes: 1024