akhauriyash/Code-Regression huggingface dataset:
N,T = map(int,input().split())
grid = []
for i in range(N):
    array = list(map(int,input().split()))
    grid.append(array)

ans = []
for i in range(len(grid)):
    if grid[i][1] <= T:
        ans.append(grid[i])

if len(ans) != 0:
    print(sorted(ans)[0][0])
else:
    print('TLE')
          

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1e9+7;
const ll INF = 1e18;
const int inf = 1e9;

void solve()
{
  int a,b,c; cin>>a>>b>>c;
  if(a<=c&&c<=b) cout << "Yes" << endl;
  else cout << "No" << endl;
}

int main()
{
  solve();
  return 0;
}


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

/*
ll GCD(ll a, ll b) {
return b ? GCD(b, a%b) : a;
}

sort(a, a + N, greater<int>())   // descend
sort(a, a+N)                    //  ascend


** nCk
void comb(vector<vector <long long int > > &v) {
for (int i = 0; i < v.size(); i++) {
v[i][0] = 1;
v[i][i] = 1;
}
for (int k = 1; k < v.size(); k++) {
for (int j = 1; j < k; j++) {
v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
}
}
}


** main内でnCn~nC0 生成 **
vector<vector<long long int> > v(n + 1, vector<long long int>(n + 1, 0));
comb(v);


*/



int main() {
	ll n,k;
	cin >> n>>k;
	ll x[110000];
	ll p = 0;
	ll ans = 1000000000000;
	
	rep(i, 0, n) cin >> x[i];

	rep(i, 0, n - k+1) {
		if (x[i + k-1] <= 0) p = -x[i];
		else if (x[i] >= 0) p = x[i + k-1];
		else p = min(abs(2 * x[i]) + abs(x[i + k-1]), abs(x[i]) + abs(2 * x[i + k-1]));
		ans = min(p, ans);
	}
	cout << ans;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
  
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge{
    int to, cost;
};

int main(){
    ll x, y;
    cin >> x >> y;
    if(x % y == 0){
        cout << "-1" << endl;
    }else{
        cout << x << endl;
    }
}

Measured memory_bytes: 768
// {{{ include
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
// }}}

using namespace std;

typedef long long ll;
inline int in(){int x;scanf("%d",&x);return x;}

int grid[256][256];
int X[512];
int Y[512];

int main()
{
  int N;
  while (N = in()){
    memset(grid, 0, sizeof(grid));
    int W = in(), H = in();
    for (int i = 0; i < N; i++){
      scanf("%d %d", X + i, Y + i);
    }
    int S = in(), T = in();
    for (int i = 0; i < N; i++){
      grid[Y[i]][X[i]] += 1;
      grid[Y[i] + T][X[i]] -= 1;
      grid[Y[i]][X[i] + S] -= 1;
      grid[Y[i] + T][X[i] + S] += 1;
    }
    for (int y = 1; y <= H; y++){
      for (int x = 1; x <= W; x++){
        grid[y][x] += grid[y][x - 1];
      }
    }
    int maxi = 0;
    for (int x = 1; x <= W; x++){
      for (int y = 1; y <= H; y++){
        grid[y][x] += grid[y - 1][x];
        maxi = max(maxi, grid[y][x]);
      }
    }
    printf("%d\n", maxi);
  }
  return 0;
}

Measured memory_bytes: 1440
#include <iostream>
#include <string>
#include <cstdint>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <climits>
#include <numeric>
#include <algorithm>

using namespace std;


int main()
{
    int64_t n,a,b;
    cin >> n >> a >> b;
    
    int64_t nb = n / (a+b) * a + min(n % (a + b), a);  
    
    cout << nb << '\n';
    
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
c = list(map(int, input().split(' ')))
ans = 0
prev_i = -1

for i in range(n):
    ans += b[a[i] - 1]
    if prev_i + 1 == a[i]:
        ans += c[a[i] - 2]
    prev_i = a[i]

print(ans)

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

using namespace std;

#define MAX 114
const int MOD = 10000;

void add(int &a, int b)
{    
    a = (a + b) % MOD;
}

int main()
{
    int N, M, a, b;
    cin >> N >> M;
    vector<int> p(N, -1);
    for (int i = 0; i < M; i++) {
        cin >> a >> b; a--; b--;
        p[a] = b;
    }
    
    int dp[MAX][4][4] = {{{}}};
    dp[0][3][3] = 1;

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 4; j++) {
            for (int k = 0; k < 4; k++) {
                if (dp[i][j][k] == 0) continue;
                if (p[i] >= 0) {
                    if (k == j && j == p[i]) continue;
                    add(dp[i+1][p[i]][j], dp[i][j][k]);
                } else {
                    for (int l = 0; l < 3; l++) {
                        if (k == j && j == l) continue;
                        add(dp[i+1][l][j], dp[i][j][k]);
                    }
                }                    
            }
        }
    }
    int res = 0;
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            add(res, dp[N][i][j]);
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3100
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] O = br.readLine().split("");
    String[] E = br.readLine().split("");
    String ans = "";
    for (int i = 0; i < O.length; i++) {
      ans += O[i];
      try {
        ans += E[i];
      } catch(Exception e) {}
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 22612
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())
ll dp[100010][4] = {};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    string S;
    cin >> S;

    for (int i = (int)S.size(); i >= 0; --i) {
        for (int j = 3; j >= 0; --j) {
            if (i == S.size()) {
                if (j == 3)dp[i][j] = 1;
                else dp[i][j] = 0;
            }
            else {
                if (S[i] == '?') dp[i][j] = dp[i + 1][j] * 3;
                else dp[i][j] = dp[i + 1][j] * 1;

                if (j < 3 && (S[i] == '?' || S[i] == "ABC"[j])) {
                    dp[i][j] += dp[i + 1][j + 1];
                }
                dp[i][j] %= MOD;
            }
        }
    }
    cout << dp[0][0] << endl;
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back

typedef vector<int> vint;
typedef long long ll;


int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(auto &ref:a){
        cin >> ref;
    }
    int l, ans;
    l = a[0];
    ans = 0;
    for(auto i:a){
        if(i >= l){
            ans++;
            l = i;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<functional>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  int n,a,b,ok=0;
  cin>>n>>a>>b;
  for(int i=0;i<=a;i++){
    int m=n;
    m*=i;
    if(m%a==b){
      ok++;
      break;
    }
  }
  if(ok==1)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}

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

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pi >
#define pi pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
#define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
#define FOR(var, to)          UPTO(var, 0, (to)-1)
#define DOWN(var, from)       DOWNTO(var, (from)-1, 0) 

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF ((1 << 30)-1)
#define LINF ((1LL << 62)-1)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

struct Comb {
    vector<vector<s64> > data;
    Comb(int n) { // O(n^2)
        data = vector<vector<s64> >(n+1,vector<s64>(n+1,1));
        UPTO(i,1,n) {
            FOR(j,i+1) {
                if (!j || j == i) data[i][j] = 1;
                else data[i][j] = data[i-1][j-1] + data[i-1][j];
            }
        }
    }
    
    s64 ncr(int n, int r) {
        return data[n][r];
    }
};

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

#define mygc(c) (c)=getchar_unlocked()

int ri() {
	int c,s=0,r=0;
	for(;;){ mygc(c); if(c=='-'){s=1;break;} if(c<='9'&&c>='0'){r=c-'0';break;}}
	for(;;){ mygc(c); if(c>'9'||c<'0')break; r= r* 10 + c-'0';}
	if(s)r=-r;
	return r;
}

int main() {
    int n = ri();
	int m = ri();
	int nn = 0;
	int mm = 0;
	int last = ri();
	FOR(i,n-1) {
		int a = ri();
		nn += ((s64)a-last)*(n-i-1)%1000000007*(i+1)%1000000007; nn %= 1000000007;
		last = a;
	}
	last = ri();
	FOR(i,m-1) {
		int a = ri();
		mm += ((s64)a-last)*(m-i-1)%1000000007*(i+1)%1000000007; mm %= 1000000007;
		last = a;
	}
	
	cout << (((s64)nn)*mm%1000000007) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(int n) {
  if (n == 0) return 1;
  mint x = f(n/2);
  x *= x;
  if (n%2 == 1) x *= 2;
  return x;
}

mint choose(int n, int a) {
  mint x = 1, y = 1;
  rep(i,a) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}

int main(){
  int n, a, b;
  cin >> n >> a >> b;
  mint ans = f(n);
  ans -= 1;
  ans -= choose(n, a);
  ans -= choose(n, b);
  cout << ans.x << endl;
  return 0;
}

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

int isEvenstr(string s){
  if(s.size()%2!=0)return 0;
  if(s.substr(0,s.size()/2)+s.substr(0,s.size()/2)==s)return 1;
  return 0;
}

int main(){
  string s;
  cin>>s;
  for(int i=s.size()-1;0<i;i--){
    if(isEvenstr(s.substr(0,i))==1){
      cout<<i;
      return 0;
    }
  }
}

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

void draw(int n){
  int m[4][2] = {{-1,0},{0,1},{1,0},{0,-1}};
  int t=0, muki=0, x=n+1, y=2;
  int cn[n+4][n+4];
  for(int i=1; i<n+3; i++)
    for(int j=1; j<n+3; j++)
      cn[i][j]=0;
  for(int i=0; i<n+4; i++){
    cn[i][0]=1;
    cn[i][n+3]=1;
    cn[0][i]=1;
    cn[n+3][i]=1;
  }

  while(t<2){
    if(t==1){
      if(cn[x+m[muki%4][0]+m[(muki+1)%4][0]][y+m[muki%4][1]+m[(muki+1)%4][1]]==1)
	break;
    }
    if(cn[x+2*m[muki%4][0]][y+2*m[muki%4][1]]==1)
      {t++; muki++; cn[x][y]=1;}
    else{
      t = 0;
      cn[x][y]=1;
      x+=m[muki%4][0];
      y+=m[muki%4][1];
    }
  }
  
  for(int i=2; i<n+2; i++){
    for(int j=2; j<n+2; j++){
      if(cn[i][j]==1)
	cout << "#";
      else
	cout << " ";
    }
    cout << endl;
  }
}

int main(){
  int d, n;
  cin >> d;

  for(int i=0; i<d; i++){
    cin >> n;
    draw(n);
    if(i != d-1)
      cout << endl;
  }
  return 0;
}

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

#define NDEBUG
#include <cassert>


typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

#define PQ(T) priority_queue<T>
#define RPQ(T) priority_queue<T,vector<T>,greater<T>>

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }

inline ll square(ll x) { return x * x; }
inline ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
template <typename T>
inline T mod(T a, T b) { return ((a % b) + b) % b; }


const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

ll solve(int N, int K){
    vi bucket;
    {
        int sq = sqrt(N);
        set<int> _bucket;
        _bucket.insert(N+1);
        int hi = N;
        for (int n=1; n<=sq; ++n) {
            int lo = N/(n+1)+1;
            int w = hi - lo + 1;
            if (w > 0) {
                _bucket.insert(lo);
            }
            hi = lo-1;
        }
        for (int lo=hi; lo>=1; --lo) {
            int n = N / lo;
            _bucket.insert(lo);
        }
        bucket.assign(ALL(_bucket));
    }

    int B = bucket.size() - 1;
    vll width(B);
    rep(i,B) width[i] = bucket[i+1] - bucket[i];
    bucket.pop_back();

    vll x(B, 1);

    rep(t,K-1) {
        rep(i, B) x[i] *= width[i];
        rep1(i,B-1) {
            (x[i] += x[i-1]) %= MOD;
        }
        reverse(ALL(x));
    }
    ll ans = 0;
    rep(i,B) {
        (ans += x[i] * width[i]) %= MOD;
    }
    return ans;
}

int main() {
    int N, K; cin >> N >> K;
    cout << solve(N,K) << endl;
    return 0;
}


Measured memory_bytes: 3456
#include <iostream>
using namespace std;
int main(void){
  int n;
  int e,m,j;
  while(cin>>n&&n!=0){
    for(int i=0;i<n;i++){
      cin>>m>>e>>j;
      if(m==100||e==100||j==100){
	cout<<"A";
      }else if((m+e)/2>=90){
	cout<<"A";
      }else if((m+e+j)/3>=80){
	cout<<"A";
      }else if((m+e+j)/3>=70){
	cout<<"B";
      }else if((m+e+j)/3>=50&&(m>=80||e>=80)){
	cout<<"B";
      }else{
	cout<<"C";
      }
      cout<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1152
S = input()
bits = ["---","--+","-+-","-++",
       "+--","+-+","++-","+++"]
flg = False
for bit in bits:
    eq = S[0]+bit[0]+S[1]+bit[1]+S[2]+bit[2]+S[3]
    val = eval(eq)
    if val == 7:
        print(eq+"=7")
        flg=True
        break
if not flg:
    print("nothing")

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

int main(){
    ll N, M ,Q, ans = 0;
    cin >> N >> M >> Q;
    vector<ll> a(Q,0);
    vector<ll> b(Q,0);
    vector<ll> c(Q,0);
    vector<ll> d(Q,0);
    vector<ll> A(11,1);

    for(int i = 0; i < Q; i++){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }


    for(int i = 1; i <= M; i++){
        A[1] = i;
        for(int j = i ; j <= M; j++){
            A[2] = j;
            for(int k = j; k <= M; k++){
                A[3] = k;
                for(int l = k; l <= M; l++){
                    A[4] = l;
                    for(int m = l; m <= M; m++){
                        A[5] = m;
                        for (int n = m; n <= M; n++){
                            A[6] = n;
                            for(int o = n; o <= M; o++){
                                A[7] = o;
                                for(int p = o; p <= M; p++){
                                    A[8] = p;
                                    for(int q = p; q <= M; q++){
                                        A[9] = q;
                                        for(int r = q; r <= M; r++){
                                            A[10] = r;
                                            ll tmp_ans = 0;
                                            for(int num = 0; num < Q; num++){
                                                if(A[b[num]] - A[a[num]] == c[num]) tmp_ans += d[num];
                                            }
                                            ans = max(ans,tmp_ans);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    cout << ans << endl;
}



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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>
#define Graph vector<vector<int>>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }


void func(std::vector<long long> x){

}

int main(){

    std::vector<long long> x(5);
    for(int i = 0 ; i < 5 ; i++){
        scanf("%lld",&x[i]);
    }
    
    for(ll i = 0; i < 5; i++){
        if(x.at(i)==0){
            cout << i+1 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <fstream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

#pragma comment(linker, "/STACK:400000000")

#define EPS 1e-9
#define INF MOD
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(it=X.begin();it!=X.end();it++)
#define iss istringstream
#define ite iterator
#define ll long long
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define pi pair<int,int>
#define pb push_back
#define sec second
#define sst stringstream
#define sz size()
#define vc vector
typedef vc<int> vi;
typedef vc<ll> vl;
typedef vc<string> vs;

const int N=128;

string s;
int g[N][N];
int in[N],out[N],E;
int vis[N],twoways;

void dfs(int cur){
	vis[cur]=1;
	rep(i,N)if(!vis[i] && g[cur][i]){
		dfs(i);
	}
}

void go(int cur){
	//cout<<(char)cur<<endl;
	if(E==0)return;
	int successed=0;
	rep(i,N)if(g[cur][i]){
		g[cur][i]=0;
		fill(vis,vis+N,0);
		dfs(i);
		int ok=1;
		//rep(j,N)if(islower(j))cout<<(char)j<<vis[j]<<" ";cout<<endl;
		rep(j,N){
			if(in[j]>0 && !vis[j]){
				//cout<<(char)j<<" "<<in[j]<<endl;
				ok=0;break;
			}
		}
		//cout<<(char)cur<<"->"<<(char)i<<" ("<<E<<") :"<<(ok?"OK":"NG")<<endl;
		if(ok){
			if(successed){
				//cout<<"Found: "<<(char)successed<<endl;
				twoways=1;
				return;
			}
			successed=i;
			in[i]--;
			E--;
			go(i);
		}
		g[cur][i]=1;
		in[i]++;
		E++;
	}
}

int main(){
	while(cin>>s && s!="#"){
		if(s.sz<=2){
			cout<<"No Results\n";
			continue;
		}
		memset(g,0,sizeof(g));
		fill(in,in+N,0);
		fill(out,out+N,0);
		E=0;
		rep(i,s.sz-1){
			g[s[i]][s[i+1]]=1;
		}
		rep(i,N)rep(j,N){
			if(g[i][j]){
				out[i]++,in[j]++,E++;
			}
		}
		int count=0;
		rep(i,N){
			count+=max(0,out[i]-in[i]);
		}
		if(count==0)cout<<E+1<<endl;
		else if(count>1)cout<<E+1+(count-1)<<endl;
		else if(E<s.sz-1)cout<<E+1<<endl;
		else{
			int start=-1;
			rep(i,N){
				if(out[i]-in[i]==1)start=i;
			}
			twoways=0;
			int e=E;
			go(start);
			//cout<<(twoways?"Two":"One")<<endl;
			cout<<(twoways?e+1:e+1+1)<<endl;
		}
	}
}

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


string bus = "012345678954321012345678954321";
int start,end;

void solve(){
  if(start < end){
    for(int i = start; i <= end; i++){
      if(i != start) cout << " ";
      cout << bus[i];
    }
  }else{
    for(int i = 6;; i++){
      if(bus[i]-'0' == start){
	start =i;
	break;
      }
    }

    for(int i = start;;i++){
      if(i != start) cout << " ";
      cout << bus[i];
      if(bus[i] -'0' == end) break;
    }
  }
}

int main(){
  int in;
  cin >> in;
  for(int i = 0; i < in; i++){
    cin >> start >> end;
    solve();
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,ans;
  scanf("%d",&n);
  vector <int> L(n);
  for(int i=0;i<n;i++){
    cin >> L.at(i);
  }
  sort(L.begin(),L.end());
  for(int i=0;i<n-2;i++){
    for(int j=i+1;j<n-1;j++){
      auto it =lower_bound(L.begin(),L.end(),L.at(i)+L.at(j))-L.begin();
      ans += it-j-1;
    }
  }
  printf("%d",ans);
}

      
      
  

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {
	public static void main(String[] args) throws Exception {
try {
	BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
	String input = buf.readLine();
	
	String[] strAry = input.split(" ");
    int a = Integer.parseInt(strAry[0]);
    int b = Integer.parseInt(strAry[1]);
    int c = Integer.parseInt(strAry[2]);
	
    int count = 0; 
    
for (int i = a; i <= b; i++) {
	if(c%i == 0){
count ++;
	}
}

System.out.println(count);

} catch (Exception e) {
	// TODO: handle exception
}
		 }
    }

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

using namespace std;

int main()
{
    
    long long a,b,c;
    cin>>a>>b>>c;
    long long k=c-a-b;
    if(k*k>4*a*b&&k>=0){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}
}


Measured memory_bytes: 256
a[210][9],i,j,n,k;main(x){for(scanf("%d",&n);n/++i;)for(j=4;--j;--a[a[i][j]=x][j+3])scanf("%d",&x);for(;n/++k;printf("%d\n",i))for(i=0,j=4;--j;)i+=!~a[x=a[k][j]][j+3]*x;}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define ld long double
#define oo 2e18
#define OS tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;


const int N = 3e2 + 5;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll n, m, l, e[N][N], ee[N][N];

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> m >> l;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            e[i][j] = (i == j) ? 0 : oo;
            ee[i][j] = (i == j) ? 0 : oo;
        }
    }
    for (int i = 0; i < m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        e[a][b] = c;
        e[b][a] = c;
    }
    for (int k = 1; k <= n; k++) {
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                if (e[i][k] + e[k][j] < e[i][j])
                    e[i][j] = e[i][k] + e[k][j];
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (i != j) {
                ee[i][j] = (e[i][j] <= l) ? 1 : oo;
            }
        }
    }
    for (int k = 1; k <= n; k++) {
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                if (ee[i][k] + ee[k][j] < ee[i][j])
                    ee[i][j] = ee[i][k] + ee[k][j];
            }
        }
    }
    cin >> n;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        if (ee[a][b] < oo) {
            cout << ee[a][b] - 1 << "\n";
        } else if (ee[b][a] < oo) {
            cout << ee[b][a] - 1 << "\n";
        } else {
            cout << -1 << "\n";
        }
    }
    return 0;
}

Measured memory_bytes: 5028
#

import sys
from copy import deepcopy
input=sys.stdin.readline

def main():
    N,M=map(int,input().split())
    sukic=[0]*(M+1)
    for i in range(N):
        A=list(map(int,input().split()))
        for j in range(A[0]):
            sukic[A[j+1]]+=1
    print(sukic.count(N))
    
if __name__=="__main__":
    main()


Measured memory_bytes: 3444
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>

#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<int, int>Pii;

int main() {
	int a, b;
	cin >> a >> b;
	if ((a + b) % 3 == 0 ||a % 3 == 0 ||b % 3 == 0) {
		puts("Possible");
	}
	else puts("Impossible");
	return 0;
}

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

using namespace std;

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

  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
  }
  int ans = 1;
  set<int> cur;
  for (int i = 0; i < k; ++i) {
    cur.insert(p[i]);
  }
  multiset<int> diff;
  for (int i = 1; i < k; ++i) {
    diff.insert(p[i] - p[i - 1]);
  }
  int sorted = *diff.begin() > 0;
  for (int i = k; i < n; ++i) {
    bool ok = p[i - k] > *cur.begin() or p[i] < *cur.rbegin();
    if (ok) {
      ++ans;
    }
    cur.erase(p[i - k]);
    cur.insert(p[i]);
    bool ok2 = ok or *diff.begin() < 0;
    diff.erase(diff.find(p[i - k + 1] - p[i - k]));
    diff.insert(p[i] - p[i - 1]);
    if (ok2) {
      sorted += *diff.begin() > 0;
    }
  }
  cout << ans - max(0, sorted - 1);

  return 0;
}

Measured memory_bytes: 19840
import java.util.stream.IntStream;

public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt(), m = scanner.nextInt();
        boolean[] isConnectedFirst = new boolean[n], isConnectedLast = new boolean[n];
        for (int i = 0, a, b; i < m; i++) {
            a = scanner.nextInt();
            b = scanner.nextInt();
            if (a == 1) isConnectedFirst[b] = true;
            if (a == n) isConnectedLast[b] = true;
            if (b == 1) isConnectedFirst[a] = true;
            if (b == n) isConnectedLast[a] = true;
        }
        System.out.println(IntStream.range(0, n).anyMatch(i -> isConnectedFirst[i] && isConnectedLast[i]) ? "POSSIBLE" : "IMPOSSIBLE");
    }
}

Measured memory_bytes: 93232
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    vll a(n);
    rep(i,n) cin >> a[i];
    vll x;
    rep(i,n) {
        x.push_back(-a[i]+n-i-1);
    }
    sort(all(x));
    // vout(x);
    // cout << endl;
    ll ans = 0;
    for (ll i = n-1; i >= 0; i--) {
        ans += upper_bound(all(x),a[i]+n-1-i)-lower_bound(all(x),a[i]+n-1-i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 6852
#include <stdio.h>

int main(void)
{
	int n;
	int i, j;
	int val;
	int pn5, pn2;

	while (scanf("%d", &n), n){
		pn5 = pn2 = 0;
		for (i = 1; i <= n; i++){
			for (val = i; val % 2 == 0 || val % 5 == 0;){
				if (val % 5 == 0){
					pn5++;
					val /= 5;
				}
				if (val % 2 == 0){
					pn2++;
					val /= 2;
				}
			}
		}
		printf("%d\n", pn5 < pn2 ? pn5 : pn2);
	}

	return (0);
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const ll INF = numeric_limits<ll>::max();
int main()
{
    int l, r, d; cin >> l >> r >> d;
    int c = 0;
    FOR(i, l, r+1){
        if (i%d==0) ++c;
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>

typedef unsigned long ul;
using namespace std;
const int valueLimit = 100;
ul INF = ULONG_MAX / 2;

int main(){
    int N, W;
    cin >> N >> W;
    vector<int> val(N);
    vector<int> weight(N);
    for (int i = 0; i<N;i++){
        cin >> val[i] >> weight[i] ;
    }

    ul DPtable[valueLimit * N + 1][N];
    for (int i=0;i<valueLimit * N + 1;i++){
        for (int j=0;j<N;j++){
            DPtable[i][j] = INF;
        }
    }
    for (int i=0;i<valueLimit*N+1;i++){
        DPtable[i][0] = INF;
    }
    DPtable[0][0] = 0;
    DPtable[val[0]][0] = weight[0];

    for (int j=1;j<N;j++){
        for (int i=0;i<valueLimit * N+1;i++){
            if (i == 0){
                DPtable[i][j] = 0;
            }else if (i < val[j]){
                DPtable[i][j] = DPtable[i][j-1];
            }else{
                DPtable[i][j] = min(DPtable[i][j-1], DPtable[i-val[j]][j-1] + weight[j]);
                }
        }
    }

    int result;
    for (int i=valueLimit*N;i>-1;i--){
        if (DPtable[i][N-1] <W+1){
            result = i;
            break;
        }
    }

    cout << result << endl;

    /*
    for (int i=0;i<valueLimit*N+1;i++){
        for (int j=0;j<N;j++){
            cout << DPtable[i][j] << " ";
        }
        cout << endl;
    }
    */

    return 0;
}

Measured memory_bytes: 10924
import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.nextLine();
		char[] b = a.toCharArray();
		for(int i = 0; i < b.length; i++){
			if(b[i] >= 'a' && b[i] <= 'z' ){
				b[i] -= 32;
			} else if(b[i] >= 'A' && b[i] <= 'Z'){
				b[i] += 32;
			}
		}
		System.out.println(String.valueOf(b));
	}
}


Measured memory_bytes: 26144
#include<iostream>
#include<cstdio>
#include<cstdlib>

using namespace std;

int main(){
	long long  a[1000]; 
	long long n;
	cin>>n;
	long long m=n;
	//if (n<=9) {cout<<n<<endl; return 0;}
	long long  ni=0;
	while (n!=0){
		ni++;
		a[ni]=n%10;
		n=n/10;
	}
	long long ans=0,s=0;
	for (int i=1; i<=ni-1; i++)
		s=(s*10)+9;
	//cout<<s<<endl;
	long long  p=1;
	for (int i=1; i<=ni-1; i++) p=p*10;
	///cout<<p<<endl;
	ans=(ni-1)*9;
	//cout<<ans<<endl;
	///cout<<"jdn   "<<a[ni]<<endl;	
	if ((a[ni]*p+s)<=m) ans=ans+a[ni];
		else ans=ans+a[ni]-1;
	cout<<ans<<endl; 			
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# abc136/abc136_c
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    H = i2nn()
    H[0] -= 1
    for i in range(1, N - 1):
        if H[i-1] < H[i]:
            H[i] -= 1
        if H[i] > H[i+1]:
            print('No')
            break
    else:
        print('Yes')
    return

main()


Measured memory_bytes: 15708
import java.util.*;

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

        List<Integer> bList = new ArrayList<>();
        for (int i = 0; i < m; i++){
            int h = sc.nextInt();
            bList.add(h);
        }
        List<List<Integer>> aList = new ArrayList<>();
        for (int i = 0; i < n; i++){
            List<Integer> aRow = new ArrayList<>();
            for (int j = 0; j < m; j ++){
                aRow.add(sc.nextInt());
            }
            aList.add(aRow);
        }

        int seitou = 0;
        for (int i = 0; i < n; i++){
            if (largerThanC(aList.get(i), bList, c, m)){
                seitou += 1;
            }
        }

        System.out.println(seitou);
    }

    private static boolean largerThanC(List<Integer> aRow, List<Integer> bList, int c, int m){
        int sum = 0;
        for(int j = 0; j < m; j++){
            sum += aRow.get(j) * bList.get(j);
        }
        return sum + c > 0;
    }
}

Measured memory_bytes: 25044
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

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

    li a, b, k;
    cin >> a >> b >> k;
    
    li tak = min(a, k);
    a -= tak;
    k -= tak;
    
    li aok = min(b, k);
    b -= aok;
    k -= aok;
    cout << a << " " << b << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<long long, long long>;
const long long INF = 1001001001;
const long long MOD = 1000000007;
const double EPS = 1e-10;

struct UnionFind {
    vector<int> d;
    int cc_cnt;
    UnionFind(int n): d(n, -1) { cc_cnt = n; }
    int find(int x) {
        if(d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x, int y) {
        x = find(x), y = find(y);
        if(x == y) return false;
        if(d[x] > d[y]) swap(x, y);
        d[x] += d[y];
        d[y] = x;
        cc_cnt--;
        return true;
    }
    bool same(int x, int y) { return find(x) == find(y); }
    int size(int x) { return -d[find(x)]; }
};

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

    int n,m;
    cin>>n>>m;
    int a[m],b[m];
    for(int i=0;i<m;i++){
        cin>>a[i]>>b[i];
        a[i]--; b[i]--;
    }
    int ans=0;
    for(int i=0;i<m;i++){
        UnionFind uf(n);
        for(int j=0;j<m;j++){
            if(j==i)continue;
            uf.unite(a[j],b[j]);
        }
        if(uf.cc_cnt>1)ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3600
n = int(input())
d, x = map(int, input().split())
a = []
for i in range(n):
    a.append(int(input()))
cnt = x

for i in range(n):

    if d-a[i] <= 0:
        cnt += 1
    else:
        cnt += (d-1)//a[i]+1

print(cnt)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <cstdio>
#include <climits>
#include <cmath>
#include <array>
#include <functional>
#include <sstream>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const double eps=1e-9;
const int inf=1e9;
typedef pair<int,int> P;
struct Point
{
  double x,y;
  Point(){x=0;y=0;}
  Point(double d_x,double d_y){x=d_x,y=d_y;}
  double operator*(Point obj){return obj.x*x+obj.y*y;}
  double operator%(Point obj){return obj.y*x-obj.x*y;}
  Point operator*(double b){Point tmp;tmp.x=x*b;tmp.y=y*b;return tmp;}
  Point operator/(double b){Point tmp;tmp.x=x/b;tmp.y=y/b;return tmp;}
  Point operator+(Point obj){Point tmp;tmp.x=x+obj.x;tmp.y=y+obj.y;return tmp;}
  Point operator-(){Point tmp;tmp.x=-x;tmp.y=-y;return tmp;}
  Point operator-(Point obj){Point tmp;tmp.x=x-obj.x;tmp.y=y-obj.y;return tmp;}
  Point operator-=(Point obj){x-=obj.x;y-=obj.y;return *this;}
  Point operator+=(Point obj){x+=obj.x;y+=obj.y;return *this;}
  Point operator/=(double b){x=x/b;y=y/b;return *this;}
  Point operator*=(double b){x=x*b;y=y*b;return *this;}
  double size(){return hypot(x,y);}
  Point unit(){return Point(x/size(),y/size());}
  Point normal(){return Point(y,-x);}
  double atan(){return atan2(y,x);}
};

bool operator<(Point a,Point b){return a.x!=b.x?a.x<b.x:a.y<b.y;}
bool operator>(Point a,Point b){return b<a;}
bool operator<=(Point a,Point b){return !(b<a);}
bool operator>=(Point a,Point b){return !(a<b);}
bool operator==(Point a,Point b){return (a-b).size()<eps;}
bool operator!=(Point a,Point b){return !(a==b);}

bool equal(double a,double b){return abs(a-b)<eps;}
double cross(Point a,Point b){return a%b;}
double dot(Point a,Point b){return a*b;}

int ccw(Point a,Point b,Point c)
{
  b=b-a;
  c=c-a;
  if(b%c>0) return +1;
  else if(b%c<0)return -1;
  else if(b*c<0) return +2;
  else if(b.size()<c.size()) return -2;
  else return 0;
}

struct colors
{
  double l,a,b;
  colors(double _l,double _a,double _b)
  {
    l=_l,a=_a,b=_b;
  }
};

int main(int argc,char const* argv[])
{
  int n,m;
  double l,a,b;
  vector<colors> v;
  cin >> n >> m;
  for(int i=0;i<n;i++)
    {
      cin >> l >> a >> b;
      v.push_back(colors(l,a,b));
    }
  double ans=-1;
  for(int i=0;i<(1<<n) ; i++)
    {
      vector<colors> elem;
      for(int j=0;j<n;j++)
	{
	  if(i & (1<< j))
	    {
	      elem.push_back(v[j]);
	    }
	}
      if((int)elem.size() !=m) continue;
      double tmp=0;
      for(int i=0;i<m-1;i++)
	{
	  for(int j=i+1;j<m;j++)
	    {
	      tmp+=(pow(elem[i].l-elem[j].l,2)+pow(elem[i].a-elem[j].a,2)+pow(elem[i].b-elem[j].b,2));
	    }
	}
      ans=max(ans,tmp);
    }
  cout << fixed << setprecision(9) << ans << endl;
    
  return 0;
}
			       
	



Measured memory_bytes: 3268
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}





int main() {
	ll mod = 1e9 + 7;
	ll N,an=1;
	cin >> N;
	for (ll i = 2; i <= N; i++) {
		bool prime = true;
		for (ll k = 2; k * k <= i; k++) {
			if (i % k == 0) {
				prime = false;
			}
		}
		if (prime) {
			ll M = N;
			ll k = 0;
			while (M > 0) {
				k += M / i;
				M /= i;
			}
			an *= (k + 1);
			an %=mod;
		}
	}
	cout << an << endl;


}


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

#define endl '\n'

int main() {
  int n;
  cin >> n;
  int a[n];
  int s = 0;
  for(int i=0; i<n; i++) {
    cin >> a[i];
    s ^= a[i];
  }
  for(int i=0; i<n; i++) {
    cout << (s^a[i]) << " ";
  }
  return 0;
}


Measured memory_bytes: 4400
#include <iostream>
using namespace std;
int main(){
    int n,k;
    string s;
    cin >> n >> k;
    cin >> s;
    char ex='A';
    int ans=0;
    for(int i=0;i<n;i++){
        if(s[i]==ex)ans++;
        else ex=s[i];
    }
    cout << min(ans+2*k,n-1);
    return 0;
}

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

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define SORT(arr) sort(arr, arr + ARRAY_LENGTH(arr))

int N,X;


int gcd(int a, int b){
  if(a<b){
    int tmp = a;
    a = b;
    b = tmp;
  }
  int r=999;
  while(r!=0){
    r = a%b;
    a = b;
    b = r;
  }
  return a;
}

int main(){
	cin >> N >> X;
	// cout << gcd(N,X) << endl;
	int x[N+1];
	for(int i=0;i<N;i++){
		cin >> x[i];
	}
	x[N]=X;
	SORT(x);

	int ans=abs(x[0]-x[1]);
	for(int i=1;i<N;i++){
		ans = gcd(abs(x[i]-x[i+1]),ans);
	}
  cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
n, m = map(int, input().split())
if m == 0:
    if n == 1:
        print(0)
        exit()
    else:
        print('1'+'0'*(n-1))
        exit()


L = [-1]*n
for i in range(m):
    s, c = map(int, input().split())
    s -= 1
    if L[s] == -1:
        L[s] = c
    else:
        if L[s] != c:
            print(-1)
            exit()

if n == 1:
    if L[0] == -1:
        print(0)
        exit()
    else:
        print(L[0])
        exit()

ans = ''
for i in range(n):
    if i == 0:
        if L[i] == 0:
            print(-1)
            exit()
        elif L[i] == -1:
            ans += '1'
        else:
            ans += str(L[i])
    else:
        if L[i] == -1:
            ans += '0'
        else:
            ans += str(L[i])
print(ans)


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

using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))

#define SI(n) scanf("%d",&n)
#define PI(n) printf("%d\n",n)
#define SL(n) scanf("%lld",&n)
#define PL(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)

#define TRACE

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

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
typedef long long int 	LL;
typedef long double 	LD;
typedef pair<int,int>   II;
typedef vector<int>     VI;
const int MOD = 1e9 + 7;
const int N = 100011;


int main() {
    int n;SI(n);
    map<int, int>mp;
    for(int i = 0, x; i < n; ++i) {
        SI(x);
        mp[x]++;
    }
    LL l = 0, b = 0;
    auto it = (--mp.end());
    while(1) {
        if(it->S >= 4 and !l and !b) {
            l = b = it->F;
            break;
        }
        else if(it->S >= 2 and !l) l = it->F;
        else if(it->S >= 2 and !b) b = it->F;
        if(it == mp.begin() || (l and b)) break;
        it--;
    }
    PL(l*b);
    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <queue>
#include <functional>

using namespace std;

typedef long long ll;

int main() {
    //cin.tie(0);
    //ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int ans = 0;
    vector<int> b(N);
    vector<int> h(N);
    for (int i = 0; i < N; ++i) {
        int t;
        cin >> t;

        h[i] = t;

        if (i > 0) {
            b[i] = max(b[i - 1], t);
            if (t >= b[i - 1]) ++ans;
        }
        else {
            b[i] = t;
            ++ans;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()

    var bool = false
    for (i in 1..9) {
        if (n % i == 0 && n / i <= 9) {
            bool = true
            break
        }
    }
    if (bool) {
        println("Yes")
    } else {
        println("No")
    }
}

Measured memory_bytes: 33604
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    auto A = aryread();
    long cnt = 1;
    long ans;
    foreach (a; A)
        if (a != cnt)
        {
            ans++;
        }
        else
        {
            cnt++;
        }
    if (ans == N)
        writeln(-1);
    else
        writeln(ans);
}


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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    unsigned long long n, p= 100, t=0;


    cin>> n;


    while( p<n)
    {
        p+= p/100;
        t++;
    }

    cout<< t;
    nl;

    return 0;
}




Measured memory_bytes: 3588