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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

const int MAX = 2000005;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

/* 初期化 */
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

/* combination */
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct modint{
    using i64=int_fast64_t;
    i64 a;
    static constexpr i64 MOD=1000000007;
    modint(){a=0;}
    modint(i64 a_){
        a=a_%MOD;
        if(a<0) a+=MOD;
    }
    modint inv()const{
        i64 n=1,m=MOD-2,A=a;
        while(m){
            if(m&1)(n*=A)%=MOD;
            (A*=A)%=MOD;
            m>>=1;
        }
        modint y(n);
        return y;
    }
    bool operator==(const modint& x){
        return a==x.a;
    }
    bool operator!=(const modint& x){
        return a!=x.a;
    }
    modint& operator=(const modint& x){
        a=x.a;
        return *this;
    }
    modint operator+(const modint& x){
        modint y;
        y.a=a+x.a;
        if(y.a>MOD) y.a-=MOD;
        return y;
    }
    modint operator-(const modint& x){
        modint y;
        y.a=a-x.a;
        if(y.a<0) y.a+=MOD;
        return y;
    }
    modint operator*(const modint& x){
        modint y;
        y.a=(a*x.a)%MOD;
        return y;
    }
    modint operator/(const modint& x){
        modint y;
        y.a=(a*x.inv().a)%MOD;
        return y;
    }
    modint& operator+=(const modint& x){
        a+=x.a;
        if(a>=MOD) a-=MOD;
        return *this;
    }
    modint& operator-=(const modint& x){
        a-=x.a;
        if(a<0) a+=MOD;
        return *this;
    }
    modint& operator*=(const modint& x){
        (a*=x.a)%=MOD;
        return *this;
    }
    modint& operator/=(const modint& x){
        (a*=x.inv().a)%=MOD;
        return *this;
    }
};
istream& operator>>(istream &in,modint& x){
    int_fast64_t a_;
    in>>a_;
    modint y(a_);
    x=y;
    return in;
}
ostream& operator<<(ostream &out,const modint& x){
    out<<x.a;
    return out;
}
modint pwr(int_fast64_t a,int_fast64_t b){
    modint _;
    int_fast64_t n=1,A=a;
    while(b){
        if(b&1) (n*=A)%=modint::MOD;
        (A*=A)%=modint::MOD;
        b>>=1;
    }
    _.a=n;
    return _;
}

int main() {
    modint ans = 0;
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    COMinit();

    REPN(i, b, w) {
        ans += COM(i+(h-a-1), i) * COM(a-1+(w-i-1), a-1);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 47104
H,W,M = map(int,input().split())

horizontal = [[i,0] for i in range(H)]
vertical = [[i,0] for i in range(W)]
table = {}

for i in range(M):
    h,w = map(int,input().split())
    h -= 1
    w -= 1
    table[(h,w)] = True
    vertical[w][1] += 1
    horizontal[h][1] += 1

vertical.sort(key=lambda x:-x[1])
horizontal.sort(key = lambda x:-x[1])

h_max = horizontal[0][1]
v_max = vertical[0][1]
    
for i in range(H):
    if horizontal[i][1]<h_max:
        i -= 1
        break
for j in range(W):
    if vertical[j][1]<v_max:
        j -= 1
        break

flag = False
for h in horizontal[:i+1]:
    for v in vertical[:j+1]:
        if table.get((h[0],v[0]))==None:
            flag = True
            break
    if flag:
        break

if flag:
    print(h_max+v_max)
else:
    print(h_max+v_max-1)

Measured memory_bytes: 199472
<?php
  list($n) = explode(" ", trim(fgets(STDIN)));
  list($p) = explode(" ", trim(fgets(STDIN)));

  $c = [];
  for($i=0;$i<strlen($p);$i++){
    if(!isset($c[$p[$i]])) $c[$p[$i]]=0;
    $c[$p[$i]]++;
  }
  for($i=1;$i<$n;$i++){
    list($p) = explode(" ", trim(fgets(STDIN)));
    $t=$c;
    $c=[];
    for($j=0;$j<strlen($p);$j++){
      if(isset($t[$p[$j]])){
        if(!isset($c[$p[$j]])) $c[$p[$j]]=0;
        $c[$p[$j]]++;
        $t[$p[$j]]--;
        if($t[$p[$j]]==0){
          unset($t[$p[$j]]);
        }
      }
    }
  }

  ksort($c);

  foreach($c as $key => $val){
    for($i=0;$i<$val;$i++){
      echo $key;
    }
  }
  echo PHP_EOL;

Measured memory_bytes: 16092
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

struct modint {
    ll x;
    modint(ll x = 0) : x((x % MOD + MOD) % MOD) {
    }
    ll value() const {
        return x;
    }
    modint operator-() const {
        return modint(-x);
    }
    modint& operator+=(const modint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    modint& operator-=(const modint a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
    modint& operator*=(const modint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    modint operator+(const modint a) const {
        modint res(*this);
        return res += a;
    }
    modint operator-(const modint a) const {
        modint res(*this);
        return res -= a;
    }
    modint operator*(const modint a) const {
        modint res(*this);
        return res *= a;
    }
    modint pow(ll t) const {
        if (t == 0) return 1;
        modint a = pow(t >> 1);
        a *= a;
        if (t % 2 == 1) a *= *this;
        return a;
    }
    modint inv() const {
        return pow(MOD - 2);
    }
    modint& operator/=(const modint a) {
        return (*this) *= a.inv();
    }
    modint operator/(const modint a) const {
        modint res(*this);
        return res /= a;
    }
};
struct combination {
    vector<modint> fact, ifact;
    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; i++) {
            fact[i] = fact[i - 1] * i;
        }
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; i--) {
            ifact[i - 1] = ifact[i] * i;
        }
    }
    modint operator()(int n, int k) {
        if (n < k || k < 0) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
    modint h(int n, int k) {
        n += k - 1;
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
} comb(2002002);

int main() {
    int x, y;
    cin >> x >> y;
    if ((x + y) % 3 != 0) {
        cout << 0 << endl;
        return 0;
    }
    int n = (x + y) / 3;
    int r = x - n;
    cout << comb(n, r).value() << endl;
}

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

typedef long long ll;
typedef unsigned long long ull;

int main(){
    string s;
    cin >> s;
    for(int i=0;i<s.size()-1;i++){
        if(s[i]!=s[s.size()-2-i]){
            cout << -1 << endl;
            return 0;
        }
    }
    if(s[s.size()-1]=='1' || s[0]=='0'){
        cout << -1 << endl;
        return 0;
    }

    queue<pair<int,int>> ans;
    int top=2;
    ans.push(make_pair(1,2));

    for(int i=3;i<=s.size();i++){
        if(s[i-2]=='1'){
            ans.push(make_pair(top,i));
            top=i;
        }else{
            ans.push(make_pair(top,i));
        }
    }

    while(!ans.empty()){
        auto p=ans.front();
        ans.pop();
        cout << p.first << " " << p.second << endl;
    }


    
    return 0;
}

Measured memory_bytes: 2304
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

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

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

            int n = in.nextInt();
            int x = in.nextInt() - 1;
            int y = in.nextInt() - 1;
            int[] dist = new int[n + 1];
            Arrays.fill(dist, 0);
            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    if (j <= x || y <= i) {
                        // 完全に外
                        dist[j - i]++;
                    } else if (i <= x && y <= j) {
                        // 内包する
                        dist[(x - i) + 1 + (j - y)]++;
                    } else if (x < i && j < y) {
                        // 内包される
                        dist[Math.min(j - i, i - x + 1 + (y - j))]++;
                    } else if (i <= x && j <= y) {
                        dist[Math.min(j - i, (x - i) + 1 + (y - j))]++;
                    } else if (x <= i && y <= j) {
                        dist[Math.min(j - i, i - x + 1 + (j - y))]++;
                    }
                }
            }

            for (int i = 0; i < n; i++) {
                if (i > 0) {
                    out.println(dist[i]);
                }
            }

        }

    }
}



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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, M; cin >> N >> M;
    int lenA = N+1;
    string S; cin >> S;
    int A[lenA]; rep(i, lenA) A[i] = S[i]-'0';
    reverse(A, A+lenA);
    int pos = 0;
    vector<int> ans;
    while(pos < N){
        int nx = pos+M;
        if(nx > N){
            ans.push_back(N-pos);
            break;
        }
        else{
            while(pos < nx && A[nx] == 1) nx--;
            if(nx == pos){
                cout << -1 << "\n";
                return 0;
            }
            ans.push_back(nx-pos);
            pos = nx;
        }
    }
    reverse(ans.begin(), ans.end());
    rep(i, ans.size()) cout << ans[i] << " "; cout << endl;
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

int main(){
    ll N,x;
    cin >> N >> x;
    ll a[101];
    for(int i=0;i<N;i++) cin >> a[i];
    sort(a,a+N);

    int ans=0;
    int last=0;
    for(int i=0;i<N;i++){
        if(a[i]<=x){
            ans++;
            x-=a[i];
            last=i+1;
        }
    }
    if(last==N && x>0) ans--;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <random>
#include <chrono>
#include <iomanip>
#define lint long long int
#define FOR(x, to) for(int x=0; x<(int)(to); x++)
#define DUMP(ar) for(int loop_dump=0; loop_dump<(int)ar.size(); loop_dump++) cout << "[" << loop_dump << "]:" << ar[loop_dump] << endl
#define DUMPL(ar) for(int loop_dump=0; loop_dump<(int)ar.size(); loop_dump++) { cout << ar[loop_dump]; if(loop_dump<(int)ar.size()-1) cout << ' '; } cout << endl;
#define COUT(x) cout << x << endl
#define ALL(ar) ar.begin(), ar.end()
#define LOOPD(i) cout << "ループ[" << i << "]回目---------------" << endl
using namespace std;

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

    string str;
    cin >> str;

    if(str.size() == 3){
        for(int i=2; i>=0; i--){
            cout << str[i];
        }
        cout << endl;
    }else{
        cout << str << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <cstdio>
#include <new>
#include <vector>
#include <cstdlib>
#include <string>

using namespace std;

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

	int point = 0;

	while (N >= 500) {
		point += 1000;
		N -= 500;
	}

	while (N >=5) {
		point += 5;
		N -= 5;
	}

	cout << point << endl;

}

Measured memory_bytes: 3604
#[allow(unused_imports)]
use std::cmp::{min,max};
#[allow(unused_imports)]
use std::collections::BTreeMap;
#[allow(unused_imports)]
use std::ops::*;
#[allow(unused_imports)]
use std::collections::BinaryHeap;

fn main() {
    let n = read_i64() as usize;
    let xs = read_vec_i64();
    let mut dp = vec![(None,None); 1<<n];
    for (i,&x) in xs.iter().enumerate() {
        dp[i].0 = Some(i);
    }
    let f = |xyi : (Option<usize>, Option<usize>), zi: Option<usize>| {
        let (xi,yi) = xyi;
        match zi {
            Some(zi) => {
                if  (xi.is_some() && xi.unwrap() == zi) ||
                    (yi.is_some() && yi.unwrap() == zi)    {
                    (xi,yi)
                }
                else if xi.is_none() || xs[xi.unwrap()] < xs[zi] {
                    (Some(zi),xi)
                }
                else if yi.is_none() || xs[yi.unwrap()] < xs[zi] {
                    (xi,Some(zi))
                }
                else {
                    (xi,yi)
                }
            }
            None => {
                (xi,yi)
            }
        }
    };
    for i in 0..(1<<n) {
        for k in 0..n {
            if i & (1 << k) != 0 {
                continue;
            }
            dp[i|(1<<k)] = f(dp[i|(1<<k)], dp[i].0);
            dp[i|(1<<k)] = f(dp[i|(1<<k)], dp[i].1);
        }
    }
    let mut res = 0;
    for i in 1..(1<<n) {
        res = max(res, xs[dp[i].0.unwrap()] + xs[dp[i].1.unwrap()]);
        println!("{}", res);
    }
}

#[allow(dead_code)]
fn read_line() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    ret.pop();
    return ret;
}

#[allow(dead_code)]
fn read_i64() -> i64 {
    let ss = read_line();
    return ss.parse::<i64>().unwrap();
}

#[allow(dead_code)]
fn read_vec_i64() -> Vec<i64> {
    let mut res = vec![];
    let ss = read_line();
    for ts in ss.split_whitespace() {
        let x = ts.parse::<i64>().unwrap();
        res.push(x);
    }
    return res;
}

use std::fmt::Display;
#[allow(dead_code)]
fn write_vec<T: Display>(xs: &Vec<T>) {
    if xs.len() == 0 {
        println!("");
        return;
    }
    print!("{}", xs[0]);
    for i in 1..xs.len() {
        print!(" {}", xs[i]);
    }
    println!("");
}


Measured memory_bytes: 16372
#include <iostream>
#include <bits/stdc++.h>
#include<vector>
#include<algorithm>

using namespace std;
#define inf 1e9
int frog(vector<int> a,int n)
{
    vector<int> dp(n+1);
    dp[1]=0;
    for(int i=2;i<=n;i++)
    {
        int option1= abs(a[i-1]-a[i]) + dp[i-1];
        int option2= i==2? inf : abs(a[i-2]-a[i]) + dp[i-2];
        dp[i]=min(option1,option2);
    }
    return dp[n];
    
}

int main()
{
   int n;
   cin>>n;
   vector<int> v(n+1);
   for(int i=1;i<=n;i++)
   {
       cin>>v[i];
   }
   cout<<frog(v,n)<<endl;
   
   return 0;
}

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

using namespace std;

int main()
{
    int n,k,q;
    cin >> n >>k >> q;
    vector<int >p(n,k);
    for(int i=0;i<q;i++){
        int a;
        cin >>a;
        p[a-1]++;
    }
    for(int i=0;i<n;i++){
        p[i]-=q;
        if(p[i]>0)puts("Yes");
        else puts("No");
    }
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
   using namespace std;
   vector<int> l[100005];
   int dp[100005];
   int visited[100005];

   void dfs(int n)
   {
      // if(dp[n]==0)
      //   dp[n]=1;
      visited[n]=1;
       int max1=0;
      for(int i=0;i<l[n].size();i++)
      {
         if(visited[l[n][i]]==0)
         {
            dfs(l[n][i]);
            // cout<<"1 "<<n<<" "<<l[n][i]<<"\n";
            //  max1=max(max1,dp[l[n][i]]+1);
            //  dp[n]=dp[n]+max1;
            // dp[n]=dp[n]+dp[l[n][i]]+1;
         }
          max1=max(max1,dp[l[n][i]]+1);
           
         // else
         // {// cout<<n<<" "<<l[n][i]<<"\n";
         //   cout<<"2 "<<n<<" "<<l[n][i]<<"\n";
         //   max1=max(max1,dp[l[n][i]]+1);
         //   dp[n]=max1;
         // }
      }  
        dp[n]=max1;
   }
   int main()
   {
      int n,m;
      cin>>n>>m;
      int x,y;
      for(int i=0;i<m;i++)
      {
         cin>>x>>y;
         l[x].push_back(y);
      }
      // for(int i=0;i<=100005;i++)
      //      dp[i]=1;

    //  cout<<"\n\n";
      for(int i=1;i<=n;i++)
      {
           if(visited[i]==0)
           {
              dfs(i);
           } 
      }
     // cout<<"\n\n";
      int max1=0;
      for(int i=0;i<=n;i++)
      {
        max1=max(dp[i],max1);
      }
      cout<<max1;

   }



Measured memory_bytes: 8576
#include <iostream>
using std::cin;
using std::cout;
#define LOWER -1000000
#define UPPER  1000000

int main(){
    int k,x;
    cin >> k >> x;
    for(int i = k-1; i >= 1 ; i--){
        if((x - i) >= LOWER){
            cout << x - i <<" "; 
        }
    }
    cout << x <<" ";
    for(int i = 1;i<k;i++){
        if((x + i) <= UPPER){
            cout << x + i<<" "; 
        }
    }
    return 0; 
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <iomanip>
#include <vector>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <ctime>
#include <fstream>
#include <stdarg.h>
using namespace std;
const bool debug=false;
const bool INJUDGE=false;
#define FASTERCIN cin.tie(0);ios_base::sync_with_stdio(false)
typedef long long ll;
/*Time:2018.4.7
Status:
Type:Atcoder Beginner #93
Author:zm_x*/
set<int> ans;
int a,b,k;
int main(){
	cin>>a>>b>>k;
	for(int i=a;i<=min(b,a+k-1);i++)ans.insert(i);
	for(int i=b;i>=max(a,b-k+1);i--)ans.insert(i);
	for(set<int>::iterator it=ans.begin();it!=ans.end();it++)cout<<*it<<endl;
	return 0;
}


Measured memory_bytes: 256
int_n, int_k = map(int, input().split())

li_wk = list()

for i in range(int_n):
    li_wk.append(list(map(int, input().split())))

li_wk.sort(key=lambda x: x[0])

counter = 1
for l in li_wk:
    if counter <= int_k <= (counter + l[1] - 1):
        print(l[0])
    counter += l[1]






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

using namespace std;
using ll = long long;
using pii = pair<int, int>;



int N;
int A[200010];
int B[200010];


int main(){
    
    priority_queue<pii, vector<pii>, greater<pii> > pq;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i] >> B[i];
        pq.push(make_pair(B[i], i));
    }
    ll tot = 0;
    bool ok = true;
    while(pq.size()){
        pii p = pq.top(); pq.pop();
        int idx = p.second;
        tot += A[idx];
        if(tot > B[idx]){
            ok = false;
            break;
        }
    }

    if(ok) cout<< "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 3444
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');

var lineNum = +lines.shift();
for (var i = 0; i < lineNum; i++) {
    var line = lines[i];
    var args = line.split(' ');
    args = args.map(function(k) { return +k; })
    args.sort(function(a, b) { return b - a; });
    if (Math.pow(args[0], 2) == Math.pow(args[1], 2) + Math.pow(args[2], 2)) {
        console.log('YES');
    } else {
        console.log('NO');
    }
}

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

const int N = 1e5 + 100;

int n, c, k, ans, t[N];

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> c >> k;
	for (int i = 0; i < n; i++)
		cin >> t[i];
	sort(t, t + n);
	for (int i = 0; i < n; i++) {
		ans++;
		int me = -1;
		for (int j = 0; j < c && (i + j) < n && t[i + j] <= (t[i] + k); j++)
			me++;
		i += me;
	}
	cout << ans;
}


Measured memory_bytes: 640
import heapq

n, K = map(int, input().split())
v = list(map(int, input().split()))
cum = [0] * (n+1)
for i in range(n):
    cum[i+1] += cum[i] + v[i]

ans = 0
for k in range(K+1):
    for i in range(k+1):
        if i > n:
            break
        j = k - i
        if j > i:
            continue
        for l in range(i+1):
            r = i - l
            score = 0
            hq = []
            for li in range(l):
                score += v[li]
                heapq.heappush(hq, v[li])
            for ri in range(r):
                ri = n - 1 - ri
                score += v[ri]
                heapq.heappush(hq, v[ri])
            for t in range(j):
                a = heapq.heappop(hq)
                score -= a
            ans = max(ans, score)

print(ans)


Measured memory_bytes: 61532
N, T = input().split()
N = int(N)
T = int(T)
NT = []

for i in range(N):
    ent = input().split()
    NT.append((i, int(ent[0]), int(ent[1])))

cost = 9999

for x in NT:
    if x[2] <= T:
        if x[1] < cost:
            cost = x[1]

if cost != 9999:
    print(cost)
else:
    print('TLE')

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

#define ll long long
#define ld long double
#define mod 1000000007LL
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define endl '\n'
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mp make_pair
#define pb(x) push_back(x)
#define fo(i, a, n) for (i = (a); i < (n); i++)
#define foe(i, a, n) for (i = (a); i <= (n); i++)
// clang-format off
#define vin(a) for (ll i = 0; i < sz(a); i++) { cin >> a[i]; } 
#define vout(a) for (auto x : a) { cout << x << " "; }
#define sws                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0)
// clang-format on
#define pd(x) cout << x
#define sd(x) cin >> x
#define nl cout << endl
#define gcd __gcd
#define all(a) (a).begin(), (a).end()
#define foreach(i, a)                                                          \
  for (__typeof((a).begin()) i = (a).begin(); i != (a).end(); ++i)
#define sz(a) (int)((a).size())
// int dw[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
void solve() {
  ll m, n;
  ll i, j;
  cin >> n >> m;
  cout << n * m;
}

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

Measured memory_bytes: 3672
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <ctype.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
typedef long long ll;
constexpr ll INF = 1000000000;
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n; cin >> n;
	vector<int>p(n);
	vector<int>a(n);

	rep(i, n)cin >> p[i];
	rep(i, n)a[i] = i + 1;

	vector<int>t(n);
	rep(i, n) {
		if (p[i] == a[i]) t[i] = 1;
		else t[i] = 0;
	}
	
	int count = 0;

	rep(i, n - 1) {
		if (t[i] == 1 && t[i + 1] == 1) {
			t[i] = 0;
			t[i + 1] = 0;
			count++;
		}
		else if (t[i] == 1 && t[i + 1] == 0) {
			t[i] = 0;
			count++;
		}
		else if (t[i] == 0 && t[i + 1] == 1 && i == n - 2) {
			t[i] = 0;
			count++;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 1408
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = 2000000000;
const ll MOD = 1000000007;

int N;
ll dp[101][4][4][4];

bool check3(int i, int j, int k) {
  if (i == 0 && j == 2 && k == 1) {
    return false;
  }
  if (i == 0 && j == 1 && k == 2) {
    return false;
  }
  if (i == 2 && j == 0 && k == 1) {
    return false;
  }
  return true;
}

bool check4(int i, int j, int k, int l) {
  if (!check3(j, k, l)) {
    return false;
  }
  if (i == 0 && j == 2 && l == 1) {
    return false;
  }
  if (i == 0 && k == 2 && l == 1) {
    return false;
  }
  return true;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  // 0 = A, 1 = C, 2 = G, 3 = T
  // string s = "ACGT";
  fill(dp[0][0][0], dp[101][0][0], 0);
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      for (int k = 0; k < 4; k++) {
        if (check3(i, j, k)) {
          dp[3][i][j][k] = 1;
        } else {
          dp[3][i][j][k] = 0;
        }
      }
    }
  }

  for (int t = 4; t <= N; t++) {
    for (int i = 0; i < 4; i++) {
      for (int j = 0; j < 4; j++) {
        for (int k = 0; k < 4; k++) {
          for (int l = 0; l < 4; l++) {
            if (check4(i, j, k, l)) {
              dp[t][j][k][l] = (dp[t][j][k][l] + dp[t - 1][i][j][k]) % MOD;
            }
          }
        }
      }
    }
  }

  long ans = 0;
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      for (int k = 0; k < 4; k++) {
        ans = (ans + dp[N][i][j][k]) % MOD;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

map<long long, int> prime_factor(long long N){
    map<long long, int> ans;
    for(long long i=2; i*i<=N; i++){
        while(N%i==0){
            ans[i]++;
            N/=i;
        }
    }
    if(N!=1) ans[N]= 1;
    return ans;
}

int num_divisor(long long n){
    map<long long , int> m=prime_factor(n);
    int ans =1;
    for(auto x : m){
        ans *= (x.second+1);
    }
    return ans;
}

int main(){
    int N; cin >> N;
    int cnt=0;
    for(int i=1; i<=N; i++){
        if(i%2 && num_divisor(i)==8){
//            cout << i << endl;;
            cnt++;
        }
    }
    cout << cnt << endl;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int H,N;
int A[101010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>H>>N;
	FOR(i,N) {
		cin>>A[i];
		H-=A[i];
	}
	if(H<=0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,m,q;
char s[2521][2521];
int vsum[2521][2521];
int esum1[2521][2521];
int esum2[2521][2521];

int ggg(int l,int r,int u,int d, int sum[2521][2521]){
  if(l>r || u>d)return 0;
  int ret = sum[d][r];
  if(l>0) ret -= sum[d][l-1];
  if(u>0) ret -= sum[u-1][r];
  if(l>0&&u>0)ret += sum[u-1][l-1];
  return ret;
}

int main(){
  scanf("%d%d%d",&n,&m,&q);
  REP(i,n)scanf("%s",s[i]);
  REP(i,n)REP(j,m){
    vsum[i][j] = s[i][j]=='1';
    if(j<m-1){
      esum1[i][j] = (s[i][j]=='1' && s[i][j+1]=='1');
    }
    if(i<n-1){
      esum2[i][j] = (s[i][j]=='1' && s[i+1][j]=='1');
    }
  }
  REP(i,n)REP(j,m)vsum[i][j+1] += vsum[i][j];
  REP(i,n)REP(j,m)vsum[i+1][j] += vsum[i][j];
  REP(i,n)REP(j,m)esum1[i][j+1] += esum1[i][j];
  REP(i,n)REP(j,m)esum1[i+1][j] += esum1[i][j];
  REP(i,n)REP(j,m)esum2[i][j+1] += esum2[i][j];
  REP(i,n)REP(j,m)esum2[i+1][j] += esum2[i][j];
  while(q--){
    int l,r,u,d;
    scanf("%d%d%d%d",&u,&l,&d,&r);
    --l;--r;--u;--d;
    // DEBUG(d);
    // DEBUG(r);
    // DEBUG(n-1);
    // DEBUG(m-1);
    int ans = ggg(l,r,u,d,vsum) - ggg(l,r-1,u,d,esum1) - ggg(l,r,u,d-1,esum2);
    printf("%d\n",ans);
  }
  return 0;
}


Measured memory_bytes: 69376
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int a[3];
  cin>>a[0]>>a[1]>>a[2];
  sort(a,a+3);
  cout<<a[1]-a[0]+a[2]-a[1]<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		
		if((a+b)%2==0){
			System.out.println((a+b)/2);
		}
		else{
			System.out.println("IMPOSSIBLE");
		}
	}
}

Measured memory_bytes: 23892
#include<iostream>
#include<cstdio>

using namespace std;

int memo[1<<17];
int N,t[20][20];

int mint(int p,int st){
  int i,re=t[p][0];
  for(i=0;i<N;i++)
    if(st&(1<<i))re=min(re,t[p][i+1]);
  return re;
}

int solve(int st){
  int i,j,k,re=16123456;
  if(memo[st]!=-1)
    return memo[st];
  if(st==0)return 0;
  for(i=0;i<N;i++){
    if(st&(1<<i)){
      re=min(re,solve(st^(1<<i))+mint(i,st^(1<<i)));
    }
  }
  return memo[st]=re;
}

int main(){
  int i,j,k;
  while(1){
    cin>>N;
    if(N==0)break;
    fill(memo,memo+(1<<17),-1);
    for(i=0;i<N;i++){
      for(j=0;j<N+1;j++){
	cin>>t[i][j];
      }
    }
    cout<<solve((1<<N)-1)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1672
#include<bits/stdc++.h>
//#include<tr1/unordered_map>
#pragma GCC optimize ("Ofast")
#define ll long long
#define pll pair<long long,long long>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forn(i, n) for(int i=0; i<int(n); i++)
#define Forn(i, n) for(int i=1; i<=int(n); i++)

using namespace std;

/*#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;*/

int n;
string s;

int main()
{
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> n >> s;
    forn(i, s.size())
    {
        char x = s[i];
        x += n;
        if(x>'Z') x -= 26;
        cout << (char) x;
    }
    cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,k,x[N];
bool dp[N];
int main()
{
	cin>>n>>k;
	dp[0]=true;
	for(int i=0;i<n;i++)
	{
		cin>>x[i];
	}
	for(int i=0;i<=k;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(i>=x[j])
			{
				if(x[j]==i)dp[i]=true;
				if(!dp[i-x[j]])
				{
					dp[i]=true;
				}
			}
		}
	}
	if(dp[k])cout<<"First\n";
	else cout<<"Second\n";
	return 0;
}

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

int a,b,c;

int main()
{
	cin>>a>>b>>c;
	if (a>b)  swap(a,b);
	if (a>c)  swap(a,c);
	if (b>c)  swap(b,c);
	if (a==5&&b==5&&c==7)  cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <iomanip>

using std::cin;
using std::cout;

template <typename T> inline T max(T a, T b) { return a < b ? b : a; }

const int MAXN = 1e4;
int x[MAXN], y[MAXN], diff[MAXN];

int main() {
	int len;
	cin >> len;
	for(int i = 1; i <= len; i++) cin >> x[i];
	for(int i = 1; i <= len; i++) cin >> y[i], diff[i] = abs(x[i] - y[i]);
	
	double Manhattan_dist, Euclidean_dist, Chebyshev_dist = -1, p3;
	for(int i = 1; i <= len; i++) {
		Manhattan_dist += diff[i];
		Euclidean_dist += pow(diff[i], 2);
		p3 += pow(diff[i], 3);
		Chebyshev_dist = max((double)diff[i], Chebyshev_dist);
	}
	Euclidean_dist = sqrt(Euclidean_dist);
	p3 = pow(p3, 1.0/3.0);
	
	cout << std::fixed << std::setprecision(6)
		<< Manhattan_dist << '\n'
		<< Euclidean_dist << '\n'
		<< p3 << '\n'
		<< Chebyshev_dist << '\n';
	return 0;
}


Measured memory_bytes: 3492
S = input()

if S == 'SUN':
    print(7)
elif S == 'MON':
    print(6)
elif S == 'TUE':
    print(5)
elif S == 'WED':
    print(4)
elif S == 'THU':
    print(3)
elif S == 'FRI':
    print(2)
elif S == 'SAT':
    print(1)


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

int main(){
  int N,W;
  cin >> N >> W;

  vector<long long> w(N);
  vector<int> v(N);
  for (int i = 0; i < N; i++)
  {
    cin >> w[i] >> v[i];
  }

  const long long INF = 1e12;
  long long dp[N+1][100009];
  for (int j = 0; j <= 100000; j++)
  {
    dp[0][j] = INF;
  }
  dp[0][0] = 0;
  for (int i = 1; i <= N; i++)
  {
    for (int j = 0; j <= 100000; j++)
    {
      if(j-v[i-1]>=0){
        dp[i][j] = min(dp[i-1][j],dp[i-1][j-v[i-1]]+w[i-1]);
      }
      else{
        dp[i][j] = dp[i-1][j];
      }
    }
  }

  int ans = 0;
  for (int i = 0; i <= N; i++)
  {
    for (int j = 0; j <= 100000; j++)
    {
      if(dp[i][j]<=W) ans = max(ans,j);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 79104
import collections

n = int(input())
s = [input() for i in range(n)]

c = collections.Counter(s)
max = 0
for i in c.values():
  if max < i:
    max = i

keys = [k for k, v in c.items() if v == max]
keys.sort()

for i in keys:
  print(i)

Measured memory_bytes: 35572
#include<stdio.h>
int main()
{
  long long  int sum=0, n,i;
    scanf("%lld",&n);
    for(i=1;i<=n;i++){
    
        if((i%3!=0 && i%5!=0))
        sum=sum+i;
    }
    printf("%lld\n",sum);
}

Measured memory_bytes: 1696
while True:
    H,W=map(int,input().split())
    if H==0 and W==0:
        break
    
    else:
        for i in range(H):
            for j in range(W):
                if i%2==0:
                    if j%2==1:
                        print('.',end='')
                    else:
                        print('#',end='')
                else:
                    if j%2==0:
                        print('.',end='')
                    else:
                        print('#',end='')
            print()
        print()


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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define PI (acos(-1.0))
#define MODN 1000000007
#define MODN2 998244353
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int main(){

    int n,m;
    cin >> n >> m;

    vector<int> ans(n + 1);

    rep(i, m){
        int a,b;
        cin >> a >> b;

        ans[a]++;
        ans[b]++;
    }

    rep(i, n){
        cout << ans[i + 1] << endl;
    }
    return 0;
}


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

int gcd(int a, int b) {
	if (b == 0)
		return a;
	return gcd(b, a % b);
}

int main() {
	int k;
	cin >> k;
	int sum = 0;
	for (int a = 1; a <= k; a++) {
		for (int b = 1; b <= k; b++) {
			for (int c = 1; c <= k; c++) {
				sum += gcd(a, gcd(b, c));
			}
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3636
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt() - 1, m = in.nextInt() - 1;
            out.printLine(n * m);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tokenizer = null;

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
        }

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

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

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}



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

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

    vector<int> W(N), B(N);
    for (int i = 0; i < N; i++) {
        if (S[i] == '.') W[i]++;
        if (S[i] == '#') B[i]++;
    }
    for (int i = 1; i < N; i++) {
        W[i] += W[i - 1];
        B[i] += B[i - 1];
    }

    int res = 1000000000;
    for (int i = 0; i < N; i++) {
        int b = B[i];
        int w = W[N - 1] - W[i];

        res = min(res, b + w);
    }

    res = min(res, B[N - 1]);
    res = min(res, W[N - 1]);

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 2180
import java.util.*;

class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    List<Double> ms = new ArrayList<Double>();
    while (scanner.hasNext()) {
      ms.add(scanner.nextDouble());
    }
    Collections.sort(ms);
    System.out.println(ms.get(ms.size() - 1) - ms.get(0));
  }
}

Measured memory_bytes: 18696
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//using graph = vector<vector<ll>>;


int main() {
	ll n;
	cin >> n;
	if (65 <= n && n <= 90) {
		cout << 1 << endl;
	}
	else if (97 <= n && n <= 122) {
		cout << 2 << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}


Measured memory_bytes: 3100
#include<iostream>
#include<vector>
#include<stack>
  
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;
  
int n;
vector<int> G[MAX];
int color[MAX];
  
void dfs(int r, int c) {
   stack<int> S;
   S.push(r);
   color[r] = c;
   while ( !S.empty() ) {
      int u = S.top(); S.pop();
      for ( int i = 0; i < G[u].size(); i++ ) {
         int v = G[u][i];
         if ( color[v] == NIL ) {
            color[v] = c;
            S.push(v);
         }
      }
   }
}
 
void assignColor() {
   int id = 1;
   for ( int i = 0; i < n; i++ ) color[i] = NIL;
 
   for ( int u = 0; u < n; u++ ) {
      if ( color[u] == NIL ) dfs(u, id++ );
   }
}
 
int main() {
   int s, t, m, q;
 
   cin >> n >> m;
 
   for ( int i = 0; i < m; i++ ) {
      cin >> s >> t;
      G[s].push_back(t);
      G[t].push_back(s);
   }
 
   assignColor();
    
   cin >> q;
 
   for ( int i = 0; i < q; i++ ) {
      cin >> s >> t;
      if ( color[s] == color[t] ) {
         cout << "yes" << endl;
      } else {
      cout << "no" << endl;
      }
   }
  
   return 0;
}

Measured memory_bytes: 8952
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl "\n"

int bit[22];

int32_t main()
{
	IOS;
	int n;
	cin>>n;
	int a[n+3];
	int ans=0;
	int cur=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		int ct=0;
		for(int j=0;j<20;j++)
		{
			if(a[i]&(1<<j))
			{
				ct=max(ct,bit[j]);
				bit[j]=i;
			}
		}
		ans+=i-max(cur,ct);
		cur=max(cur,ct);
	}
	cout<<ans;
 	return 0;
} 


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int long long
struct face{
  string c[3];
  face(){}
  face(string s[3]){
    for(int i=0;i<3;i++) c[i]=s[i];
  }
};
struct dice{
  face f[6];
  int d;
  dice(){}
  dice(string s[6][3]){
    d=0;
    for(int i=0;i<6;i++)
      f[i]=face(s[i]);
  }
};

bool check(dice d){
  bool res=1,f;
  f=0;
  for(int i=0;i<3;i++) f|=d.f[0].c[2][i]=='*';
  res&=f;
  f=0;
  for(int i=0;i<3;i++) f|=d.f[2].c[2][i]=='*';
  res&=f;
  return res;
}
face sr(face f){
  face p=f;
  for(int i=0;i<3;i++)
    for(int j=0;j<3;j++)
      p.c[i][j]=f.c[2-j][i];
  return p;
}
face sl(face f){
  face p=f;
  for(int i=0;i<3;i++)
    for(int j=0;j<3;j++)
      p.c[i][j]=f.c[j][2-i];
  return p;
}
face re(face f){
  face p=sr(f);
  /*
  for(int i=0;i<3;i++)
    p.c[i]=f.c[2-i];
  */
  return sr(p);
}
dice rotate1(dice d){
  dice b=d;
  b.d++;
  b.f[0]=d.f[5];
  b.f[1]=sr(d.f[1]);
  b.f[2]=re(d.f[4]);
  b.f[3]=sl(d.f[3]);
  b.f[4]=d.f[0];
  b.f[5]=re(d.f[2]);
  return b;
}
dice rotate2(dice d){
  dice b=d;
  b.d++;
  b.f[0]=d.f[4];
  b.f[1]=sl(d.f[1]);
  b.f[2]=re(d.f[5]);
  b.f[3]=sr(d.f[3]);
  b.f[4]=re(d.f[2]);
  b.f[5]=d.f[0];
  return b;
}
dice rotate3(dice d){
  dice b=d;
  b.d++;
  b.f[0]=sl(d.f[0]);
  b.f[1]=sl(d.f[5]);
  b.f[2]=sr(d.f[2]);
  b.f[3]=sl(d.f[4]);
  b.f[4]=sl(d.f[1]);
  b.f[5]=sl(d.f[3]);
  return b;
}
dice rotate4(dice d){
  dice b=d;
  b.d++;
  b.f[0]=sr(d.f[0]);
  b.f[1]=sr(d.f[4]);
  b.f[2]=sl(d.f[2]);
  b.f[3]=sr(d.f[5]);
  b.f[4]=sr(d.f[3]);
  b.f[5]=sr(d.f[1]);
  return b;
}
signed main(){
  string tmp;
  while(cin>>tmp,tmp!="#"){
    string s[6][3];
    s[0][0]=tmp;
    for(int i=0;i<6;i++){
      for(int j=0;j<3;j++){
	if((i||j)==0) continue;
	cin>>s[i][j];
      }
    }
    dice d(s);
    queue<dice> q;
    q.push(d);
    int ans=-1;
    while(!q.empty()){
      d=q.front();q.pop();
      if(check(d)){
	ans=d.d;
	break;
      }
      //if(d.d>1) break;
      /*//
      cout<<d.d<<endl;
      for(int i=0;i<6;i++){
	for(int j=0;j<3;j++) cout<<d.f[i].c[j]<<endl;
	cout<<endl;
      }
      //*/
      q.push(rotate1(d));
      q.push(rotate2(d));
      q.push(rotate3(d));
      q.push(rotate4(d));
    }
    assert(~ans);
    cout<<ans<<endl;
  }
  assert(tmp=="#");
  return 0;
}

Measured memory_bytes: 3288
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
#define ITR(v, i) for(auto ite = v.begin(); ite != v.end(); ite++)
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> x;
    a = 100;
    while(a < x) {
        a = a * 1.01;
        ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3640
/*
String[]の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
 */
import java.util.*;
import java.awt.*;
import java.awt.geom.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        int n=sc.nextInt();
        long x=sc.nextLong();
        long[] a=new long[51];
        a[0]=1;
        long[] p=new long[51];
        p[0]=1;
        for (int i = 0; i < 50; i++) {
            a[i+1]=2*a[i]+3;
            p[i+1]=2*p[i]+1;
        }
        out.println(f(a,p,n,x));
    }
    static long f(long[] a,long[] p,int n,long x){
        if(x==1)return n>0?0:1;
        if(x==3+2*a[n-1])return p[n-1]*2+1;
        if(x==a[n-1]+2)return p[n-1]+1;
        if(1<x&&x<=a[n-1]+1)return f(a,p,n-1,x-1);
        return p[n-1]+1+f(a,p,n-1,x-a[n-1]-2);
    }
}

Measured memory_bytes: 24020
#include<iostream>
#include<vector>
using std::vector;

int main (){
    std::cin.tie(0); 
	std::ios::sync_with_stdio(false);
    int CONTEST_PATTERN=26;
    int D;std::cin >> D; //365

    //コンテストごとの満足度の下がりやすさ。添え字はコンテスト種類
    vector<int> c(CONTEST_PATTERN,0);
    for(int i =0;i<CONTEST_PATTERN;++i){
        std::cin >> c[i];
    }

    //コンテスとの満足度。添え字は開催日、コンテスト種類
    vector< vector<int> > s(D,vector<int> (CONTEST_PATTERN,0) );
    for(int i =0;i<D;++i){
        for (int j=0;j<CONTEST_PATTERN;++j){
            std::cin >> s[i][j];
        }
    }

    //コンテスト開催配列。添え字は開催日
    vector<int> t(D,0);
    for (int i=0;i<D;++i){
        std::cin >> t[i];
        --t[i];
    }

    vector<int> lastDay(CONTEST_PATTERN,-1); // 0日スタートを1日開始にするため-1とする
    int satisfaction=0;
    for (int i=0;i<t.size();++i) {
        satisfaction += s[i][t[i]]; //t[i]コンテストの満足度を加算
        lastDay[t[i]]=i; //開催日を更新
        //満足度の減少処理
        for(int j=0;j<CONTEST_PATTERN;++j){
            satisfaction -= c[j] * (i-lastDay[j]);
        }
        std::cout << satisfaction << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define M 1000000007

void solve(){
	int l,r,d;
	cin >> l >> r >> d;
	int count  =0 ;
	for(int i=l ; i<=r; i++){
		if(i%d==0) count++;
	}	
	cout << count;
}

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

	solve();
	return 0;	
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  if((a==b && b!=c) || (a==c && b!=c) ||(c==b && a!=b))
    cout<<"Yes";
  else
     cout<<"No";
  return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(lambda x: int(x) - 1, input().split()))

stack = [0]
visited = {0}

now = 0
while A[now] not in visited:
    now = A[now]
    stack.append(now)
    visited.add(now)

roop_start = A[now]

roop = []
while stack[-1] != roop_start:
    roop.append(stack.pop())
roop.append(roop_start)
roop = roop[::-1]
roop_size = len(roop)

now = 0
while now != roop_start and K:
    now = A[now]
    K -= 1

if K == 0:
    print(now + 1)
else:
    print(roop[K % roop_size] + 1)


Measured memory_bytes: 32584
N , K = map(int,input().split())
p = list(map(float,input().split()))

ki = [0] * N

for i in range(N):
    ki[i] = (1+p[i]) / 2

ans = 0

for j in range(K):
    ans += ki[j]

b_result = ans

for times in range(N-K):
    tmp = b_result
    tmp = tmp - ki[times] + ki[K+times]
    if tmp >= ans:
        ans = tmp
    b_result = tmp

print(ans)

Measured memory_bytes: 23588
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace A_ABC172
{
    class MainClass
    {

        static int[] s;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            int a = s[0];
            int aaa = (int)Pow(a,2) + (int)Pow(a,3) + a;
            WriteLine(aaa);
        }
    }
}


Measured memory_bytes: 28252