akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, A[N], B[N], M[N];
bool Solve(int md)
{
    for (int i = 1; i <= n + n - 1; i++)
        B[i] = (A[i] >= md);
    B[0] = B[n + n] = -1;
    memset(M, 0, sizeof(M));
    for (int i = 1; i <= n + n - 1; i++)
        if (B[i] == B[i - 1] || B[i] == B[i + 1])
            M[i] = 1;
    if (M[n])
        return (B[n]);
    int l = n, r = l;
    while (l && !M[l]) l --;
    while (r < n + n && !M[r]) r ++;
    if (l == 0 && r == n + n)
        return (B[1]);
    if (((r - l) & 1) && n - l > r - n)
        return (B[l + 1]);
    if ((r - l) & 1)
        return (B[r - 1]);
    return (!B[l + 1]);
}
int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n + n - 1; i++)
        scanf("%d", &A[i]);
    int le = 1, ri = n + n, md;
    while (ri - le > 1)
    {
        md = (le + ri) >> 1;
        if (Solve(md))
            le = md;
        else
            ri = md;
    }
    return !printf("%d\n", le);
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,D,X;
  cin>>N;
  cin>>D>>X;
  vector<int> a(N);
   for(int i=0;i<N;i++)
     cin>>a.at(i);
  int count_outside=0;
  for(int i=0;i<N;i++){
    int count_inside=0,j=0;
    while(j*a.at(i)+1<=D){
      j++;
      count_inside++;
    }
    count_outside+=count_inside;
  }
  cout<<count_outside+X<<endl;
}

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

using namespace std;
using ll = long long int;
constexpr ll M = 1e9 + 7;
inline ll sum_1(const ll n) { return ((n * (n + 1)) / 2) % M; }
inline ll sum_2(const ll n) { return ((n * (n + 1) * (2 * n + 1)) / 6) % M; }
inline ll sum_3(const ll n) { return (((n * (n + 1)) / 2) % M * ((n * (n + 1)) / 2) % M) % M; }
inline ll sum_1(const ll i, const ll j) { return (sum_1(j) - sum_1(i - 1) + M) % M; }
inline ll sum_2(const ll i, const ll j) { return (sum_2(j) - sum_2(i - 1) + M) % M; }
inline ll sum_3(const ll i, const ll j) { return (sum_3(j) - sum_3(i - 1) + M) % M; }

ll pow_f(ll b, ll e) {
    ll ans = 1;
    b = b % M;
    while (e) {
        if (e&1) {
            ans = (ans * b) % M;
        }
        b = (b * b) % M;
        e >>= 1;
    }
    return ans;
}

ll nCr(ll n, ll r) {
    if (r > n || n < 0 || r < 0) { return 0; }
    if (n == r || r == 0) { return 1; }
    r = min(r, n-r);
    ll ans = 1;
    for (ll i = 1; i <= r; ++i) {
        ans = (ans * (n-i+1))/(i); 
    }
    return ans;
}

ll nCr(tuple<ll,ll> t) {
    auto n = get<0>(t);
    auto k = get<1>(t);
    return nCr(n+k-1, k);
}

template<typename T>
void print(T v) {
    cout << v << " ";
}

template<typename T>
void print(vector<T> v) {
    for (auto &i : v) {
        print(i);
    }
    cout << endl;
}

void solve() {
    ll n, m, x;
    cin >> n >> m >> x;
    vector<ll> c(n, 0);
    vector<vector<ll>> a(n, vector<ll>(m, 0));

    for (ll i = 0; i < n; ++i) {
        cin >> c[i];
        for (ll j = 0; j < m; ++j) {
            cin >> a[i][j];
        }
    }
    
    ll minCost = LLONG_MAX;

    for (ll i = 0; i < (1LL<<n); ++i) {
        ll cost = 0;
        vector<ll> know(m, 0);
        for (ll it = 0; it < n; ++it) {
            if (i&(1LL<<it)) {
                cost += c[it];
                for (ll j = 0; j < m; ++j) {
                    know[j] += a[it][j];
                }
            }
        }
        bool isValid = true;
        for (ll j = 0; j < m; ++j) {
            if (know[j] < x) {
                isValid = false;
                break;
            }
        }
        if (isValid) {
            minCost = min(minCost, cost);
        }
    }

    if (minCost == LLONG_MAX) {
        cout << "-1" << endl;
    } else {
        cout << minCost << endl;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifdef D_LOCAL
        freopen("in.in", "r", stdin);
        freopen("out.out", "w", stdout);
    #endif

    solve();

    return 0;
}

Measured memory_bytes: 3652
'use strict'
function main(input) {
  input = input.trim().split(' ').map(v => Number(v))
  let area = (input[0] * input[1] / 2).toFixed(6) + ' '
  area += (input[0] / 2 === input[2] && input[1] / 2 === input[3]) ? 1 : 0
  console.log(area);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(long long &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    my_putchar_unlocked(c[i]);
  }
}
long long N;
char res[1000];
int main(){
  int i;
  long long len;
  long long p = 1;
  rd(N);N += (-1);
  for(len=(1);len<(100);len++){
    p *= 26;
    if(N >= p){
      N -= p;
      continue;
    }
    break;
  }
  for(i=(0);i<(len);i++){
    res[len-1-i] = N%26 + 'a';
    N /= 26;
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200509-1

// --- original code ---
// ll N;
// char res[1000];
// {
//   ll len, p = 1;
//   rd(N--);
//   
//   rep(len,1,100){
//     p *= 26;
//     if(N >= p) N -= p, continue;
//     break;
//   }
// 
//   rep(i,len) res[len-1-i] = N%26 + 'a', N /= 26;
//   wt(res);
// }


Measured memory_bytes: 3636
import sys
import math as mt
import collections as cc
import sys
import itertools as it
input=sys.stdin.readline
I=lambda:list(map(int,input().split()))
fact=[1]
N=10**6+1
inv=[1]
mod=10**9+7
def iv(n):
	return pow(n,mod-2,mod)%mod
for i in range(2,N):
	fact.append((fact[-1]*i)%mod)
	inv.append(iv(fact[-1]))
def ncr(n,r):
	return (fact[n-1]*inv[n-r-1]*inv[r-1])%mod
n,=I()
tot=pow(10,n,mod)
m1=1
for i in range(1,n):
	m1+=pow(8,n-i,mod)*(ncr(n,i))
m2=m1
m3=pow(8,n,mod)
print((tot-(m1+m2+m3))%mod)

Measured memory_bytes: 162908
#include<bits/stdc++.h>
using namespace std ;
vector< string > v ;
int main(){
    string s = "AKIHABARA" ;
    for( int a = 0 ; a < 2 ; a++ )
        for( int b = 0 ; b < 2 ; b++ )
            for( int c = 0 ; c < 2 ; c++ )
             for( int d = 0 ; d < 2 ; d++ ){
                 string s0 = "" ;
                 for( int e = 0 ; e < 9 ; e++ ){
                     if ( a == 0 && e == 0 ) continue ;
                     if ( b == 0 && e == 4 ) continue ;
                     if ( c == 0 && e == 6 ) continue ;
                     if ( d == 0 && e == 8 ) continue ;
                     s0 += s[e] ;
                 }
                 v.push_back( s0 ) ;
             }
    cin >> s ;
    bool flag = false ;
    for( int i = 0 ; i < v.size() ; i++ )
        if ( s == v[i] ) flag = true ;
    if ( flag ) cout << "YES" << endl ;
    else cout << "NO" << endl ;
    return 0 ;
}


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

int main() {
  int N;
  vector<int> lens;
  int now;
  int count=1;
  
  cin >> N;
  lens = vector<int>(N);
  for (int i=0;i<N;i++) cin >> lens.at(i);
  
  sort(lens.begin(),lens.end(),greater<int>());
  now = lens.at(0);
  for (int i=1;i<N;i++) {
    if (lens.at(i) < now) {
      now = lens.at(i);
      count++;
    }
  }
  
  cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
int main() { 
 	int A,B,C,D;
	 cin >> A >> B >> C >> D;
	if (A+B > C+D){
		cout << "Left" <<endl;
	}
	else if(A+B < C+D){
			cout <<"Right" <<endl;
		}
	else{
		cout << "Balanced" <<endl;
	}		
	return 0;
		
	}

Measured memory_bytes: 256
n=int(input())
S=list(i for i in range(1, 14))
H=list(i for i in range(1, 14))
C=list(i for i in range(1, 14))
D=list(i for i in range(1, 14))

for i in range(n) :
    x,y=map(str,input().split())
    
    if x=="S":
        S.remove(int(y))
    elif x=="H":
        H.remove(int(y))
    elif x=="C":
        C.remove(int(y))
    else:
        D.remove(int(y))
        
if len(S)>0:
    for i in range(len(S)):
        print(f'S {S[i]}')
if len(H)>0:
    for i in range(len(H)):
        print(f'H {H[i]}')
if len(C)>0:
    for i in range(len(C)):
        print(f'C {C[i]}')
if len(D)>0:
    for i in range(len(D)):
        print(f'D {D[i]}')


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

public class Main {

    public static void main(String[] args) {
	// write your code here

        Scanner scan = new Scanner(System.in);
        double N = scan.nextInt();
        double X = scan.nextInt();
       double T = scan.nextInt();
double p=Math.ceil(N/X)*T;
System.out.println((int)p);
    }
}


Measured memory_bytes: 27056
#include <bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define rmin(r, x) r = min(r, x);
#define rmax(r, x) r = max(r, x);
#define ends ' '
#define endl '\n'
#define fastio ios_base::sync_with_stdio(0), cin.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int maxn = 1e6 + 10;
const int maxa = 1e6 + 10;

int n, a[maxn], c[maxa], p[maxa];
vector<ll> prime;

void era(void) {
    for(ll i = 2; i < maxa; ++i) if(!p[i]) {
        prime.eb(i);
        for(ll j = i * i; j < maxa; j += i)   p[j] = 1;
    }
}

int main(void) {
    fastio;
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        cin >> a[i];
        ++c[a[i]];
    }
    int g = a[1];
    for(int i = 2; i <= n; ++i) g = __gcd(g, a[i]);

    bool valid = true;
    for(int i = 2; i < maxa; ++i)   valid &= (c[i] <= 1);

    if(g != 1) {
        cout << "not coprime";
        return 0;
    }
    if(!valid) {
        cout << "setwise coprime";
        return 0;
    }

    era();
    valid = true;
    memset(c, 0, sizeof(c));
    for(int i = 1; i <= n; ++i) {
        // if(!p[a[i]]) {
        //     ++c[a[i]];
        //     continue;
        // }
        for(auto x : prime) {
            if(x * x > a[i])    break;
            if(a[i] % x == 0) {
                valid &= !c[x];
                ++c[x];
                while(a[i] % x == 0)    a[i] /= x;
            }
        }
        if(a[i] != 1) {
            valid &= !c[a[i]];
            ++c[a[i]];    
        }
    }
    cout << (valid ? "pairwise coprime" : "setwise coprime");
    return 0;
}


Measured memory_bytes: 15896
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
  string s; cin >> s;
  int ans = 0;
  REP(i, s.length()) {
    if (s[i] == '+') ans++;
    else ans--;
  }
  cout << ans << endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600
#define long long long // for codeforces

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

  vector<vector<int>> dp(n+1, vector<int>(m+1, 0));
  rep(i,n+1)rep(j,m+1) if( (i<n && s[i]=='I') || (j<m && t[j]=='I') ) dp[i][j]=1;

  for(int i=n; i>=0; i--){
    for(int j=m; j>=0; j--){
      if(i+1<n && s[i]=='I' && s[i+1]=='O' && dp[i+2][j]>0) dp[i][j] = max(dp[i][j], dp[i+2][j]+2);
      if(j+1<m && t[j]=='I' && t[j+1]=='O' && dp[i][j+2]>0) dp[i][j] = max(dp[i][j], dp[i][j+2]+2);
      if(i<n && j<m && dp[i+1][j+1]>0){
        if(s[i]=='I' && t[j]=='O') dp[i][j] = max(dp[i][j], dp[i+1][j+1]+2);
        if(s[i]=='O' && t[j]=='I') dp[i][j] = max(dp[i][j], dp[i+1][j+1]+2);
      }
    }
  }

  int res = 0;
  rep(i,n+1)rep(j,m+1) res = max(res, dp[i][j]);
  cout << res << endl;

  return 0;
}

Measured memory_bytes: 18748
/*
10 4
*/
#include <bits/stdc++.h>
using namespace std;
void print() { cout << '\n'; } template<class T, class ...U> void print(T x, U ...y) { cout << x << ' '; print(y...); }
typedef long long ll; const int N = 2e5 + 5, M = 1e9 + 7; typedef vector<int> vi; typedef vector<vi> vii; void Main();
int main(int argc, char **argv) {
  ios::sync_with_stdio(0), cin.tie(0); cout << setprecision(10) << fixed;
  #ifdef Zmm
  freopen((string(*(argv)).substr(2, string(*(argv)).size() - 6) + string(".cpp")).c_str(), "r", stdin); string x; cin >> x;
  #endif
  Main();
}

void Main() {
  int H, A;
  cin >> H >> A;
  cout << (H + A - 1) / A << '\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;


int main(){
int N,D,X;
cin >> N ;
cin >> D >> X;
vector<int> A(N);
for(int i = 0; i < N; i++){
    cin >> A[i];
}
int choco = N;
for(int i = 0; i < N; i++){
    choco += (D - 1) / A[i];
}
cout << choco + X << endl;
}


Measured memory_bytes: 384
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0){
            System.out.println("Possible");
            return;
        }
            System.out.println("Impossible");
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define KOZYUN(a) sort(all(a),greater<int>())
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define IN(a) cin >> a
#define INT(a) int a; cin >> a
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    INT(n);
    VI a(n);
    VVI x(n),y(n);
    rep(i,n){
        cin >> a[i];
        x[i].resize(a[i]);
        y[i].resize(a[i]);
        rep(j,a[i]){
            cin >> x[i][j] >> y[i][j];
            x[i][j]--;
        }
    }

    int ma = -1;
    rep(i,(1 << n)){
        bool flag = true;
        rep(j,n){
            if(!(i&(1<<j))) continue;
            rep(k,a[j]) if(((i >> x[j][k]) & 1) ^ y[j][k]) flag = false;
        }
        int cnt = 0;
        rep(j,n) if((i>>j)&1) cnt++;
        if(flag) ma = max(cnt,ma);
    }
    OUT(ma);

    return 0;
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=list(map(int,input().split()))
    ans=l[0]
    # 数列の値が増えてたらその分を追加で足す必要がある
    # 減ってたら前の花を育ててる途中で水やり完了してる
    for i in range(len(l)-1):
        ans+=max(l[i+1]-l[i],0)
    print(ans)
resolve()

Measured memory_bytes: 38384
/*
  AOJ 1188
  Title:Hierarchical Democracy
  @kankichi573
*/
#include <stdio.h>
#include <string.h>

#define max(x,y) (((x)>(y))?(x):(y))
#define min(x,y) (((x)<(y))?(x):(y))

int compare(const void *a, const void *b)
{
  return *(int *)a - *(int *)b;
}


int solve(char s[],int len)
{
  int i,cnt,lv,ret,st;
  int kahan[3333];
  /*
  for(i=0;i<len;i++)
    printf("%c",s[i]);
  printf("\n");
  */
  if(isdigit(s[1]))
    return(atoi(&s[1])/2+1);
  lv=cnt=0;
  st=1;
  for(i=1;i<len-1;i++)
    {
      if(s[i]=='[')
	lv++;
      if(s[i]==']')
	lv--;
      if(lv==0)
	{
	  kahan[cnt]=solve(s+st,i-st+1);
	  cnt++;
	  st=i+1;
	}
    }
  qsort(kahan,cnt,sizeof(int),compare);
  for(i=ret=0;i<cnt/2+1;i++)
    ret+=kahan[i];
  return(ret);
}


main()
{
  int n,i,ret;
  char senkyoku[10001];

  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%s",senkyoku);
      ret=solve(senkyoku,strlen(senkyoku));
      printf("%d\n",ret);
    }
  return(0);
}

Measured memory_bytes: 712
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        int H = in.nextInt();
        int W = in.nextInt();
        long[][] c = new long[10][10];
        for (int i=0;i<10;i++) {
            for (int j=0;j<10;j++) {
                c[i][j] = in.nextInt();
            }
        }
        int[] cnt = new int[10];
        for (int i=0;i<H;i++) {
            for (int j=0;j<W;j++) {
                int a = in.nextInt();
                if (a!=-1) {
                    cnt[a]++;
                }
            }
        }

        for (int i=0;i<10;i++) {
            for (int k=0;k<10;k++) {
                for (int j=0;j<10;j++) {
                    c[i][j] = Math.min(c[i][j], c[i][k]+c[k][j]);
                }
            }
        }
        for (int i=0;i<10;i++) {
            for (int k=0;k<10;k++) {
                for (int j=0;j<10;j++) {
                    c[i][j] = Math.min(c[i][j], c[i][k]+c[k][j]);
                }
            }
        }
        long ans = 0L;
        for (int i=0;i<10;i++) {
            ans += cnt[i]*c[i][1];
        }
        // System.out.println(Arrays.toString(cnt));
        // System.out.println(Arrays.deepToString(c));
        out.println(ans);
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

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

    }
}


Measured memory_bytes: 27220
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int p[110],v[110];
int dp[10010];
int main()
{
	int n,W;
	memset(dp,0,sizeof(dp));
	cin>>n>>W;
	for(int i=0;i<n;i++)
	{
		cin>>p[i]>>v[i];
	}
	for(int i=0;i<n;i++)
	{
		for(int j=W;j>=v[i];j--)
		{
			dp[j]=max(dp[j],dp[j-v[i]]+p[i]);
		}
	}
	cout<<dp[W]<<endl;
	return 0;
}



Measured memory_bytes: 3152
S = input()
T = input()
ans = "AAAA"
flag = 1
str_list = []
for i in range(len(S)-len(T)+1):
    # print(S[i:i+len(T)],T)
    cur_s = ""
    for j in range(len(T)):
        if S[i+j] == T[j] or S[i+j] == "?":
            cur_s += T[j]
    if cur_s == T:
        flag = 0
        cur_s = S[:i]+T+S[i+len(T):]
        str_list.append(cur_s)

if flag:
    print('UNRESTORABLE')
    exit()

print(min(str_list).replace("?","a"))

Measured memory_bytes: 3064
// https://atcoder.jp/contests/abc153/tasks/abc153_c
//
#![allow(unused_imports)]
use std::io::*;
use std::io::Write;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, [ next / $t:tt ]) => {
        {
            let len = read_value!($iter, usize);
            (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, switch) => {
        {
            let ty = read_value!($iter, i32);
            if ty == 1 {
                vec![ty, read_value!($iter, i32), read_value!($iter, i32)]
            } else if ty == 2 {
                vec![ty, read_value!($iter, i32)]
            } else {
                vec![ty, read_value!($iter, i32)]
            }
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! ifv {
    ($t:expr, $a:expr, $b: expr) => {
        if $t { $a } else { $b }
    }
}

#[allow(unused_macros)]
macro_rules! fill {
    ($t:expr, $v:expr) => {
        for i in 0..$t.len() {
            $t[i] = $v;
        }
    };
}

#[allow(unused_macros)]
macro_rules! join {
    ($t:expr, $glue:expr) => {
        $t.into_iter().map(|w| w.to_string()).collect::<Vec<_>>().join($glue)
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

// ===

fn main() {
    input! {
        n: usize, k: usize,
        mut h: [i64; n]
    };
    h.sort();
    let total = h.iter().take(n-min(n,k)).fold(0i64, |a,c| a+c);
    println!("{}", total);
}


Measured memory_bytes: 9464
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

func debug(a ...interface{}) {
	if os.Getenv("ONLINE_JUDGE") == "false" {
		fmt.Fprintln(os.Stderr, a...)
	}
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	x := make([]int, n)
	y := make([]int, n)
	for i := 0; i < n; i++ {
		x[i], y[i] = scanInt(), scanInt()
	}

	ans := 0

	ma := 0
	mi := 1 << 60
	for i := 0; i < n; i++ {
		ma = max(ma, x[i]+y[i])
		mi = min(mi, x[i]+y[i])
	}
	ans = ma - mi
	ma = -1 << 60
	mi = 1 << 60
	for i := 0; i < n; i++ {
		ma = max(ma, x[i]-y[i])
		mi = min(mi, x[i]-y[i])
	}
	ans = max(ans, ma-mi)
	fmt.Fprintln(wr, ans)
}

type pair struct{ a, b int }


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

#define ll long long

const int MaxN(100003);
ll a[MaxN], K, ans;
int n, m;

struct node_t
{
	ll c, d;
}b[MaxN];

ll dfs(int u, ll res)
{
	if(u > m)
		return 0;
	if((res | b[u].c) > K)
		return dfs(u + 1, res) + (n - b[u].d) * b[u].c;
	ll tmp = 0;
	for(int i = u + 1; i <= m; i++)
		tmp += b[i].c * b[i].d;
	return max(tmp + (n - b[u].d) * b[u].c, dfs(u + 1, res | b[u].c) + b[u].c * b[u].d);
}

int main()
{
	scanf("%d%lld", &n, &K);
	for(int i = 1; i <= n; i++)
		scanf("%lld", &a[i]);
	// for(int i = 0; i <= K; i++)
	// {
	// 	ll tmp = 0;
	// 	for(int j = 1; j <= n; j++)
	// 		tmp += a[j] ^ i;
	// 	ans = max(ans, tmp);
	// }
	// printf("%lld\n", ans);
	// return 0;
	for(int j = 40; ~j; j--)
	{
		int cnt = 0;
		for(int i = 1; i <= n; i++)
			cnt += ((a[i] >> j) & 1);
		if(cnt < n - cnt)
			b[++m] = (node_t) {1ll << j, n - cnt};
		else
			ans += cnt * (1ll << j);
	}
	printf("%lld\n", ans + dfs(1, 0ll));
	return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		int N = Integer.parseInt(W);

		W = in.readLine();
		String[] Ws = W.split(" ");

		int[] A = new int[N];
		for(int i=0;i<N;i++){
			A[i] = Integer.parseInt(Ws[i]);
		}
		Arrays.sort(A);

		String ans = "YES";
		for(int i=1;i<N;i++){
			if(A[i-1]==A[i]){
				ans = "NO";
				break;
			}
		}

		System.out.println(ans);

	}


}


Measured memory_bytes: 49364
package main

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

var sc *bufio.Scanner

func nextString() string {
	sc.Scan()
	i := sc.Text()
	return i
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func printList(a []int) {
	for i, v := range a {
		fmt.Print(v)
		if i == len(a)-1 {
			fmt.Print("\n")
		} else {
			fmt.Print(" ")
		}
	}
}

var cnt int

func insertionSort(a []int, n int, g int) []int {
	var v int
	var j int
	for i := g; i < n; i++ {
		v = a[i]
		j = i - g
		for j >= 0 && a[j] > v {
			a[j+g] = a[j]
			j -= g
			cnt++
		}
		a[j+g] = v
	}
	return a
}

func shellSort(a []int, n int) []int {
	cnt = 0
	m := int(math.Log(float64(n))/math.Ln2) + 1
	G := make([]int, m)
	for i := range G {
		G[i] = int(math.Pow(2, float64(m-1-i)))
		a = insertionSort(a, n, G[i])
	}
	fmt.Println(m)
	printList(G)
	fmt.Println(cnt)

	return a
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	a := make([]int, n)
	for i := range a {
		a[i] = nextInt()
	}
	a = shellSort(a, n)
	for _, v := range a {
		fmt.Println(v)
	}
}



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

#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define int long long
#define endl '\n'

using namespace std;

const int N = 2e5 + 77;

int32_t main(){
    fast;
    int n; cin >> n ;
    if(n%2){
        cout << 0 << endl;
        return 0;
    }
    int a = 10 , b = 0;
    while(a <= n){
        b += n/a;
        a *= 5;
    }
    cout << b << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"---------------"#x"---------------"<<endl
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
						For(_x,L,R)cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector <int> vi;
typedef long double LD;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f|=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int N=30;
int n;
char s[N],t[N];
int vis[N];
int main(){
	cin>>s+1;
	n=strlen(s+1);
	if (n<26){
		For(i,1,n)
			vis[s[i]-'a']=1;
		For(i,0,25)
			if (!vis[i]){
				cout<<s+1<<(char)('a'+i)<<endl;
				return 0;
			}
	}
	For(i,1,n)
		t[i]=s[i];
	if (!next_permutation(s+1,s+n+1))
		return puts("-1"),0;
	For(i,1,n)
		if (t[i]!=s[i]){
			For(j,1,i)
				putchar(s[j]);
			puts("");
			return 0;
		}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

		char[] s1 = scan.next().toCharArray();

		boolean result1 = false, result2 = false;
		int cpos = 99999999, fpos = -1;
		for(int i = 0; i < s1.length; i++) {
			if(s1[i] == 'C') {
				cpos = i;
				result1 = true;
				break;
			}
		}
		for(int i = s1.length-1; i >=0; i--) {
			if(s1[i] == 'F') {
				fpos = i;
				result2 = true;
				break;
			}
		}

		boolean result = result1 && result2 && (cpos<fpos);

		System.out.println((result)?"Yes":"No");
	}
}


Measured memory_bytes: 8916
#include<iostream>
#include<vector>
#include<string>
using namespace std;

int main(){
    int h, w;

    cin >> h >> w;
    
    vector<string> str(w + 2, "#");
    for(int i = 0; i < str.size(); i++){
        cout << str[0];
    }
    cout << endl;

    for(int i = 0; i < h; i++){
        cout << '#';
        string str;
        cin >> str;
        cout << str << '#' << endl;
    }

    for(int i = 0; i < str.size(); i++){
        cout << str[0];
    }
    cout << endl;

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

int main( int argc, char *argv[] ) {
	int N, tmp;

	cin >> N;

	vector<int> stud(N, 0);
	for ( int i = 0 ; i < N ; i++ ){
		cin >> tmp;
		stud[tmp-1] = i + 1;
	}

	for ( auto i : stud ) {
		cout << i << " ";
	}
	cout << "\n";

	return 0;
}


Measured memory_bytes: 1152
#include<stdio.h>
void swap(int *x,int *y){
int m=*x;
*x=*y;
*y=m;
}
int main(){
int a[200],n,j,k,i;
while(scanf("%d",&n),n){
j=0;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(k=0;k<n-1;k++)
for(i=0;i<n-1;i++)
if(a[i]>a[i+1]){
swap(&a[i],&a[i+1]);
j++;
}
printf("%d\n",j);
 
}
return 0;
}

Measured memory_bytes: 600
#include<stdio.h>
#include<math.h>
#define lli long long int 
int main()
{
	lli n;
	lli ans=0;
	scanf("%lld",&n);
	lli h[n];
	for(int i=0;i<n;i++)
	{
		scanf("%lld",&h[i]);
	}
	lli a[n];
	a[0]=0;
	a[1]=fabs(h[1]-h[0]);
	for(int i=2;i<n;i++)
	{
		a[i]=fmin(a[i-1]+fabs(h[i]-h[i-1]),a[i-2]+fabs(h[i]-h[i-2]));
	}

	printf("%lld",a[n-1]);
	return 0;

}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main(){
    int r;
    cin >> r;
    cout << r*r;
}  


Measured memory_bytes: 256
#include<iostream>
#include<string.h>
using namespace std;
#define ll long long
char s1[100];
char s2[1000];
int a[100],b[100];
int c[1000];
int k,p;
int  mul(int  a[],int b[])
{   int lenx=k;
    int leny=p;
    int t=0;
    for(int i=1;i<=lenx;i++)
      {  t=0;
        for(int j=1;j<=leny;j++)
          { c[i+j-1]+=a[i]*b[j]+t;
            t=c[i+j-1]/10; c[i+j-1]%=10;
		  }
		  c[i+leny]=t;
	  }
	  int lenc=lenx+leny;
	  while(c[lenc]==0&&lenc>1)
	   lenc--;
	  return lenc;
}
int main ()
{   cin>>s1>>s2;
    k=strlen(s1);
    p=3;
    for(int i=1;i<=k;i++)
      a[i]=s1[k-i]-'0';
      b[3]=s2[0]-'0';
      b[2]=s2[2]-'0';
      b[1]=s2[3]-'0';
      k=mul(a,b);
       if(k<3)  cout<<0;
      for(int i=k;i>=3;i--)
       {   cout<<c[i];
	   }
	   return 0;
 } 

Measured memory_bytes: 3608
import math
M = 10**9+7
X,Y = map(int,input().split())
if (X+Y)/3 != (X+Y)//3:
    print(0)
    exit()
n = (X+Y)//3
r = Y-n
if r<0 or r>n:
    print(0)
    exit()


#nCr and Mod
def nCr(n, r, mod=10**9+7):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

print(nCr(n,r,M))

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
import bisect
MOD = 998244353
n = int(input())
XD = sorted([list(map(int, input().split())) for _ in range(n)])
X, D = zip(*XD)


C = list(range(n))

class RmaxQ:
    def __init__(self, original):
        self.n = len(original)
        self.INF = -float("inf")
        self.N0 = 1 << (self.n-1).bit_length()
        self.seg = [self.INF]*(self.N0 << 1)
        for i, j in enumerate(original, self.N0):
            self.seg[i] = j
        for i in range(self.N0-1, 0, -1):
            self.seg[i] = max(self.seg[2*i], self.seg[2*i+1])

    def get(self, i):
        return self.seg[i+self.N0]
        
    def update(self, i, x):
        i += self.N0
        self.seg[i] = x
        while i > 1:
            i >>= 1
            self.seg[i] = max(self.seg[2*i], self.seg[2*i+1])
                
    def query(self, l, r):
        res = self.INF
        l += self.N0
        r += self.N0
        while l < r:
            if r & 1:
                res = max(res, self.seg[r-1])
            if l & 1:
                res = max(res, self.seg[l])
                l += 1
            l >>= 1
            r >>= 1
     
        return res
    
seg = RmaxQ(C)
for i in range(n):
  x, d = XD[n-1-i]
  t = bisect.bisect_left(X, x+d)
  seg.update(n-1-i, max(t, seg.query(n-1-i, t)))

dp = [0]*(n+1)
l = [0]*n
l[-1] = n
dp[-1] = 1
for i in range(n):
  x, d = XD[n-1-i]
  m = bisect.bisect_left(X, x+d)
  t = seg.query(n-1-i, m)
  dp[n-1-i] = dp[n-i] + dp[t]
  dp[n-1-i] %= MOD
print(dp[0])

Measured memory_bytes: 136800
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
    public static void main(String[] args) throws IOException {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String input = br.readLine();
 
        int[][][] house = new int[4][3][10];
 
//      ????????????¨?????????¨??±??????????°???0
        for(int i = 0; i < 4; i++){
            for(int j = 0; j < 3; j++){
                for(int k = 0; k < 10; k++){
                    house[i][j][k] = 0;
                }
            }
        }
 
//      ?????????????????????±??????°n
        int n = Integer.parseInt(input);
 
        for(int i = 0 ; i < n; i++){
            input = br.readLine();
            String[] strArray = input.split(" ");
 
            int building = Integer.parseInt(strArray[0]) -1;    //??£?
            int floor = Integer.parseInt(strArray[1]) -1;       //???
            int room = Integer.parseInt(strArray[2]) -1;        //?????????
            int resident = Integer.parseInt(strArray[3]);      //??????°
 
            house[building][floor][room] += resident;
        }
 
//      ??????
        for(int i = 0; i < 4; i++){
//          ??£??????????
            if(i != 0){
                System.out.println("####################");
            }
                for(int l = 0; l < 3; l++){
                    for(int k = 0; k < 10; k++){
                        System.out.print(" ");
                        System.out.print(house[i][l][k]);
                    }
                    System.out.println();
                }
        }
    }
}

Measured memory_bytes: 24376
#include<iostream>
#include<string>
#include<vector>
#include<stdbool.h>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<set>
#include<string>
#include<stdlib.h>
typedef long long ll;
using namespace std;

int main() {
	int N;
	cin >> N;
	for (int i = 0;i <= (int)sqrt(N)+1;i++) {
		if ((int)pow(i, 2) > N) {
			cout << (int)pow(i-1,2)<< endl;
			return 0;
		}
		else if ((int)pow(i, 2) == N){
			cout << (int)pow(i, 2) << endl;
			return 0;
		}
	}
  return 0;
}
	

Measured memory_bytes: 256
n,l=map(int,input().split())
a=list(map(int,input().split()))
x=-1
for i in range(n-1):
  if a[i]+a[i+1]>=l:
    x=i
    break
    
if x==-1:
  print('Impossible')
else:
  print('Possible')
  for i in range(x):
    print(i+1)
  for i in range(n-2,x-1,-1):
    print(i+1)

Measured memory_bytes: 14052
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)

int main()
{
    fastio;
    int a,b,c;
    cin>>a>>b>>c;
    if(b*c>=a)
        cout<<"Yes"<<"\n";
    else
        cout<<"No"<<"\n";
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#define MAX 100000

using namespace std;

long long dp[MAX + 5];

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

    int n, g;

    cin >> n >> g;

    for(int i = 0; i < n; i++)
    {
        int w, v;

        cin >> w >> v;

        for(int i = g - w; i >= 0; i--)
            dp[i + w] = max(dp[i + w], dp[i] + v);
    }

    cout << dp[g];

    return 0;
}


Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.InputMismatchException;
import java.util.Comparator;

class TrackRecord
{
    private int id;
    private float tm;

    public TrackRecord(int id, float tm)
    {
	this.id = id;
	this.tm = tm;
    }

    public int getId()
    {
	return this.id;
    }

    public float getTm()
    {
	return this.tm;
    }

    public int setId(int id)
    {
	return this.id = id;
    }

    public float setTm(float tm)
    {
	return this.tm = tm;
    }
}

public class Main
{

    public static void main(String[] args)
    {
	final int nRec=24;
	Scanner scan = new Scanner(System.in);
	TrackRecord[] rec = new TrackRecord[nRec];

	try{
	    for (int i=0; i<nRec; i++){
		int id = scan.nextInt();
		Float tm = scan.nextFloat();
		try {
		    rec[i] = new TrackRecord(id,tm);
		} catch(NullPointerException e){
		    System.out.println("NPE:"+e+" i="+i);
		}
	    }
	} catch (InputMismatchException e){
	    System.out.println("Wrong Type"+e);
	}
	
	TrackRecord[] g1 = new TrackRecord[8];
	g1 = Arrays.copyOfRange(rec, 0, 8);
	TrackRecord[] g2 = new TrackRecord[8];
	g2 = Arrays.copyOfRange(rec, 8, 16);
	TrackRecord[] g3 = new TrackRecord[8];
	g3 = Arrays.copyOfRange(rec, 16, 24);

        Arrays.sort(g1, new Comparator<TrackRecord>() {
		public int compare(TrackRecord record1, TrackRecord record2) {
		    return (int)(record1.getTm()*100) - (int)(record2.getTm()*100);
		}
	    });

        Arrays.sort(g2, new Comparator<TrackRecord>() {
		public int compare(TrackRecord record1, TrackRecord record2) {
		    return (int)(record1.getTm()*100) - (int)(record2.getTm()*100);
		}
	    });
        Arrays.sort(g3, new Comparator<TrackRecord>() {
		public int compare(TrackRecord record1, TrackRecord record2) {
		    return (int)(record1.getTm()*100) - (int)(record2.getTm()*100);
		}
	    });
	ArrayList<TrackRecord> ans = new ArrayList<TrackRecord>(); 
	ans.add(g1[0]);
	ans.add(g1[1]);
	ans.add(g2[0]);
	ans.add(g2[1]);
	ans.add(g3[0]);
	ans.add(g3[1]);

	TrackRecord[] rec1 = new TrackRecord[nRec-6];
	for (int i=0; i<6; i++){
	    rec1[i] = g1[i+2];
	}
	for (int i=0; i<6; i++){
	    rec1[i+6] = g2[i+2];
	}
	for (int i=0; i<6; i++){
	    rec1[i+12] = g3[i+2];
	}

        Arrays.sort(rec1, new Comparator<TrackRecord>() {
		public int compare(TrackRecord record1, TrackRecord record2) {
		    return(int)(record1.getTm()*100) - (int)(record2.getTm()*100);
		}
	    });

	ans.add(rec1[0]);
	ans.add(rec1[1]);
	for (int i=0; i<ans.size(); i++){
	    System.out.printf("%d %.2f\n", ans.get(i).getId(), ans.get(i).getTm()); 
	}
    }

}

Measured memory_bytes: 28380
/*COMPETITIVE PROGRAMMING C++ TEMPLATE */

#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include <stack>
#include <queue>
#include <climits>
#include <iomanip>

#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << " = " << x << "\n"
#define MOD 1000000007

const long double PI = 3.141592653589793236L;

typedef long long int ll;
typedef long double ld;

using namespace std;

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

    ll count = 0;

    for(int i = 1; i < n; i++)
    {
        count += (n - 1) / i;

    }


    cout << count << "\n";

}

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

    int T = 1;
    //cin >> T;
    
    while (T--)
    {
        solve();
    }
    
    return 0;
}




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

int main(){
  int n,m;
  cin>>n>>m;
  vector<int> g[n+1];
  int u,v;
  while(m--){
    cin>>u>>v;
    g[u].push_back(v);
    g[v].push_back(u);
  }

  queue<int> q;
  vector<bool> visited(n+1, false);
  vector<int> predi(n+1, 0);

  visited[1]=true;
  predi[1]=0;
  q.push(1);

  while(!q.empty()){
    int t=q.front();
    q.pop();
    for(auto i:g[t]){
      if(!visited[i]){
        visited[i]=true;
        predi[i]=t;
        q.push(i);
      }
    }
  }

  for(int i=2; i<=n; ++i){
    if(predi[i]==0){
      cout<<"No\n";
      exit(0);
    }
  }

  cout<<"Yes\n";
  for(int i=2; i<=n; ++i){
    cout<<predi[i]<<endl;
  }
}


Measured memory_bytes: 10196
n = gets.to_i
s = gets.split("")
a = Array.new(n-1, 0)
for i in 0..(n-2) do
  s1 = s[0..i]
  s2 = s[(i+1)..(n-1)]
  for x in "a".."z" do
    if s1.include?(x) && s2.include?(x)
      a[i] += 1
    end
  end
end

p a.max



Measured memory_bytes: 3836
import sys
from collections import deque
import copy
import math
def main():
    A, B, N = map(int, input().split())
    if B - 1 <= N:
        x = B - 1
    else:
        x = N
    ans = math.floor(A * x / B) - A * math.floor(x / B)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 68292
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int x;cin>>x;
    int res=0;
    for(int b=1;b<=x;b++){
        for(int p=2;p<=10;p++){
            if(pow(b,p)>x) break;
            res=max(res,(int)pow(b,p));
        }
    }
    cout<<res<<endl;
}


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

int pop_count(int bits){
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main(){
    int N, K, S, T;
    cin >> N >> K >> S >> T;
    if((S&T) != S){
        cout << 0 << endl;
        return 0;
    }
    vector<int> A;
    for(int i=0; i<N; i++){
        int a;
        cin >> a;
        if((a&S) == S && (a|T) == T) A.push_back(a-S);
    }
    T -= S;
    N = A.size();
    K = min(K, N);

    uint64_t comb[51][51] = {0};
    comb[0][0] = 1;
    for(int i=1; i<=N; i++){
        comb[i][0] = 1;
        for(int j=1; j<=i; j++) comb[i][j] = comb[i-1][j-1] + comb[i-1][j];
    }

    uint64_t sub[51] = {0};
    for(int i=0; i<=N; i++) for(int j=0; j<K; j++) sub[i] += comb[i][j];

    uint64_t ans = 0;
    for(int i=0; i<N; i++){
        for(int b=T; ; b=(b-1)&T){
            int cnt = 0;
            int n1 = b&A[i];
            int n0 = b-n1;
            for(int j=i+1; j<N; j++) if((A[j]&n1) == n1 && (A[j]&n0) == 0) cnt++;
            uint64_t res = sub[cnt];
            if(pop_count(b)%2) res *= -1;
            ans += res;
            if(b == 0) break;
        }
    }

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


Measured memory_bytes: 3644
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int SIZE=100001;
//int arr[SIZE]={};
//ここまでテンプレ

int main(){
	int N;
	cin>>N;
	int a[SIZE]={},ni[SIZE]={};
	for(int i=0;i<N;i++){
		cin>>a[i];
		while(a[i]%2==0){
			a[i]/=2;
			ni[i]++;
		}
	}
	int B[3]={};
	for(int i=0;i<N;i++){
		if(ni[i]==0)
			B[0]++;
		else if(ni[i]==1)
			B[1]++;
		else
			B[2]++;
	}
	if(B[0]-B[2]==1){
		if(B[1]){
			cout<<"No"<<endl;
			return 0;
		}
		else{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	else if(B[0]>B[2]){
		cout<<"No"<<endl;
		return 0;
	}
	else{
		cout<<"Yes"<<endl;
	}

	return 0;
}

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

int main() {
	
	int n,x,y;
	cin >> n >> x >> y;
	x--; y--;
	vector<vector<int>> d(n,vector<int>(n));
	vector<int> ans(n);
	for(int i=0; i<n; i++){
		if(i<x){
			for(int j=i; j<n; j++){
				if(j<=x) {
					d.at(i).at(j) = j-i;
					d.at(j).at(i) = j-i;
				}
				else if(j>=y) {
					d.at(i).at(j) = j-i - (y-x)+1;
					d.at(j).at(i) = j-i - (y-x)+1;
				}
				else{
					d.at(i).at(j) = x - i + min(j-x, y-x+1-(j-x));
					d.at(j).at(i) = x - i + min(j-x, y-x+1-(j-x));
				}
			}
		}
		else if(y<i){
			for(int j=x; j<n; j++){
				if(y<=j) {
					d.at(i).at(j) = abs(j-i);
					d.at(j).at(i) = abs(j-i);
				}
				else {
					d.at(i).at(j) = i-y + min(y-j, y-x+1-(y-j));
					d.at(j).at(i) = i-y + min(y-j, y-x+1-(y-j));
				}
			}
		}
		else{
			for(int j=i; j<=y; j++){
				d.at(i).at(j) = min(j-i, y-x+1-(j-i));
				d.at(j).at(i) = min(j-i, y-x+1-(j-i));
			}
		}
	}
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			ans.at(d.at(i).at(j))++;
		}
	}
	for(int i=1; i<n; i++) cout << ans.at(i)/2 << endl;
}

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

#define rep(i,a,b)      for(int i=a;i<=b;i++)
#define revp(i,b,a)     for(int i=b;i>=a;i--)

int n,t,a,b,ans=INT_MAX;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>t;
    rep(i,1,n)
    {
        cin>>a>>b;
        if(b<=t)
            ans=min(ans,a);
    }
    if(ans!=INT_MAX)
        cout<<ans;
    else
        cout<<"TLE";
}



Measured memory_bytes: 256